diff --git a/runtime/container.go b/runtime/container.go index ed68fd0844..bd4a6f2bea 100644 --- a/runtime/container.go +++ b/runtime/container.go @@ -915,7 +915,6 @@ func (container *Container) Stop(seconds int) error { // 1. Send a SIGTERM if err := container.KillSig(15); err != nil { - utils.Debugf("Error sending kill SIGTERM: %s", err) log.Print("Failed to send SIGTERM to the process, force killing") if err := container.KillSig(9); err != nil { return err diff --git a/runtime/runtime.go b/runtime/runtime.go index d5c1a96ada..9e8323279e 100644 --- a/runtime/runtime.go +++ b/runtime/runtime.go @@ -797,13 +797,18 @@ func (runtime *Runtime) shutdown() error { group := sync.WaitGroup{} utils.Debugf("starting clean shutdown of all containers...") for _, container := range runtime.List() { - if container.State.IsRunning() { - utils.Debugf("stopping %s", container.ID) + c := container + if c.State.IsRunning() { + utils.Debugf("stopping %s", c.ID) group.Add(1) go func() { defer group.Done() - container.Stop(10) + if err := c.KillSig(15); err != nil { + utils.Debugf("kill 15 error for %s - %s", c.ID, err) + } + c.Wait() + utils.Debugf("container stopped %s", c.ID) }() } }