Ensure all the running containers are killed on daemon shutdown

Signed-off-by: Lei Jitang <leijitang@huawei.com>
(cherry picked from commit bdb77078b5)
This commit is contained in:
Lei Jitang
2015-05-29 16:50:23 -07:00
committed by Jessica Frazelle
parent 63e3b7433f
commit 4fefcde5a6
2 changed files with 19 additions and 2 deletions
+3 -2
View File
@@ -1003,8 +1003,9 @@ func (daemon *Daemon) Shutdown() error {
go func() {
defer group.Done()
if err := c.KillSig(15); err != nil {
logrus.Debugf("kill 15 error for %s - %s", c.ID, err)
// If container failed to exit in 10 seconds of SIGTERM, then using the force
if err := c.Stop(10); err != nil {
logrus.Errorf("Stop container %s with error: %v", c.ID, err)
}
c.WaitStop(-1 * time.Second)
logrus.Debugf("container stopped %s", c.ID)