Remove Podman Containers with `podman rm` and Prune

Tested on Red Hat Enterprise Linux 10.2 (Coughlan)
Package podman-5.8.2-5.el10_2.x86_64
Applies to Any Linux host with Podman installed
Privilege Rootful examples on the lab host; flags behave the same rootless unless noted
Scope Removing container objects with podman rm and podman container prune — single and multiple names, force removal, --all, filters, anonymous volumes, --depend, --ignore, and routing to image or system cleanup. Does not cover podman rmi, volume prune, podman system prune, or podman system reset.
Related guides Install Podman on RHEL

podman rm deletes container objects from local storage. It does not remove the image that created the container — that is podman rmi territory. This page walks through single removal, bulk cleanup, filters, prune, and the flags that keep scripts from failing on containers that are already gone.


Remove a stopped Podman container

Create a container, stop it, then remove it by name:

bash
podman run -d --name rm-demo registry.access.redhat.com/ubi9/ubi-minimal sleep 3600

Stop the container so podman rm can delete it:

bash
podman stop rm-demo

On success, podman rm prints the container name and exits silently otherwise:

bash
podman rm rm-demo

Sample output:

output
rm-demo

Confirm the container record is gone:

bash
podman ps -a --filter name=rm-demo

Sample output:

output
CONTAINER ID  IMAGE       COMMAND     CREATED     STATUS      PORTS       NAMES

Podman accepts either the container name or the full ID. Removing the container only deletes that container's writable layer and metadata — the underlying image stays on disk for the next podman run.


Remove multiple containers

When you know exactly which containers to delete, pass multiple names in one command instead of looping in the shell:

bash
podman create --name rm-a registry.access.redhat.com/ubi9/ubi-minimal sleep 3600

Create a second container to remove in the same command:

bash
podman create --name rm-b registry.access.redhat.com/ubi9/ubi-minimal sleep 3600

Remove both in a single podman rm call:

bash
podman rm rm-a rm-b

Sample output:

output
rm-b
rm-a

Podman prints one line per removed container. You can mix names and IDs the same way.


Remove a running container

podman rm refuses running and paused containers unless you force removal. Reproduce the error on a live container:

bash
podman run -d --name rm-running registry.access.redhat.com/ubi9/ubi-minimal sleep 3600

Try removing it while the main process is still running:

bash
podman rm rm-running

Sample output:

output
Error: cannot remove container 84974eaf6b0bfae2c1920e88880f3dc66dadd2b0138c5d74ffb73e24e2882ea1 as it is running - running or paused containers cannot be removed without force: container state improper

The exit code is 2. For a normal shutdown, stop first, then remove:

bash
podman stop rm-running

Once stopped, ordinary removal succeeds:

bash
podman rm rm-running

podman rm -f combines stopping and removal in one command. Podman still gives the container its stop timeout before resorting to SIGKILL; use --time to change that wait, or --time 0 when immediate forced termination is intentional.

bash
podman run -d --name rm-running registry.access.redhat.com/ubi9/ubi-minimal sleep 3600

Force removal stops and deletes in one step:

bash
podman rm -f rm-running

Sample output:

output
rm-running

Reserve -f for workflows that combine stop and delete in one step. Use podman stop followed by podman rm when you want those as separate lifecycle steps, and podman rm -f --time 0 only when you intentionally want no wait.


Set the force-removal timeout

On Podman 5.8.2, --time only works together with --force. It controls how long Podman waits during the forced stop before sending SIGKILL:

bash
podman run -d --name rm-running registry.access.redhat.com/ubi9/ubi-minimal sleep 3600

Pass a two-second stop timeout together with --force:

bash
podman rm --force --time 2 rm-running

Sample output:

output
time="2026-08-22T21:38:56+05:30" level=warning msg="StopSignal SIGTERM failed to stop container rm-running in 2 seconds, resorting to SIGKILL"
rm-running

The default stop window is 10 seconds. --time 0 skips the wait and moves to immediate kill behavior. Without --force, Podman rejects --time outright.


Remove all Podman containers

List what is on disk before a bulk delete:

bash
podman run -d --name rm-all-run registry.access.redhat.com/ubi9/ubi-minimal sleep 3600

