mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Don't kill by pid for other drivers
Closes #4575 Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
This commit is contained in:
parent
28994f86ee
commit
3fa99b35b0
1 changed files with 4 additions and 10 deletions
|
@ -160,24 +160,18 @@ func (runtime *Runtime) Register(container *Container) error {
|
||||||
if container.State.IsGhost() {
|
if container.State.IsGhost() {
|
||||||
utils.Debugf("killing ghost %s", container.ID)
|
utils.Debugf("killing ghost %s", container.ID)
|
||||||
|
|
||||||
existingPid := container.State.Pid
|
|
||||||
container.State.SetGhost(false)
|
container.State.SetGhost(false)
|
||||||
container.State.SetStopped(0)
|
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") {
|
if container.ExecDriver == "" || strings.Contains(container.ExecDriver, "lxc") {
|
||||||
lxc.KillLxc(container.ID, 9)
|
lxc.KillLxc(container.ID, 9)
|
||||||
} else {
|
|
||||||
command := &execdriver.Command{
|
|
||||||
ID: container.ID,
|
|
||||||
}
|
|
||||||
command.Process = &os.Process{Pid: existingPid}
|
|
||||||
runtime.execDriver.Kill(command, 9)
|
|
||||||
}
|
|
||||||
// ensure that the filesystem is also unmounted
|
|
||||||
if err := container.Unmount(); err != nil {
|
if err := container.Unmount(); err != nil {
|
||||||
utils.Debugf("ghost unmount error %s", err)
|
utils.Debugf("ghost unmount error %s", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
info := runtime.execDriver.Info(container.ID)
|
info := runtime.execDriver.Info(container.ID)
|
||||||
if !info.IsRunning() {
|
if !info.IsRunning() {
|
||||||
|
|
Loading…
Add table
Reference in a new issue