Skip to content

Commit bb19d06

Browse files
committed
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 <[email protected]>
1 parent fa7c743 commit bb19d06

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

board/common/rootfs/usr/sbin/container

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,9 @@ delete()
302302
log "$name: calling podman rm -vif ..."
303303
podman rm -vif "$name" >/dev/null 2>&1
304304
[ -n "$quiet" ] || log "Container $name has been removed."
305+
306+
cnt=$(podman image prune -f | wc -l)
307+
log "Pruned $cnt image(s)"
305308
}
306309

307310
waitfor()
@@ -757,6 +760,8 @@ case $cmd in
757760
done
758761

759762
rm -f "$pidfile"
763+
cnt=$(podman image prune -f | wc -l)
764+
log "setup: pruned $cnt image(s)"
760765
;;
761766
shell)
762767
if [ -z "$name" ]; then

doc/ChangeLog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ All notable changes to the project are documented in this file.
1414

1515

1616
### Fixes
17+
- containers: prune dangling images to reclaim disk space (#1098)
18+
1719
[v25.06.0][] - 2025-07-01
1820
-------------------------
1921

0 commit comments

Comments
 (0)