From 83fbaa3cb4042728082de130a7c6659224b327b2 Mon Sep 17 00:00:00 2001 From: Lei Jitang Date: Thu, 16 Jun 2016 07:54:36 -0400 Subject: [PATCH] Fix restore active sandbox we store the active sandbox after daemon.containerd.Restore, but there is a chance the `Restore` will set the container to exit see (https://github.com/docker/docker/blob/master/libcontainerd/client_linux.go#L469). so we should check if the container is really running before add it to activesandbox. Signed-off-by: Lei Jitang (cherry picked from commit 78f3094518b1f3f498bd2629667877f9a87d452f) --- daemon/daemon.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/daemon/daemon.go b/daemon/daemon.go index 66b088ab59..7ec71a1305 100644 --- a/daemon/daemon.go +++ b/daemon/daemon.go @@ -179,7 +179,7 @@ func (daemon *Daemon) restore() error { logrus.Errorf("Failed to restore with containerd: %q", err) return } - if !c.HostConfig.NetworkMode.IsContainer() { + if !c.HostConfig.NetworkMode.IsContainer() && c.IsRunning() { options, err := daemon.buildSandboxOptions(c) if err != nil { logrus.Warnf("Failed build sandbox option to restore container %s: %v", c.ID, err)