Closes #4575
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
| ... | ... |
@@ -160,22 +160,16 @@ func (runtime *Runtime) Register(container *Container) error {
|
| 160 | 160 |
if container.State.IsGhost() {
|
| 161 | 161 |
utils.Debugf("killing ghost %s", container.ID)
|
| 162 | 162 |
|
| 163 |
- existingPid := container.State.Pid |
|
| 164 | 163 |
container.State.SetGhost(false) |
| 165 | 164 |
container.State.SetStopped(0) |
| 166 | 165 |
|
| 166 |
+ // We only have to handle this for lxc because the other drivers will ensure that |
|
| 167 |
+ // no ghost processes are left when docker dies |
|
| 167 | 168 |
if container.ExecDriver == "" || strings.Contains(container.ExecDriver, "lxc") {
|
| 168 | 169 |
lxc.KillLxc(container.ID, 9) |
| 169 |
- } else {
|
|
| 170 |
- command := &execdriver.Command{
|
|
| 171 |
- ID: container.ID, |
|
| 170 |
+ if err := container.Unmount(); err != nil {
|
|
| 171 |
+ utils.Debugf("ghost unmount error %s", err)
|
|
| 172 | 172 |
} |
| 173 |
- command.Process = &os.Process{Pid: existingPid}
|
|
| 174 |
- runtime.execDriver.Kill(command, 9) |
|
| 175 |
- } |
|
| 176 |
- // ensure that the filesystem is also unmounted |
|
| 177 |
- if err := container.Unmount(); err != nil {
|
|
| 178 |
- utils.Debugf("ghost unmount error %s", err)
|
|
| 179 | 173 |
} |
| 180 | 174 |
} |
| 181 | 175 |
|