podman-container-cleanup(1)

πŸ“¦
version 6.1.4 Β· 5 versions
, in arch rolling, fedora 43, fedora 44, ubuntu resolute

πŸ’– NAME πŸ’–

podman-container-cleanup β€” bestie, this one cleans up a container's network and mountpoints ✨ (yes that's the whole job, and it eats every single time)


🌸 SYNOPSIS 🌸

podman container cleanup [options] container [container ...]

πŸŽ€ DESCRIPTION πŸŽ€

okay so real talk, podman container cleanup is the tidy-up queen πŸ‘‘. It goes through exited containers and yeets all the mountpoints and network configurations off the host. You can point at a container by its name or its ID, either one, we're flexible like that πŸ’….

🚨 IMPORTANT VIBE CHECK: the cleanup command does not remove the containers. It just does the cleanup. Also, running containers are not cleaned up. Not touching those. They're busy.

So sometimes β€” and this is the messy part β€” container mount points and network stacks can just... linger 😭 if the podman command got killed, or if the container ran in daemon mode. Rude. That's exactly the situation this command exists for.

And here's the cute lil fact: this command is automatically executed when containers are run in daemon mode by the conmon process when the container exits. So it's out here doing its job in the background, no cap, no credit, just vibes πŸ¦‹.


✨ OPTIONS ✨

  • --all, -a β€” clean up all the containers. Default is false. IMPORTANT: this OPTION does not need a container name or ID as an input argument β€” it's already got the whole roster 🫢.
  • --exec=session β€” clean up an exec session for a single container. It can only be specified if a single container is being cleaned up (so yeah, it conflicts with --all, obviously, since that's not a single anything πŸ’€). If --rm is not specified, temporary files for the exec session get cleaned up; if it is specified, the exec session is removed from the container. IMPORTANT: conflicts with --rmi β€” because the container isn't being cleaned up, the image can't be removed. Sorry bestie, that's just the rules πŸ™ˆ.
  • --latest, -l β€” instead of providing the container ID or name, just use the last created container. Default is false. IMPORTANT: this OPTION is not available with the remote Podman client, including Mac and Windows (excluding WSL2) machines 😭. This OPTION does not need a container name or ID as input argument.
  • --rm β€” after cleanup, remove the container entirely. Default is false. gone. poof. ✨
  • --rmi β€” after cleanup, remove the image entirely. Default is false. the whole fit, deleted πŸ”₯

🌈 EXAMPLES 🌈

Clean up the container "mywebserver". iconic behavior:

$ podman container cleanup mywebserver

Clean up the containers with the names "mywebserver", "myflaskserver", "860a4b23" β€” yes all three at once, multitasking queen:

$ podman container cleanup mywebserver myflaskserver 860a4b23

πŸ‘‘ SEE ALSO πŸ‘‘

podman(1), podman-container(1), conmon(8)


πŸ“œ HISTORY πŸ“œ

Jun 2018 β€” originally compiled by Dan Walsh dwalsh@redhat.com ⟨mailto:dwalsh@redhat.com⟩ πŸ’œ


and that's the whole page bestie!! this one's from the podman-container-cleanup(1) manual, mwah 😘 go forth and clean up those mountpoints, i'm obsessed with you πŸ«Άβœ¨πŸ’–

πŸ“¦ where this page comes from