fix #29199, reset container if container start failed

Signed-off-by: Lei Jitang <leijitang@huawei.com>
(cherry picked from commit e806821b53)
Signed-off-by: Victor Vieux <vieux@docker.com>
This commit is contained in:
Lei Jitang 2016-12-07 01:37:08 -05:00 committed by Victor Vieux
parent bec385cff0
commit c9ec321e56

View file

@ -119,6 +119,9 @@ func (daemon *Daemon) containerStart(container *container.Container, checkpoint
container.SetExitCode(128)
}
container.ToDisk()
container.Reset(false)
daemon.Cleanup(container)
// if containers AutoRemove flag is set, remove it after clean up
if container.HostConfig.AutoRemove {
@ -187,8 +190,6 @@ func (daemon *Daemon) containerStart(container *container.Container, checkpoint
container.SetExitCode(127)
}
container.Reset(false)
return fmt.Errorf("%s", errDesc)
}