From 6efdf7963ed94cec396333d594e42775d79fd265 Mon Sep 17 00:00:00 2001 From: Kenfe-Mickael Laventure Date: Fri, 31 Mar 2017 09:33:36 -0700 Subject: [PATCH] Ensure health probe is stopped when a container exits Signed-off-by: Kenfe-Mickael Laventure Upstream-commit: 04ae628ca55904a2768b4fec59a99803b6fe0850 Component: engine --- components/engine/daemon/monitor.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/components/engine/daemon/monitor.go b/components/engine/daemon/monitor.go index 96d7afd920..9227525e72 100644 --- a/components/engine/daemon/monitor.go +++ b/components/engine/daemon/monitor.go @@ -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)), }