summaryrefslogtreecommitdiff
path: root/libpod/oci.go
diff options
context:
space:
mode:
authorGiuseppe Scrivano <gscrivan@redhat.com>2018-08-25 18:50:59 +0200
committerAtomic Bot <atomic-devel@projectatomic.io>2018-08-26 07:22:42 +0000
commit8b5823a62d1149b59a08d652809d2d117e7b46eb (patch)
treefc73965188f63dadcfcca536b9a034663751983a /libpod/oci.go
parentc5753f57c1a929f80fb768ff62bd35f383584aed (diff)
downloadpodman-8b5823a62d1149b59a08d652809d2d117e7b46eb.tar.gz
podman-8b5823a62d1149b59a08d652809d2d117e7b46eb.tar.bz2
podman-8b5823a62d1149b59a08d652809d2d117e7b46eb.zip
rootless: don't use kill --all
The OCI runtime might use the cgroups to see what PIDs are inside the container, but that doesn't work with rootless containers. Closes: https://github.com/containers/libpod/issues/1337 Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com> Closes: #1331 Approved by: rhatdan
Diffstat (limited to 'libpod/oci.go')
-rw-r--r--libpod/oci.go12
1 files changed, 11 insertions, 1 deletions
diff --git a/libpod/oci.go b/libpod/oci.go
index 4f0fbe8e9..240f53885 100644
--- a/libpod/oci.go
+++ b/libpod/oci.go
@@ -591,7 +591,17 @@ func (r *OCIRuntime) stopContainer(ctr *Container, timeout uint) error {
}
}
- if err := utils.ExecCmdWithStdStreams(os.Stdin, os.Stdout, os.Stderr, r.path, "kill", "--all", ctr.ID(), "KILL"); err != nil {
+ var args []string
+ if rootless.IsRootless() {
+ // we don't use --all for rootless containers as the OCI runtime might use
+ // the cgroups to determine the PIDs, but for rootless containers there is
+ // not any.
+ args = []string{"kill", ctr.ID(), "KILL"}
+ } else {
+ args = []string{"kill", "--all", ctr.ID(), "KILL"}
+ }
+
+ if err := utils.ExecCmdWithStdStreams(os.Stdin, os.Stdout, os.Stderr, r.path, args...); err != nil {
// Again, check if the container is gone. If it is, exit cleanly.
err := unix.Kill(ctr.state.PID, 0)
if err == unix.ESRCH {