Follow-up to bb19d064, prune *all* unused images

From the documentation:

> 'podman image prune' removes all dangling images from local storage.
> With the all option, all unused images are deleted (i.e., images not
> in use by any container).
>
> The image prune command does not prune cache images that only use
> layers that are necessary for other images.

So, when the container script is called in the cleanup phase of the
lifetime of a container, we can use the '--all' option to ensure we also
remove this container's loaded image.  In the case this happens before
a reboot of the system, there will be no old version of the image loaded
to /var/lib/containers after boot.

Issue #1098

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg
2025-09-01 11:05:35 +02:00
parent da3bf57515
commit 477f7aed72
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -303,7 +303,7 @@ delete()
podman rm -vif "$name" >/dev/null 2>&1
[ -n "$quiet" ] || log "Container $name has been removed."
cnt=$(podman image prune -f | wc -l)
cnt=$(podman image prune -af | wc -l)
log "Pruned $cnt image(s)"
}
+1 -1
View File
@@ -13,7 +13,7 @@ All notable changes to the project are documented in this file.
- Add support for [Raspberry Pi touch display][RPI-TOUCH] on Raspberry Pi 4
### Fixes
- containers: prune dangling images to reclaim disk space (#1098)
- Fix #1098: Prune dangling container images to reclaim disk space
[RPI-TOUCH]: https://www.raspberrypi.com/products/raspberry-pi-touch-display/