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 <leijitang@huawei.com>
(cherry picked from commit 78f3094518
)
This commit is contained in:
parent
1ad7b517fa
commit
83fbaa3cb4
1 changed files with 1 additions and 1 deletions
|
@ -179,7 +179,7 @@ func (daemon *Daemon) restore() error {
|
||||||
logrus.Errorf("Failed to restore with containerd: %q", err)
|
logrus.Errorf("Failed to restore with containerd: %q", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if !c.HostConfig.NetworkMode.IsContainer() {
|
if !c.HostConfig.NetworkMode.IsContainer() && c.IsRunning() {
|
||||||
options, err := daemon.buildSandboxOptions(c)
|
options, err := daemon.buildSandboxOptions(c)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.Warnf("Failed build sandbox option to restore container %s: %v", c.ID, err)
|
logrus.Warnf("Failed build sandbox option to restore container %s: %v", c.ID, err)
|
||||||
|
|
Loading…
Reference in a new issue