Feature request: Pruning of layers of specific image
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 4.5k
- Forks
- 682
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 29
Description
When using Docker for a large amount of projects on a personal machine, and frequently rebuilding large containers, one may find themselves requiring to prune cached layers from previous builds to free up disk space.
The only way to do this, is by pruning all dangling layers, using docker builder prune. This is inconvenient, as one will lose cached layers from all the containers of all projects on the machine.
Instead, it would be much nicer to have a command where one could prune the layers of a specific image, or alternatively, have a flag for the docker rmi or docker image rm command, that after removal of the image, also prunes all of its layers that are now dangling.
This way, one could have a build script where an image is rebuilt, and after rebuilding, remove the old image and its now dangling layers. This way, disk space is optimally preserved for the image in question, without affecting other projects.
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 by investigating the existing docker builder prune, docker rmi, and docker image rm entry points and how they identify cached layers. Define the intended command or flag behavior, including which layers are safe to remove and how other projects' caches are protected; done requires documented behavior and tests for image-specific pruning.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, go
- Domain
- build-system, cli
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100