Add a second container that stays in Created state:

bash
podman create --name rm-all-stop registry.access.redhat.com/ubi9/ubi-minimal sleep 3600

List both fixtures before bulk removal:

bash
podman ps -a --filter name=rm-all

Sample output:

output
CONTAINER ID  IMAGE                                               COMMAND     CREATED        STATUS       PORTS       NAMES
6097a4bcc014  registry.access.redhat.com/ubi9/ubi-minimal:latest  sleep 3600  1 second ago   Up 1 second              rm-all-run
399c17889eea  registry.access.redhat.com/ubi9/ubi-minimal:latest  sleep 3600  1 second ago   Created                  rm-all-stop

podman rm --all removes every container that is not running:

bash
podman rm --all

Sample output:

output
399c17889eea3342964e81120bf7837ecf94c98d858dae00c0a0d3210bc8b2e1
Error: cannot remove container 6097a4bcc01445835b92ebb742e682fc8213fd0a164572e4577831a6c52f9792 as it is running - running or paused containers cannot be removed without force: container state improper

Running containers stay until you add force:

bash
podman rm -f --all

podman rm -f -a removes all containers visible to the current Podman user and storage context. Rootful and rootless Podman keep separate state — removing everything as your login user does not touch another user's containers. This is not podman system reset, which wipes far more than container records.


Remove containers with filters

podman rm --filter selects containers by metadata instead of typing every name. Create a few fixtures, then remove them one filter at a time.

By name:

bash
podman create --name rm-filter-demo --label app=test registry.access.redhat.com/ubi9/ubi-minimal sleep 3600

Remove it by name filter:

bash
podman rm --filter name=rm-filter-demo

By exited status:

bash
podman create --name rm-exited registry.access.redhat.com/ubi9/ubi-minimal sleep 1

Start it so the short sleep command can finish:

bash
podman start rm-exited

Wait a couple of seconds for the container to exit, then prune exited records:

bash
podman rm --filter status=exited

By image ancestor:

bash
podman create --name rm-ancestor registry.access.redhat.com/ubi9/ubi-minimal sleep 3600

Match every container created from that image:

bash
podman rm --filter ancestor=registry.access.redhat.com/ubi9/ubi-minimal

By named volume mount:

bash
podman volume create rm-named-vol

Mount the named volume on a new container:

bash
podman create --name rm-vol --volume rm-named-vol:/data registry.access.redhat.com/ubi9/ubi-minimal sleep 3600

Remove containers that use rm-named-vol:

bash
podman rm --filter volume=rm-named-vol

By network attachment:

bash
podman network create rm-net

Attach a container to the new network:

bash
podman create --name rm-net-c --network rm-net registry.access.redhat.com/ubi9/ubi-minimal sleep 3600

Delete every container connected to rm-net:

bash
podman rm --filter network=rm-net

By label:

bash
podman create --name rm-label --label app=test registry.access.redhat.com/ubi9/ubi-minimal sleep 3600

Target the app=test label:

bash
podman rm --filter label=app=test

Each successful match prints the removed container ID. Filters stack the same way as list containers with podman ps — use the ones that match your cleanup task rather than memorizing the full man-page list.


Remove stopped containers with podman container prune

When you only need to clear stopped containers, podman container prune is faster than naming each one:

bash
podman create --name rm-prune-1 registry.access.redhat.com/ubi9/ubi-minimal sleep 3600

Add another stopped container eligible for prune:

bash
podman create --name rm-prune-2 registry.access.redhat.com/ubi9/ubi-minimal sleep 3600

Run prune without --force to see the confirmation prompt:

bash
podman container prune

Sample output:

output
WARNING! This will remove all non running containers.
Are you sure you want to continue? [y/N]

Answer y to confirm. Podman prints one ID per deleted container.

For automation, create another stopped container and skip the prompt:

bash
podman create --name rm-prune-3 registry.access.redhat.com/ubi9/ubi-minimal sleep 3600

Skip the confirmation with prune --force:

bash
podman container prune --force

Here --force only suppresses confirmation. It does not force-delete running containers the way podman rm -f does.


Prune containers older than a certain time

podman container prune supports a smaller filter set than podman rm. The until filter is useful for age-based cleanup:

