Docker prune fails if image is both used for resource and as base image
Open
Nobody has claimed this yet.
bug
- Dominant language
- Go
- Stars
- 10.1k
- Forks
- 413
- Avg merge
- 1d 10h
- Merged PRs (30d)
- 6
Description
Expected Behavior
tilt docker-pruneshould be able to clean up all images Tilt produced
Current Behavior
tilt docker-prunecan fail to remove images if it tagged them more than once[Docker Prune] cannot prune image sha256:eb853b9faada7b43bb19f47affd56b0c9db75b182fd2d7bf8df21389f1943d29 (tags: monolith-worker-tilt_docker_build_with_restart_base:tilt-eb853b9faada7b43, monolith:tilt-eb853b9faada7b43); `docker image remove --force` required to remove an image with multiple tags (Docker throws error: "image is referenced in one or more repositories")
Steps to Reproduce
- Create a
Tiltfilewith at least 2docker_builds where the second one uses the first one as base image
N.B. You need a Pod with BOTHload("ext://restart_process", "docker_build_with_restart") docker_build("monolith", ".") docker_build_with_restart("monolith-worker", ".", dockerfile_contents="FROM monolith", entrypoint="<omitted>") docker_prune_settings(disable=False, max_age_mins=1, num_builds=1, keep_recent=1) ... # bring up some k8s resources that use those images abovemonolithANDmonolith-worker - Run
tilt up, build a few times - Stop Tilt, run
tilt docker-prune
About Your Use Case
From Allon Hadaya in #tilt
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the tilt docker-prune entry point and reproduce the case with two docker_builds where the second uses the first as its base image, plus a Pod using both images. Verify the fix by running tilt docker-prune after repeated builds and confirming that all eligible images are removed without requiring docker image remove --force.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, go
- Domain
- cli, devops
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100