Fix container register failed during daemon start and try to start the container

Signed-off-by: Lei Jitang <leijitang@huawei.com>
Upstream-commit: b4841dd2371cdab8ef6e01d8304622fdb3578644
Component: engine
This commit is contained in:
Lei Jitang
2015-09-13 22:52:56 -04:00
parent 606a0a3218
commit 2cfd978e65

View File

@ -314,7 +314,9 @@ func (daemon *Daemon) restore() error {
}
if err := daemon.Register(container); err != nil {
logrus.Debugf("Failed to register container %s: %s", container.ID, err)
logrus.Errorf("Failed to register container %s: %s", container.ID, err)
// The container register failed should not be started.
return
}
// check the restart policy on the containers and restart any container with
@ -323,7 +325,7 @@ func (daemon *Daemon) restore() error {
logrus.Debugf("Starting container %s", container.ID)
if err := container.Start(); err != nil {
logrus.Debugf("Failed to start container %s: %s", container.ID, err)
logrus.Errorf("Failed to start container %s: %s", container.ID, err)
}
}
}(c.container, c.registered)