Restart conatiner with on-failure policy if exit code != 0
Signed-off-by: Michael Crosby <michael@docker.com>
This commit is contained in:
parent
41870a42be
commit
feda8fbb21
1 changed files with 2 additions and 1 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Reference in a new issue