Kill container on delete

If the container's state is `created` when runc delete is called make
sure that the init is killed before deleting the on system state.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
Michael Crosby 2016-05-16 17:04:49 -07:00
parent 3fc929f350
commit 88dcf1d686
1 changed files with 5 additions and 0 deletions

View File

@ -5,6 +5,7 @@ package main
import (
"os"
"path/filepath"
"syscall"
"github.com/codegangsta/cli"
"github.com/opencontainers/runc/libcontainer"
@ -36,6 +37,10 @@ status of "ubuntu01" as "destroyed" the following will delete resources held for
}
return nil
}
s, err := container.Status()
if err == nil && s == libcontainer.Created {
container.Signal(syscall.SIGKILL)
}
destroy(container)
return nil
},