Ensure health probe is stopped when a container exits

Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
This commit is contained in:
Kenfe-Mickael Laventure 2017-03-31 09:33:36 -07:00
parent 9f9cc221bd
commit 04ae628ca5
1 changed files with 4 additions and 2 deletions

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)),
}