mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
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 <hukeping@huawei.com>
This commit is contained in:
parent
9f2c486144
commit
e721ed9b53
1 changed files with 1 additions and 1 deletions
|
@ -230,7 +230,7 @@ func (m *containerMonitor) shouldRestart(exitCode int) bool {
|
||||||
return true
|
return true
|
||||||
case "on-failure":
|
case "on-failure":
|
||||||
// the default value of 0 for MaximumRetryCount means that we will not enforce a maximum count
|
// 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",
|
log.Debugf("stopping restart of container %s because maximum failure could of %d has been reached",
|
||||||
utils.TruncateID(m.container.ID), max)
|
utils.TruncateID(m.container.ID), max)
|
||||||
return false
|
return false
|
||||||
|
|
Loading…
Reference in a new issue