Skip to content

fix(down): remove dangling images left behind by local builds - #14154

Open
htoyoda18 wants to merge 1 commit into
docker:mainfrom
htoyoda18:fix/down-prune-dangling-images
Open

fix(down): remove dangling images left behind by local builds#14154
htoyoda18 wants to merge 1 commit into
docker:mainfrom
htoyoda18:fix/down-prune-dangling-images

Conversation

@htoyoda18

@htoyoda18 htoyoda18 commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

What I did

down --rmi never cleaned up dangling (untagged) images left behind by earlier local builds of the project — historically skipped because printing raw image IDs in CLI progress output is confusing on its own.

Added ImagePruner.danglingLocalImages to find them (same project-label + dangling=true query already used by watch --prune's dangling cleanup), and report their removal as a single grouped "Dangling images" operation instead of one row per image ID. Individual removal failures are tolerated (debug-logged) so a stale/in-use image doesn't abort the rest of down, matching the watch --prune precedent.

Both the query shape and the "tolerate individual failures, debug-log only" behavior are modeled directly on pruneDanglingImagesOnRebuild in pkg/compose/watch.go, whose dangling-image matching was itself just fixed in #14012.

Added unit tests for ImagePruner.danglingLocalImages and pruneDanglingProjectImages (grouped single event pair regardless of image count, failure tolerance, and no-op when nothing to prune).

Related issue
N/A

(not mandatory) A picture of a cute animal, if possible in relation to what you did
image

@htoyoda18
htoyoda18 requested review from a team as code owners August 30, 2026 19:16
@htoyoda18
htoyoda18 requested review from glours and ndeloof August 30, 2026 19:16
Signed-off-by: hiroto.toyoda <hiroto.toyoda@dena.com>
@htoyoda18
htoyoda18 force-pushed the fix/down-prune-dangling-images branch from b73e1c9 to caeabae Compare August 30, 2026 19:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant