mirror of
https://github.com/containers/podman.git
synced 2025-08-02 17:22:30 +08:00
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
This commit is contained in:

committed by
Atomic Bot

parent
c5753f57c1
commit
8b5823a62d
@ -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 {
|
||||
|
Reference in New Issue
Block a user