bash
podman create --name rm-prune-fresh registry.access.redhat.com/ubi9/ubi-minimal sleep 3600

Prune stopped containers older than 24 hours:

bash
podman container prune --filter until=24h --force

Containers created within the last 24 hours are kept; older stopped containers are removed. Label filters work on prune as well, but name, network, and volume filters belong on podman rm --filter, not prune.


What happens to container volumes when you remove a container?

Plain podman rm does not mean "delete all storage attached to this container." Named volumes and anonymous volumes both stay on disk unless you opt in.

Create a container with one named volume and one anonymous mount:

bash
podman volume create rm-named-vol

Run a container with both a named mount and an anonymous mount:

bash
podman run -d --name rm-vol-demo -v rm-named-vol:/named -v /anondata registry.access.redhat.com/ubi9/ubi-minimal sleep 3600

Stop and remove without --volumes:

bash
podman stop rm-vol-demo

Delete the container record but leave both volumes on disk:

bash
podman rm rm-vol-demo

Both volumes remain:

bash
podman volume ls | grep -E 'rm-named|be0b1016'

Sample output:

output
local       rm-named-vol
local       be0b10166897906728da956ccd7b3c319baa36279669bfac6bd697fad771847c

Add --volumes when you want anonymous volumes gone:

bash
podman run -d --name rm-anon -v /anondata registry.access.redhat.com/ubi9/ubi-minimal sleep 3600

Stop the anonymous-volume demo container:

bash
podman stop rm-anon

Delete it and its anonymous volume together:

bash
podman rm --volumes rm-anon

The anonymous volume disappears, but rm-named-vol is untouched:

bash
podman volume ls | grep rm-named

Sample output:

output
local       rm-named-vol

--volumes targets anonymous volumes Podman created for that container. Named volumes you created explicitly survive removal.


Difference between podman rm, --rm, and container prune

Method Purpose
podman rm Remove selected existing containers
podman rm -f Force removal, including running or paused containers
podman rm -a Remove all non-running containers; running ones need -f
podman run --rm Automatically remove the container when its main process exits
podman container prune Remove stopped containers in bulk
podman rm --volumes Also remove anonymous volumes tied to the container

podman run --rm is a create-time flag covered in Run containers with podman run. podman rm and podman container prune operate on containers that already exist.


Remove dependent containers with --depend

Some containers depend on another container's network namespace or storage. Removing the parent without --depend can leave dependents behind or block removal while they are running.

Create a parent and a child that shares the parent's network namespace:

bash
podman create --name rm-dep-parent registry.access.redhat.com/ubi9/ubi-minimal sleep 3600

Create a child that shares the parent's network namespace:

bash
podman create --name rm-dep-child --network container:rm-dep-parent registry.access.redhat.com/ubi9/ubi-minimal sleep 3600

Remove the parent and every container that depends on it:

bash
podman rm --depend rm-dep-parent

Sample output:

output
e1a3095bd73a7e7189f26ad546ed24af7b4d9316b68fbc36f8d7a940c6e40a4b
rm-dep-parent

Verify both records are gone:

bash
podman ps -a --filter name=rm-dep

Sample output:

output
CONTAINER ID  IMAGE       COMMAND     CREATED     STATUS      PORTS       NAMES

When dependents are still running, stop them first or combine --depend with --force.


Ignore missing containers with --ignore

Scripts and systemd cleanup units should not fail when a container was already removed. --ignore skips names that are not found:

bash
podman create --name rm-ignore-ok registry.access.redhat.com/ubi9/ubi-minimal sleep 3600

Remove the real name and a placeholder that does not exist:

bash
podman rm --ignore rm-ignore-ok already-gone

Sample output:

output
rm-ignore-ok

The command exits 0 even though already-gone never existed. Without --ignore, a missing name makes the whole command fail.


Fix container removal errors

Symptom Likely cause Fix
running or paused containers cannot be removed without force Container is still active podman stop CONTAINER then podman rm, or podman rm -f CONTAINER
container is paused Container is paused, not stopped podman unpause and podman stop, or podman rm -f
Parent container cannot be removed while dependent exists Another container shares its network or storage Remove dependents first, or podman rm --depend PARENT
no container with ID or name found Typo or container already deleted Fix the name, or add --ignore in idempotent scripts
podman rm --all leaves running containers --all skips running workloads by default Stop them, or podman rm -f --all
Anonymous volume disk usage after podman rm Default removal keeps anonymous volumes Re-run with --volumes, or prune volumes separately

