Skip to content

Commit

Permalink
Merge pull request moby#22043 from WeiZhang555/remove-start-event-fai…
Browse files Browse the repository at this point in the history
…led-start

Remove start/die event when fail to start container
  • Loading branch information
cpuguy83 committed Apr 19, 2016
2 parents ab6b82b + 5548966 commit bb91bd3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
6 changes: 0 additions & 6 deletions daemon/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,6 @@ func (daemon *Daemon) containerStart(container *container.Container) (err error)
}
container.ToDisk()
daemon.Cleanup(container)
attributes := map[string]string{
"exitCode": fmt.Sprintf("%d", container.ExitCode),
}
daemon.LogContainerEventWithAttributes(container, "die", attributes)
}
}()

Expand Down Expand Up @@ -149,8 +145,6 @@ func (daemon *Daemon) containerStart(container *container.Container) (err error)

container.Reset(false)

// start event is logged even on error
daemon.LogContainerEvent(container, "start")
return err
}

Expand Down
12 changes: 10 additions & 2 deletions integration-cli/docker_cli_events_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,16 @@ func (s *DockerSuite) TestEventsContainerFailStartDie(c *check.C) {
dieEvent = true
}
}
c.Assert(startEvent, checker.True, check.Commentf("Start event not found: %v\n%v", actions, events))
c.Assert(dieEvent, checker.True, check.Commentf("Die event not found: %v\n%v", actions, events))

// Windows platform is different from Linux, it will start container whatever
// so Windows can get start/die event but Linux can't
if daemonPlatform == "windows" {
c.Assert(startEvent, checker.True, check.Commentf("Start event not found: %v\n%v", actions, events))
c.Assert(dieEvent, checker.True, check.Commentf("Die event not found: %v\n%v", actions, events))
} else {
c.Assert(startEvent, checker.False, check.Commentf("Start event not expected: %v\n%v", actions, events))
c.Assert(dieEvent, checker.False, check.Commentf("Die event not expected: %v\n%v", actions, events))
}
}

func (s *DockerSuite) TestEventsLimit(c *check.C) {
Expand Down

0 comments on commit bb91bd3

Please sign in to comment.