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>
| ... | ... |
@@ -230,7 +230,7 @@ func (m *containerMonitor) shouldRestart(exitCode int) bool {
|
| 230 | 230 |
return true |
| 231 | 231 |
case "on-failure": |
| 232 | 232 |
// the default value of 0 for MaximumRetryCount means that we will not enforce a maximum count |
| 233 |
- if max := m.restartPolicy.MaximumRetryCount; max != 0 && m.failureCount >= max {
|
|
| 233 |
+ if max := m.restartPolicy.MaximumRetryCount; max != 0 && m.failureCount > max {
|
|
| 234 | 234 |
log.Debugf("stopping restart of container %s because maximum failure could of %d has been reached",
|
| 235 | 235 |
utils.TruncateID(m.container.ID), max) |
| 236 | 236 |
return false |