From 55a38b6b749aa724a2bd308b2da013e8b04096f5 Mon Sep 17 00:00:00 2001 From: Gmer4Lfe Date: Sun, 31 May 2026 14:59:57 -0400 Subject: [PATCH] fix: prune dangling images after docker_update.sh pulls MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- Docker_Essentials/docker_update.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Docker_Essentials/docker_update.sh b/Docker_Essentials/docker_update.sh index 5ce550e..fa70047 100644 --- a/Docker_Essentials/docker_update.sh +++ b/Docker_Essentials/docker_update.sh @@ -311,6 +311,18 @@ for container in "${TARGET_CONTAINERS[@]}"; do 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) # ============================================================================================== @@ -330,6 +342,7 @@ fi [[ ${#UP_TO_DATE[@]} -gt 0 ]] && log "$ICON_RUNNING Up to date: ${#UP_TO_DATE[@]}" [[ ${#SKIPPED[@]} -gt 0 ]] && log "$ICON_WARN Skipped: ${#SKIPPED[@]}" [[ ${#FAILED[@]} -gt 0 ]] && echo "$ICON_ERROR Failed: ${FAILED[*]}" +echo "$ICON_SYNC Pruned: ${PRUNED_SUMMARY:-none}" if [[ "$DRY_RUN" == true ]]; then warn "DRY RUN — no images pulled"