Skip to content

Commit

Permalink
Fix daemon not cleaned up w/ live restore enabled
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
cpuguy83 committed Jul 8, 2016
1 parent bd37b83 commit 2d5dc94
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion daemon/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 2d5dc94

Please sign in to comment.