Restart conatiner with on-failure policy if exit code != 0
Signed-off-by: Michael Crosby <michael@docker.com> Upstream-commit: feda8fbb21489f64aa3b7340c94473a08502bd6b Component: engine
This commit is contained in:
@ -370,7 +370,8 @@ func (daemon *Daemon) restore() error {
|
||||
log.Debugf("Restarting containers...")
|
||||
|
||||
for _, container := range registeredContainers {
|
||||
if container.hostConfig.RestartPolicy.Name == "always" {
|
||||
if container.hostConfig.RestartPolicy.Name == "always" ||
|
||||
(container.hostConfig.RestartPolicy.Name == "on-failure" && container.State.ExitCode != 0) {
|
||||
utils.Debugf("Starting container %s", container.ID)
|
||||
|
||||
if err := container.Start(); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user