Always mark as stopped for non running containers
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@docker.com> (github: crosbymichael) Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@docker.com> (github: vieux) Upstream-commit: 2c185e25c22b82614210908c445a32fa3dbe5ed1 Component: engine
This commit is contained in:
committed by
Victor Vieux
parent
04ff3d25e5
commit
25d55543df
@ -209,6 +209,7 @@ func (daemon *Daemon) register(container *Container, updateSuffixarray bool, con
|
||||
}
|
||||
daemon.execDriver.Terminate(cmd)
|
||||
}
|
||||
|
||||
if err := container.Unmount(); err != nil {
|
||||
utils.Debugf("unmount error %s", err)
|
||||
}
|
||||
@ -219,21 +220,20 @@ func (daemon *Daemon) register(container *Container, updateSuffixarray bool, con
|
||||
info := daemon.execDriver.Info(container.ID)
|
||||
if !info.IsRunning() {
|
||||
utils.Debugf("Container %s was supposed to be running but is not.", container.ID)
|
||||
|
||||
utils.Debugf("Marking as stopped")
|
||||
|
||||
container.State.SetStopped(-127)
|
||||
if err := container.ToDisk(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if daemon.config.AutoRestart {
|
||||
utils.Debugf("Marking as restarting")
|
||||
if err := container.Unmount(); err != nil {
|
||||
utils.Debugf("restart unmount error %s", err)
|
||||
}
|
||||
|
||||
if containersToStart != nil {
|
||||
*containersToStart = append(*containersToStart, container)
|
||||
}
|
||||
} else {
|
||||
utils.Debugf("Marking as stopped")
|
||||
container.State.SetStopped(-127)
|
||||
if err := container.ToDisk(); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user