fix: prune dangling images after docker_update.sh pulls
docker_update_remaining.sh already pruned; docker_update.sh (daily) did not — orphaned images accumulated with every daily update run. Same prune pattern as docker_update_remaining.sh. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
44f33da454
commit
55a38b6b74
@@ -311,6 +311,18 @@ for container in "${TARGET_CONTAINERS[@]}"; do
|
|||||||
|
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# ── Prune dangling images ─────────────────────────────────────────────────────
|
||||||
|
# Old images become dangling after a pull lands a new digest. Prune here so
|
||||||
|
# they don't accumulate across daily runs.
|
||||||
|
if [[ "$DRY_RUN" == true ]]; then
|
||||||
|
warn "DRY RUN — would prune dangling images"
|
||||||
|
PRUNED_SUMMARY="(dry run)"
|
||||||
|
else
|
||||||
|
PRUNED_OUTPUT=$(docker image prune -f 2>&1)
|
||||||
|
[[ "$ENABLE_LOGGING" == "true" ]] && echo "$PRUNED_OUTPUT" | sed 's/^/ /'
|
||||||
|
PRUNED_SUMMARY=$(echo "$PRUNED_OUTPUT" | grep -E "^Total reclaimed" || echo "nothing reclaimed")
|
||||||
|
fi
|
||||||
|
|
||||||
END=$(date +%s)
|
END=$(date +%s)
|
||||||
|
|
||||||
# ==============================================================================================
|
# ==============================================================================================
|
||||||
@@ -330,6 +342,7 @@ fi
|
|||||||
[[ ${#UP_TO_DATE[@]} -gt 0 ]] && log "$ICON_RUNNING Up to date: ${#UP_TO_DATE[@]}"
|
[[ ${#UP_TO_DATE[@]} -gt 0 ]] && log "$ICON_RUNNING Up to date: ${#UP_TO_DATE[@]}"
|
||||||
[[ ${#SKIPPED[@]} -gt 0 ]] && log "$ICON_WARN Skipped: ${#SKIPPED[@]}"
|
[[ ${#SKIPPED[@]} -gt 0 ]] && log "$ICON_WARN Skipped: ${#SKIPPED[@]}"
|
||||||
[[ ${#FAILED[@]} -gt 0 ]] && echo "$ICON_ERROR Failed: ${FAILED[*]}"
|
[[ ${#FAILED[@]} -gt 0 ]] && echo "$ICON_ERROR Failed: ${FAILED[*]}"
|
||||||
|
echo "$ICON_SYNC Pruned: ${PRUNED_SUMMARY:-none}"
|
||||||
|
|
||||||
if [[ "$DRY_RUN" == true ]]; then
|
if [[ "$DRY_RUN" == true ]]; then
|
||||||
warn "DRY RUN — no images pulled"
|
warn "DRY RUN — no images pulled"
|
||||||
|
|||||||
Reference in New Issue
Block a user