5.15. Removing containers
Use the podman rm command to remove containers. You can specify containers with the container ID or name.
Prerequisites
-
The
container-toolsmeta-package is installed. - At least one container has been stopped.
Procedure
List all containers, running or stopped:
$ podman ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES IS INFRA d65aecc325a4 ubi10/ubi /bin/bash 3 secs ago Exited (0) 5 secs ago peaceful_hopper false 74b1da000a11 rhel10/support-tools usr/bin/bash 2 mins ago Up About a minute musing_brown falseRemove the containers:
To remove the
peaceful_hoppercontainer:$ podman rm peaceful_hopperNotice that the
peaceful_hoppercontainer was in Exited status, which means it was stopped and it can be removed immediately.To remove the
musing_browncontainer, first stop the container and then remove it:$ podman stop musing_brown $ podman rm musing_brownTo remove multiple containers:
$ podman rm clever_yonath furious_shockleyTo remove all containers from your local system:
$ podman rm -a
Verification
-
List all images by using the
podman ps -acommand to verify that containers were removed.