Skip to content

Instantly share code, notes, and snippets.

@stephankoelle
Created November 7, 2025 11:00
Show Gist options
  • Select an option

  • Save stephankoelle/d6cb7d41ccb9a3f730b5a6761f389587 to your computer and use it in GitHub Desktop.

Select an option

Save stephankoelle/d6cb7d41ccb9a3f730b5a6761f389587 to your computer and use it in GitHub Desktop.
Auto cleanup podman images

Use filters to avoid surprises, e.g. keep images used in last 7 days:

podman image prune -a -f --filter "until=168h"

Use podman’s auto-prune via events (Podman 4.4+)

  • Podman supports automatic prune on certain events via containers.conf.
  • Rootless: edit ~/.config/containers/containers.conf
  • Rootful: edit /etc/containers/containers.conf
[engine]
prune_images = true
prune_images_interval = "24h"
prune_images_max_age = "168h"   # 7 days; remove images unused for this long
prune_images_keep = 10          # keep at least N most-recently used
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment