containers: prune dangling images

Previously, upgrading Podman containers with the same tag left
behind dangling images, causing overlay storage to grow and fill
disk space.

This change ensures dangling images are cleaned up using
podman image prune. The command is run without -a, so only
unreferenced images are removed. This provides safe cleanup while
preventing unnecessary overlay growth.

Fixes #1098

Signed-off-by: Richard Alpe <richard@bit42.se>
This commit is contained in:
Richard Alpe
2025-08-19 12:57:35 +02:00
parent fa7c743843
commit bb19d064d5
2 changed files with 7 additions and 0 deletions
+5
View File
@@ -302,6 +302,9 @@ delete()
log "$name: calling podman rm -vif ..."
podman rm -vif "$name" >/dev/null 2>&1
[ -n "$quiet" ] || log "Container $name has been removed."
cnt=$(podman image prune -f | wc -l)
log "Pruned $cnt image(s)"
}
waitfor()
@@ -757,6 +760,8 @@ case $cmd in
done
rm -f "$pidfile"
cnt=$(podman image prune -f | wc -l)
log "setup: pruned $cnt image(s)"
;;
shell)
if [ -z "$name" ]; then
+2
View File
@@ -14,6 +14,8 @@ All notable changes to the project are documented in this file.
### Fixes
- containers: prune dangling images to reclaim disk space (#1098)
[v25.06.0][] - 2025-07-01
-------------------------