mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Always mark as stopped for non running containers
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@docker.com> (github: crosbymichael)
This commit is contained in:
parent
9dc82e6102
commit
a091d949ac
1 changed files with 9 additions and 9 deletions
|
@ -209,6 +209,7 @@ func (daemon *Daemon) register(container *Container, updateSuffixarray bool, con
|
||||||
}
|
}
|
||||||
daemon.execDriver.Terminate(cmd)
|
daemon.execDriver.Terminate(cmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := container.Unmount(); err != nil {
|
if err := container.Unmount(); err != nil {
|
||||||
utils.Debugf("unmount error %s", err)
|
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)
|
info := daemon.execDriver.Info(container.ID)
|
||||||
if !info.IsRunning() {
|
if !info.IsRunning() {
|
||||||
utils.Debugf("Container %s was supposed to be running but is not.", container.ID)
|
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 {
|
if daemon.config.AutoRestart {
|
||||||
utils.Debugf("Marking as restarting")
|
utils.Debugf("Marking as restarting")
|
||||||
if err := container.Unmount(); err != nil {
|
|
||||||
utils.Debugf("restart unmount error %s", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
if containersToStart != nil {
|
if containersToStart != nil {
|
||||||
*containersToStart = append(*containersToStart, container)
|
*containersToStart = append(*containersToStart, container)
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
utils.Debugf("Marking as stopped")
|
|
||||||
container.State.SetStopped(-127)
|
|
||||||
if err := container.ToDisk(); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue