4.12. Removing images
Use the podman rmi command to remove locally stored container images. You can remove an image by its ID or name.
Prerequisites
-
The
container-toolsmeta-package is installed.
Procedure
List all images on your local system:
$ podman images REPOSITORY TAG IMAGE ID CREATED SIZE registry.redhat.io/rhel10/support-tools latest 4b32d14201de 7 weeks ago 228 MB registry.redhat.io/ubi10/ubi latest 3269c37eae33 7 weeks ago 208 MB localhost/myubi X.Y 3269c37eae33 7 weeks ago 208 MBList all containers:
$ podman ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 7ccd6001166e registry.redhat.io/rhel10/support-tools:latest usr/bin/bash 6 seconds ago Up 5 seconds ago my-support-toolsTo remove the
registry.redhat.io/rhel10/support-toolsimage, you have to stop all containers running from this image by using thepodman stopcommand. You can stop a container by its ID or name.Stop the
my-support-toolscontainer:$ podman stop my-support-tools 7ccd6001166e9720c47fbeb077e0afd0bb635e74a1b0ede3fd34d09eaf5a52e9Remove the
registry.redhat.io/rhel10/support-toolsimage:$ podman rmi registry.redhat.io/rhel10/support-toolsTo remove multiple images:
$ podman rmi registry.redhat.io/rhel10/support-tools registry.redhat.io/ubi10/ubiTo remove all images from your system:
$ podman rmi -aTo remove images that have multiple names (tags) associated with them, add the
-foption to remove them:$ podman rmi -f 1de7d7b3f531 1de7d7b3f531...
Verification
-
List all images by using the
podman imagescommand to verify that container images were removed.