From a3d13fb286c39a2d9195b70e4265e5ac0deb6fd3 Mon Sep 17 00:00:00 2001 From: Valentin Rothberg Date: Wed, 20 Nov 2019 14:10:48 +0100 Subject: podman {pod,} rm/stop: add --ignore flag Add an --ignore flag to podman rm and stop. When specified, Podman will ignore "no such {container,pod}" errors that occur when a specified container/pod is not present in the store (anymore). The motivation behind adding this flag is to write more robust systemd services using Podman. A user might have manually decided to remove a container/pod which would lead to a failure during the `ExecStop` directive of a systemd service referencing that container/pod. Signed-off-by: Valentin Rothberg --- cmd/podman/pod_rm.go | 2 ++ 1 file changed, 2 insertions(+) (limited to 'cmd/podman/pod_rm.go') diff --git a/cmd/podman/pod_rm.go b/cmd/podman/pod_rm.go index 86d6d2f27..fcf1d5bc7 100644 --- a/cmd/podman/pod_rm.go +++ b/cmd/podman/pod_rm.go @@ -41,7 +41,9 @@ func init() { flags := podRmCommand.Flags() flags.BoolVarP(&podRmCommand.All, "all", "a", false, "Remove all running pods") flags.BoolVarP(&podRmCommand.Force, "force", "f", false, "Force removal of a running pod by first stopping all containers, then removing all containers in the pod. The default is false") + flags.BoolVarP(&podRmCommand.Ignore, "ignore", "i", false, "Ignore errors when a specified pod is missing") flags.BoolVarP(&podRmCommand.Latest, "latest", "l", false, "Remove the latest pod podman is aware of") + markFlagHiddenForRemoteClient("ignore", flags) markFlagHiddenForRemoteClient("latest", flags) } -- cgit v1.2.3-54-g00ecf