Remove containers

Use the podman rm command to remove containers. You can specify containers with the container ID or name.

Before you begin

  • The container-tools meta-package is installed.
  • At least one container has been stopped.

Procedure

  1. 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    false
  2. Remove the containers:
    • To remove the peaceful_hopper container:
      $ podman rm peaceful_hopper

      Notice that the peaceful_hopper container was in Exited status, which means it was stopped and it can be removed immediately.

    • To remove the musing_brown container, first stop the container and then remove it:
      $ podman stop musing_brown
      $ podman rm musing_brown
    • To remove multiple containers:
      $ podman rm clever_yonath furious_shockley
    • To remove all containers from your local system:
      $ podman rm -a

Results

  • List all images by using the podman ps -a command to verify that containers were removed.