13.8. Automatically stopping and removing pods using Podman
The podman play kube --down command stops and removes all pods and their containers.
注記
If a volume is in use, it is not removed.
Prerequisites
-
The
container-toolsmeta-package is installed. -
The pod named
wordpresspodhas been created. For details, see section Manually running containers and pods using Podman. - The YAML file has been generated. For details, see section Generating a YAML file using Podman.
- The pod is running. For details, see section Automatically running containers and pods using Podman.
Procedure
Remove all pods and containers created by the
wordpresspod.yamlfile:$ podman play kube --down wordpresspod.yaml Pods stopped: 3e391d091d190756e655219a34de55583eed3ef59470aadd214c1fc48cae92ac Pods removed: 3e391d091d190756e655219a34de55583eed3ef59470aadd214c1fc48cae92ac
Verification
Verify that all pods and containers created by the
wordpresspod.yamlfile were removed:$ podman ps --pod -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES POD ID PODNAMERefer to
podman-play-kube(1)man page on your system for more information.