summaryrefslogtreecommitdiff
path: root/libpod/container_api.go
diff options
context:
space:
mode:
authorMatthew Heon <mheon@redhat.com>2021-10-06 09:25:24 -0400
committerMatthew Heon <mheon@redhat.com>2021-10-06 11:19:32 -0400
commite1089e89d7b8f5204ccb226934e46df736af4925 (patch)
treed9e71b0d38968d6f0487694f266ae3db9568945a /libpod/container_api.go
parent8bcc086b1b9d8aa0ef3bb08d37542adf9de26ac5 (diff)
downloadpodman-e1089e89d7b8f5204ccb226934e46df736af4925.tar.gz
podman-e1089e89d7b8f5204ccb226934e46df736af4925.tar.bz2
podman-e1089e89d7b8f5204ccb226934e46df736af4925.zip
Allow `podman stop` to be run on Stopping containers
This allows you to stop a container after a `podman stop` process started, but did not finish, stopping the container (probably an ignored stop signal, with no time to SIGKILL?). This is a very narrow case, but once you're in it the only way to recover is a `podman rm -f` of the container or extensive manual remediation (you'd have to kill the container yourself, manually, and then force a `podman ps --all --sync` to update its status from the OCI runtime). [NO NEW TESTS NEEDED] I have no idea how to verify this one - we need to test that it actually started *during* the other stop command, and that's nontrivial. Signed-off-by: Matthew Heon <mheon@redhat.com>
Diffstat (limited to 'libpod/container_api.go')
-rw-r--r--libpod/container_api.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/libpod/container_api.go b/libpod/container_api.go
index 50be0eea4..ecb307a5d 100644
--- a/libpod/container_api.go
+++ b/libpod/container_api.go
@@ -184,7 +184,7 @@ func (c *Container) StopWithTimeout(timeout uint) error {
return define.ErrCtrStopped
}
- if !c.ensureState(define.ContainerStateCreated, define.ContainerStateRunning) {
+ if !c.ensureState(define.ContainerStateCreated, define.ContainerStateRunning, define.ContainerStateStopping) {
return errors.Wrapf(define.ErrCtrStateInvalid, "can only stop created or running containers. %s is in state %s", c.ID(), c.state.State.String())
}