From 4db0e2e1ecd74a3d82cd69cf99e121b34d4c991a Mon Sep 17 00:00:00 2001 From: HuKeping Date: Wed, 7 Jan 2015 15:16:04 +0800 Subject: [PATCH] restart: Fix the compare of restart policy Since the failure count of container will increase by 1 every time it exits successfully, the compare in function shouldRestart() will stop container to restart by the last time. Signed-off-by: Hu Keping Upstream-commit: e721ed9b5319e8e7c1daf87c34690f8a4e62c9e3 Component: engine --- components/engine/daemon/monitor.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/engine/daemon/monitor.go b/components/engine/daemon/monitor.go index 081ca391bb..9e7d3062f0 100644 --- a/components/engine/daemon/monitor.go +++ b/components/engine/daemon/monitor.go @@ -230,7 +230,7 @@ func (m *containerMonitor) shouldRestart(exitCode int) bool { return true case "on-failure": // the default value of 0 for MaximumRetryCount means that we will not enforce a maximum count - if max := m.restartPolicy.MaximumRetryCount; max != 0 && m.failureCount >= max { + if max := m.restartPolicy.MaximumRetryCount; max != 0 && m.failureCount > max { log.Debugf("stopping restart of container %s because maximum failure could of %d has been reached", utils.TruncateID(m.container.ID), max) return false