podman-rm(1)
π podman-rm(1) π β General Commands Manual
okay bestie, this is the podman-rm(1) page from the General Commands Manual, and it's all about yeeting containers. not images. containers. π
π NAME π
podman-rm β Remove one or more containers
β¨ SYNOPSIS β¨
podman rm [options] container
podman container rm [options] container
πΈ DESCRIPTION πΈ
Okay so podman rm removes one or more containers from the host. You can use the container name or ID. It does not remove images. And running or unusable containers are not removed without the -f option β no cap, they stay put. π«Ά
π₯ OPTIONS π₯
π --all, -a π
Remove all containers. It can be used with -f too.
π§ --cidfile=file π§
Read the container ID from the specified file and rm the container. Can be specified multiple times.
The command does not fail when the file is missing and you specified --ignore.
π¦ --depend π¦
Remove the selected container and recursively remove all containers that depend on it.
π --filter, -f=filter π
Filter what containers rm acts on. Multiple filters can be given by using the --filter flag multiple times. Filters with the same key work inclusive, with the only exception being label, which is exclusive. Filters with different keys always work exclusive.
The valid filters are listed below:
idβ[ID]Container's ID (CIDprefix match by default; accepts regex)nameβ[Name]Container's name (accepts regex)annotationβ[Key]or[Key=Value]Annotation assigned to a containerannotation!β[Key]or[Key=Value]Annotation NOT assigned to a containerlabelβ[Key]or[Key=Value]Label assigned to a containerlabel!β[Key]or[Key=Value]Label NOT assigned to a containerexitedβ[Int]Container's exit codestatusβ[Status]Container's status:'created','initialized','running','stopped','paused','exited','removing','stopping','unknown'ancestorβ[ImageName]Image or descendant used to create container (accepts regex)beforeβ[ID]or[Name]Containers created before this containersinceβ[ID]or[Name]Containers created since this containervolumeβ[VolumeName]or[MountpointDestination]Volume mounted in containerhealthβ[Status]healthy or unhealthypodβ[Pod]name or full or partial ID of podnetworkβ[Network]name or full ID of networkrestart-policyβ[Policy]Container's restart policy (e.g.,'no','on-failure','always','unless-stopped')untilβ[DateTime]Containers created before the given duration or time.commandβ[Command]the command the container is executing, onlyargv[0]is takenshould-start-on-bootβ[Bool]Containers that need to be restarted after system reboot. True for containers with restart policy'always', or'unless-stopped'that were not explicitly stopped by the user
π --force, -f π
Force the removal of running and paused containers. Forcing a container removal also removes containers from container storage even if the container is not known to Podman. For example, containers that are created by different container engines like Buildah. In addition, forcing can be used to remove unusable containers, e.g. containers whose OCI runtime has become unavailable.
π --ignore, -i π
Ignore errors when specified containers are not in the container store. A user might have decided to manually remove a container which leads to a failure during the ExecStop directive of a systemd service referencing that container.
Further ignore when the specified --cidfile does not exist as it may have already been removed along with the container.
π§ --latest, -l π§
Instead of providing the container name or ID, use the last created container. Note: the last started container can be from other users of Podman on the host machine. (This option is not available with the remote Podman client, including Mac and Windows (excluding WSL2) machines)
β³ --time, -t=seconds β³
Seconds to wait before forcibly stopping the container. Use -1 for infinite wait.
β οΈ The--forceoption must be specified to use the--timeoption.
π«§ --volumes, -v π«§
Remove anonymous volumes associated with the container. This does not include named volumes created with podman volume create, or the --volume option of podman run and podman create.
β¨ EXAMPLES β¨
okay bestie, this is the part where it all clicks π every one of these is copy-pasteable, no cap.
- remove a container by name β literally just hand it the name:
$ podman rm mywebserver
- remove a container and everything depending on it β
--dependsaid "you're coming with me" π :
$ podman rm --depend mywebserver
- remove a bunch of containers at once β names or IDs, mix and match, she doesn't care:
$ podman rm mywebserver myflaskserver 860a4b23
- remove containers whose IDs you read from files β one
--cidfileper container, stack 'em up π:
$ podman rm --cidfile ./cidfile-1 --cidfile /home/user/cidfile-2
- forcibly nuke a container by ID β
-fis the main character here:
$ podman rm -f 860a4b23
- force remove, but give it a grace period β
--time 2means wait 2 seconds before sendingSIGKILL, so it's got a lil moment to go quietly π:
$ podman rm --time 2 --force 860a4b23
- force remove with zero patience β
--time 0equals no waiting at all, instant, gone, bye π:
$ podman rm --time 0 --force 860a4b23
- remove literally everything, running or not β
-f -a, the scorched-earth combo π₯:
$ podman rm -f -a
- forcibly remove the last created container β okay important caveat bestie: this option is not available with the remote Podman client, including Mac and Windows (excluding WSL2) machines π«Ά:
$ podman rm -f --latest
- remove by name β using
--filter name=test-alpine, and look, it even shows you the ID it ate:
$ podman rm --filter name=test-alpine
34f997d354017a0076402c3a79245a5b8bd11b597c84385bec25ae8941fd5238
- remove by label β
--filter label=app=frontend, chef's kiss for cleaning up a whole app tier π:
$ podman rm --filter label=app=frontend
5a3694a13436168ea99490e74b489566c646d6a0db29868f57113298110d1b1c
- remove by status β
--filter status=exitedsweeps up all the ones that already clocked out π:
$ podman rm --filter status=exited
4a3332649ed8bec1e0d82e113074b9a13d45582007aeac969c005992cc480a73
f8e85f84a749b205fb602895afa6ec8a866045ff27b82f843033712c8b93a2c9
7d17e850c9b172f11a3e20bab81da6fc694c35c2dc38d84083eb57869dcaca63
47972eb04aa7c77705b597a929957d1e8a392e00b44c0a2a7f88a01f9f860d11
- remove by ancestor β
--filter ancestor=nginxfinds every container spawned from that image π¦:
$ podman rm --filter ancestor=nginx
8a7668cdec27664559a7da55ed5cda101f904441f7245e248218580656b2bae3
0d297b336bf31d141c7720a791c45dafdb8b5033deaab12f29b88e5bff6b122d
134475ac5140687d1eefff19f937dc24755f6c18e37e11d61b1084b59f1bdbe2
- remove by volume β
--filter volume=web-vol, for the containers still holding onto that volume:
$ podman rm --filter volume=web-vol
b3f4d4c6a67e2ef1e089efdc8ff3a47dba008eb0ff1e53ae60f59279cb43f9ba
- remove by network β
--filter network=web-net, same energy, network edition π:
$ podman rm --filter network=web-net
1c057cac90c0512df86197599eef5a9485afc900b1ade03c9739fa24c360bbda
- remove containers but ignore the ones that don't exist β
--ignoreis that friend who does NOT do drama π notice hownonexistent-containerjust gets skipped and the existing ones go through:
$ podman rm --ignore mycontainer1 mycontainer2 nonexistent-container
mycontainer1
mycontainer2
π Exit Status
fr fr, this is how you know what actually happened:
0β all specified containers removed π slay1β one of the specified containers did not exist, and no other failures2β one of the specified containers is paused or running125β the command fails for any other reason π
π SEE ALSO
π HISTORY
August 2017, Originally compiled by Ryan Cole rycole@redhat.com β¨mailto:rycole@redhat.comβ© β shoutout to the original author, we love an icon π«Ά
and that's the whole page bestie, you made it π this one's officially from the podman-rm(1) manual, dated August 2017 β go forth and delete responsibly (or with -f, we don't judge) β¨πΈ
π¦ where this page comes from
- arch rolling: podman 6.1.4-1 Β· Apache-2.0
- centos-stream 10: podman 7:6.1.0-2.el10 Β· Apache-2.0 AND BSD-2-Clause AND BSD-3-Clause AND ISC AND MIT AND MPL-2.0
- nixpkgs unstable: podman 6.1.4
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms