| 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:
podman run -d --name rm-demo registry.access.redhat.com/ubi9/ubi-minimal sleep 3600Stop the container so podman rm can delete it:
podman stop rm-demoOn success, podman rm prints the container name and exits silently otherwise:
podman rm rm-demoSample output:
rm-demoConfirm the container record is gone:
podman ps -a --filter name=rm-demoSample output:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMESPodman 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:
podman create --name rm-a registry.access.redhat.com/ubi9/ubi-minimal sleep 3600Create a second container to remove in the same command:
podman create --name rm-b registry.access.redhat.com/ubi9/ubi-minimal sleep 3600Remove both in a single podman rm call:
podman rm rm-a rm-bSample output:
rm-b
rm-aPodman 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:
podman run -d --name rm-running registry.access.redhat.com/ubi9/ubi-minimal sleep 3600Try removing it while the main process is still running:
podman rm rm-runningSample output:
Error: cannot remove container 84974eaf6b0bfae2c1920e88880f3dc66dadd2b0138c5d74ffb73e24e2882ea1 as it is running - running or paused containers cannot be removed without force: container state improperThe exit code is 2. For a normal shutdown, stop first, then remove:
podman stop rm-runningOnce stopped, ordinary removal succeeds:
podman rm rm-runningpodman 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.
podman run -d --name rm-running registry.access.redhat.com/ubi9/ubi-minimal sleep 3600Force removal stops and deletes in one step:
podman rm -f rm-runningSample output:
rm-runningReserve -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:
podman run -d --name rm-running registry.access.redhat.com/ubi9/ubi-minimal sleep 3600Pass a two-second stop timeout together with --force:
podman rm --force --time 2 rm-runningSample 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-runningThe 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:
podman run -d --name rm-all-run registry.access.redhat.com/ubi9/ubi-minimal sleep 3600Add a second container that stays in Created state:
podman create --name rm-all-stop registry.access.redhat.com/ubi9/ubi-minimal sleep 3600List both fixtures before bulk removal:
podman ps -a --filter name=rm-allSample 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-stoppodman rm --all removes every container that is not running:
podman rm --allSample output:
399c17889eea3342964e81120bf7837ecf94c98d858dae00c0a0d3210bc8b2e1
Error: cannot remove container 6097a4bcc01445835b92ebb742e682fc8213fd0a164572e4577831a6c52f9792 as it is running - running or paused containers cannot be removed without force: container state improperRunning containers stay until you add force:
podman rm -f --allpodman 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:
podman create --name rm-filter-demo --label app=test registry.access.redhat.com/ubi9/ubi-minimal sleep 3600Remove it by name filter:
podman rm --filter name=rm-filter-demoBy exited status:
podman create --name rm-exited registry.access.redhat.com/ubi9/ubi-minimal sleep 1Start it so the short sleep command can finish:
podman start rm-exitedWait a couple of seconds for the container to exit, then prune exited records:
podman rm --filter status=exitedBy image ancestor:
podman create --name rm-ancestor registry.access.redhat.com/ubi9/ubi-minimal sleep 3600Match every container created from that image:
podman rm --filter ancestor=registry.access.redhat.com/ubi9/ubi-minimalBy named volume mount:
podman volume create rm-named-volMount the named volume on a new container:
podman create --name rm-vol --volume rm-named-vol:/data registry.access.redhat.com/ubi9/ubi-minimal sleep 3600Remove containers that use rm-named-vol:
podman rm --filter volume=rm-named-volBy network attachment:
podman network create rm-netAttach a container to the new network:
podman create --name rm-net-c --network rm-net registry.access.redhat.com/ubi9/ubi-minimal sleep 3600Delete every container connected to rm-net:
podman rm --filter network=rm-netBy label:
podman create --name rm-label --label app=test registry.access.redhat.com/ubi9/ubi-minimal sleep 3600Target the app=test label:
podman rm --filter label=app=testEach 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:
podman create --name rm-prune-1 registry.access.redhat.com/ubi9/ubi-minimal sleep 3600Add another stopped container eligible for prune:
podman create --name rm-prune-2 registry.access.redhat.com/ubi9/ubi-minimal sleep 3600Run prune without --force to see the confirmation prompt:
podman container pruneSample 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:
podman create --name rm-prune-3 registry.access.redhat.com/ubi9/ubi-minimal sleep 3600Skip the confirmation with prune --force:
podman container prune --forceHere --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:
podman create --name rm-prune-fresh registry.access.redhat.com/ubi9/ubi-minimal sleep 3600Prune stopped containers older than 24 hours:
podman container prune --filter until=24h --forceContainers 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:
podman volume create rm-named-volRun a container with both a named mount and an anonymous mount:
podman run -d --name rm-vol-demo -v rm-named-vol:/named -v /anondata registry.access.redhat.com/ubi9/ubi-minimal sleep 3600Stop and remove without --volumes:
podman stop rm-vol-demoDelete the container record but leave both volumes on disk:
podman rm rm-vol-demoBoth volumes remain:
podman volume ls | grep -E 'rm-named|be0b1016'Sample output:
local rm-named-vol
local be0b10166897906728da956ccd7b3c319baa36279669bfac6bd697fad771847cAdd --volumes when you want anonymous volumes gone:
podman run -d --name rm-anon -v /anondata registry.access.redhat.com/ubi9/ubi-minimal sleep 3600Stop the anonymous-volume demo container:
podman stop rm-anonDelete it and its anonymous volume together:
podman rm --volumes rm-anonThe anonymous volume disappears, but rm-named-vol is untouched:
podman volume ls | grep rm-namedSample 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:
podman create --name rm-dep-parent registry.access.redhat.com/ubi9/ubi-minimal sleep 3600Create a child that shares the parent's network namespace:
podman create --name rm-dep-child --network container:rm-dep-parent registry.access.redhat.com/ubi9/ubi-minimal sleep 3600Remove the parent and every container that depends on it:
podman rm --depend rm-dep-parentSample output:
e1a3095bd73a7e7189f26ad546ed24af7b4d9316b68fbc36f8d7a940c6e40a4b
rm-dep-parentVerify both records are gone:
podman ps -a --filter name=rm-depSample output:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMESWhen 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:
podman create --name rm-ignore-ok registry.access.redhat.com/ubi9/ubi-minimal sleep 3600Remove the real name and a placeholder that does not exist:
podman rm --ignore rm-ignore-ok already-goneSample output:
rm-ignore-okThe 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:
podman create --name rm-img-test registry.access.redhat.com/ubi9/ubi-minimal sleep 3600Delete only the container record:
podman rm rm-img-testThe UBI image should still be listed:
podman images --filter reference=registry.access.redhat.com/ubi9/ubi-minimalSample output:
REPOSITORY TAG IMAGE ID CREATED SIZE
registry.access.redhat.com/ubi9/ubi-minimal latest 591c6dfb4400 4 days ago 109 MBContainer 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.

