Skip to content

Commit

Permalink
Kill container on delete
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
crosbymichael committed May 17, 2016
1 parent 31d776b commit 572055d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package main
import (
"os"
"path/filepath"
"syscall"

"github.com/codegangsta/cli"
"github.com/opencontainers/runc/libcontainer"
Expand Down Expand Up @@ -35,6 +36,10 @@ status of "ubuntu01" as "destroyed" the following will delete resources held for
}
fatal(err)
}
s, err := container.Status()
if err == nil && s == libcontainer.Created {
container.Signal(syscall.SIGKILL)
}
destroy(container)
},
}

0 comments on commit 572055d

Please sign in to comment.