From 3fa99b35b05d9159d6f7f4c7465dec747da2c4e1 Mon Sep 17 00:00:00 2001 From: Michael Crosby Date: Wed, 12 Mar 2014 18:04:14 -0700 Subject: [PATCH] Don't kill by pid for other drivers Closes #4575 Docker-DCO-1.1-Signed-off-by: Michael Crosby (github: crosbymichael) --- runtime/runtime.go | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/runtime/runtime.go b/runtime/runtime.go index b364d1d270..16117b9788 100644 --- a/runtime/runtime.go +++ b/runtime/runtime.go @@ -160,22 +160,16 @@ func (runtime *Runtime) Register(container *Container) error { if container.State.IsGhost() { utils.Debugf("killing ghost %s", container.ID) - existingPid := container.State.Pid container.State.SetGhost(false) container.State.SetStopped(0) + // We only have to handle this for lxc because the other drivers will ensure that + // no ghost processes are left when docker dies if container.ExecDriver == "" || strings.Contains(container.ExecDriver, "lxc") { lxc.KillLxc(container.ID, 9) - } else { - command := &execdriver.Command{ - ID: container.ID, + if err := container.Unmount(); err != nil { + utils.Debugf("ghost unmount error %s", err) } - command.Process = &os.Process{Pid: existingPid} - runtime.execDriver.Kill(command, 9) - } - // ensure that the filesystem is also unmounted - if err := container.Unmount(); err != nil { - utils.Debugf("ghost unmount error %s", err) } }