Unused images only (prune -a = not referenced by any container); volumes and containers NEVER touched. Wired into the daily 09:00 automation. Details: https://projects.knownelement.com/issues/759#note-1
24 lines
932 B
Bash
24 lines
932 B
Bash
#!/usr/bin/env bash
|
|
# perf/image-prune.sh — reclaim docker image slop on the Cloudron host.
|
|
# Removes UNUSED images only (not referenced by ANY container, running or
|
|
# stopped). NEVER touches volumes (app data!) or containers. Cloudron
|
|
# re-pulls an image if an app ever needs it again (costs a pull, no data
|
|
# loss). Founder-directed daily task 2026-09-03 [#758]. First run
|
|
# reclaimed 28.36GB.
|
|
#
|
|
# Run (from a checkout):
|
|
# VM_IP=my.knownelement.com VM_USER=root timeout 300 bash tests/remote.sh vm-file perf/image-prune.sh
|
|
|
|
set -u
|
|
|
|
echo "== before =="
|
|
docker system df | grep -E "Images|Local Volumes"
|
|
df -h / | awk 'NR==2 { printf "root fs: %s used of %s (%s used)\n", $3, $2, $5 }'
|
|
|
|
echo "== prune (unused images only; volumes/containers NEVER) =="
|
|
docker image prune -af
|
|
|
|
echo "== after =="
|
|
docker system df | grep -E "Images|Local Volumes"
|
|
df -h / | awk 'NR==2 { printf "root fs: %s used of %s (%s used)\n", $3, $2, $5 }'
|