Fix daemon not cleaned up w/ live restore enabled

This patch makes sure daemon resources are cleaned up on shutdown if
there are no running containers.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Upstream-commit: 2d5dc94b9b547a9ba73f7b613e358b03fdfb2b84
Component: engine
This commit is contained in:
Brian Goff
2016-07-07 22:19:48 -04:00
parent 6594994c99
commit fde455a0e2

View File

@ -652,8 +652,12 @@ func (daemon *Daemon) Shutdown() error {
// Keep mounts and networking running on daemon shutdown if
// we are to keep containers running and restore them.
if daemon.configStore.LiveRestore {
return nil
// check if there are any running containers, if none we should do some cleanup
if ls, err := daemon.Containers(&types.ContainerListOptions{}); len(ls) != 0 || err != nil {
return nil
}
}
if daemon.containers != nil {
logrus.Debug("starting clean shutdown of all containers...")
daemon.containers.ApplyAll(func(c *container.Container) {