-
Notifications
You must be signed in to change notification settings - Fork 509
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request: Pruning of layers of specific image #1065
Comments
Thanks for opening this ticket;
I need to search for those existing issues, but in either case, improving this will require changes in BuildKit (https://github.com/moby/buildkit) to provide the building-blocks for this feature. We recently moved all build-related code out of the docker cli (this) repository, delegating this functionality to the
This is already possible, and is what It's not possible to remove "dangling" image for a specific image, as there is a As mentioned above, the "builder" side of your request is more closely related to BuildKit (and |
I think the solution we could consider would be to add some kind of tagging mechanism. So when you run your project you can tag the build cache it creates with a certain value. And then you can use this tag value as a filter for removing cache associated with a specific project. There are already prune filters by ID/Type etc but they are not very convenient to use. |
This seems not to be true. After doing that I can see that build cache has increased by the amount of layers that existed in pruned images (checking using |
Hmm.. not sure how that would be related; the BuildKit build-cache does not use the image-store, and |
What I experience is that after I prune image, the build cache increases and if I happen to build the same image, I can see that cache has been used to do that. However, I keep a separate image with dependencies so I do not mind doing |
Couldn't find any issue dealing with this. Is this planned ?
Where can we find this filters ? I could only find filters related to time limits and no ID or types. |
docker/buildx#1065 (comment) is the best documentation on this command, and it should fully be able to replace what our imageCleaner currently does. And it's necessary, as I think imageCleaner doesn't actually clean up buildkit cache anymore. This should be upstreamed into the helm chart, and imageCleaner deprecated / removed. However, I want to merge https://github.com/2i2c-org/binderhub-service/ into binderhub and turn that into the chart first, so we don't have to keep repeating work there. So in the meantime, this cronjob is here so we don't have mybinder.org outages (as happened in https://jupyter.zulipchat.com/#narrow/channel/469744-jupyterhub/topic/mybinder.2Eorg.20outage)
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
ordocker 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.
The text was updated successfully, but these errors were encountered: