From d440782e17d384d52c813f93cd53d2d8a15fd13a Mon Sep 17 00:00:00 2001 From: "Guillaume J. Charmes" Date: Fri, 19 Apr 2013 12:12:30 -0700 Subject: [PATCH] Allow to kill container after docker server restarts --- container.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/container.go b/container.go index 91c5806ecb..1f60e08a9d 100644 --- a/container.go +++ b/container.go @@ -614,7 +614,7 @@ func (container *Container) monitor() { } func (container *Container) kill() error { - if !container.State.Running || container.cmd == nil { + if !container.State.Running { return nil } @@ -626,6 +626,9 @@ func (container *Container) kill() error { // 2. Wait for the process to die, in last resort, try to kill the process directly if err := container.WaitTimeout(10 * time.Second); err != nil { + if container.cmd == nil { + return fmt.Errorf("lxc-kill failed, impossible to kill the container %s", container.Id) + } log.Printf("Container %s failed to exit within 10 seconds of lxc SIGKILL - trying direct SIGKILL", container.Id) if err := container.cmd.Process.Kill(); err != nil { return err