For containers in a broken runtime state, podman rm -f can still delete the storage record when ordinary stop paths fail. That is a removal escape hatch, not a full storage-corruption recovery guide.


podman rm does not remove images

After you delete a container, list images to confirm the base layer is still present:

bash
podman create --name rm-img-test registry.access.redhat.com/ubi9/ubi-minimal sleep 3600

Delete only the container record:

bash
podman rm rm-img-test

The UBI image should still be listed:

bash
podman images --filter reference=registry.access.redhat.com/ubi9/ubi-minimal

Sample output:

output
REPOSITORY                                   TAG         IMAGE ID      CREATED     SIZE
registry.access.redhat.com/ubi9/ubi-minimal  latest      591c6dfb4400  4 days ago  109 MB

Container removal maps to podman rm. Image removal maps to podman rmi. See Manage images with podman images when you are ready to trim the image store.


Container cleanup vs system cleanup

Goal Command or article
Remove one or more containers podman rm
Remove stopped containers in bulk podman container prune
Remove unused volumes podman volume prune
Inspect overall disk usage podman system df
Broad unused-object cleanup podman system prune
Completely reset Podman storage podman system reset

Stay on podman rm and podman container prune when the task is specifically container objects. Reach for system-level commands only when you intend to clean images, networks, and volumes together.


References

Summary

podman rm deletes container records from local storage while leaving images intact. You practiced the straightforward path on stopped containers, batch removal by name, and the running-container error that -f or a prior podman stop resolves. Filters on podman rm target real cleanup jobs — exited status, labels, volumes, networks — without typing every container ID.

podman container prune is the bulk answer for stopped containers, with a different --force meaning than podman rm -f. Anonymous volumes survive plain removal; --volumes removes only the anonymous ones, not named volumes you created on purpose. --depend and --ignore cover dependency chains and idempotent scripts that competitors often skip.

When disk usage is still high after container cleanup, the image store or named volumes are the next place to look — not another podman rm -a. List containers with podman ps helps you verify what remains before you prune or move on to image cleanup.


Frequently Asked Questions

1. Does podman rm delete the image?

No. podman rm removes the container record and its writable layer from local storage. The image the container was created from remains until you remove it with podman rmi or a separate image cleanup command.

2. What is the difference between podman rm -f and podman container prune --force?

podman rm -f forces removal of a running or paused container by stopping it first. podman container prune --force skips the confirmation prompt when deleting stopped containers in bulk. The two -f flags solve different problems and are not interchangeable.

3. How do I remove all stopped Podman containers?

Run podman container prune and confirm the prompt, or pass --force to skip confirmation. podman rm --all removes every non-running container Podman can delete in one step, but running containers block ordinary removal until you stop them or use podman rm -f --all.

4. Does podman rm remove volumes?

Not by default. Plain podman rm leaves named volumes and anonymous volumes on disk. Add --volumes to remove anonymous volumes that were created for that container. Named volumes you created with podman volume create are never removed by podman rm alone.

5. Can I remove a running Podman container without stopping it first?

Yes, with podman rm -f or podman rm --force. Podman stops and removes the container in one operation, waiting for the stop timeout before forcing termination if necessary. Use podman stop followed by podman rm when you want shutdown and deletion as separate, explicit lifecycle steps; use podman rm -f --time 0 only when you intentionally want no wait.
Deepak Prasad

R&D Engineer

Founder of GoLinuxCloud with more than 15 years of expertise in Linux, Python, Go, Laravel, DevOps, Kubernetes, Git, Shell scripting, OpenShift, AWS, Networking, and Security. With extensive experience, he excels across development, DevOps, networking, and security, delivering robust and efficient solutions for diverse projects.

  • Go (programming language)
  • Python (programming language)
  • DevOps
  • Computer Security
  • Cloud Computing
  • Kubernetes
  • Linux
  • Ansible (software)