summaryrefslogtreecommitdiff
path: root/pkg/domain/infra/abi/containers.go
diff options
context:
space:
mode:
authorAditya Rajan <arajan@redhat.com>2021-09-27 15:17:38 +0530
committerMatthew Heon <matthew.heon@pm.me>2021-09-29 16:39:29 -0400
commitb3af5a92cc710724471285fe3aa06205323a3c24 (patch)
tree35668ad80a77188089209c5f515e3c1750738c5a /pkg/domain/infra/abi/containers.go
parent7bfc5250d82e540757e205b81d8d68d79875ee2d (diff)
downloadpodman-b3af5a92cc710724471285fe3aa06205323a3c24.tar.gz
podman-b3af5a92cc710724471285fe3aa06205323a3c24.tar.bz2
podman-b3af5a92cc710724471285fe3aa06205323a3c24.zip
stop: Do nothing if container was never created in runtime
Following commit ensures we silently return container id on `stop` if container was never created in OCI runtime. Following behaviour ensures that we are in parity with docker. Signed-off-by: Aditya Rajan <arajan@redhat.com>
Diffstat (limited to 'pkg/domain/infra/abi/containers.go')
-rw-r--r--pkg/domain/infra/abi/containers.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/pkg/domain/infra/abi/containers.go b/pkg/domain/infra/abi/containers.go
index affed64d1..774362d03 100644
--- a/pkg/domain/infra/abi/containers.go
+++ b/pkg/domain/infra/abi/containers.go
@@ -169,6 +169,10 @@ func (ic *ContainerEngine) ContainerStop(ctx context.Context, namesOrIds []strin
logrus.Debugf("Container %s is already stopped", c.ID())
case options.All && errors.Cause(err) == define.ErrCtrStateInvalid:
logrus.Debugf("Container %s is not running, could not stop", c.ID())
+ // container never created in OCI runtime
+ // docker parity: do nothing just return container id
+ case errors.Cause(err) == define.ErrCtrStateInvalid:
+ logrus.Debugf("Container %s is either not created on runtime or is in a invalid state", c.ID())
default:
return err
}