1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Merge pull request #32274 from mlaventure/fix-healthcheck-rm-race

Ensure health probe is stopped when a container exits
This commit is contained in:
Vincent Demeester 2017-04-04 16:14:10 +02:00 committed by GitHub
commit d7e7aa67ea

View file

@ -45,7 +45,7 @@ func (daemon *Daemon) StateChanged(id string, e libcontainerd.StateInfo) error {
c.StreamConfig.Wait()
c.Reset(false)
restart, wait, err := c.RestartManager().ShouldRestart(e.ExitCode, false, time.Since(c.StartedAt))
restart, wait, err := c.RestartManager().ShouldRestart(e.ExitCode, c.HasBeenManuallyStopped, time.Since(c.StartedAt))
if err == nil && restart {
c.RestartCount++
c.SetRestarting(platformConstructExitStatus(e))
@ -54,7 +54,9 @@ func (daemon *Daemon) StateChanged(id string, e libcontainerd.StateInfo) error {
defer autoRemove()
}
daemon.updateHealthMonitor(c)
// cancel healthcheck here, they will be automatically
// restarted if/when the container is started again
daemon.stopHealthchecks(c)
attributes := map[string]string{
"exitCode": strconv.Itoa(int(e.ExitCode)),
}