Red Hat Bugzilla – Bug 1290237
[RFE] Delete Docker Images from private registry
Last modified: 2017-05-10 07:20:16 EDT
- What is the nature and description of the request?
As an admin I need the ability to delete docker images from my private registry established for OpenShift v3.1. With no way to delete them, all they do is build up and take up space. Currently the only way to do this is through Docker Registry v2 api calls.
- Why does the customer need this? (List the business requirements here)
The docker images they have pushed to their registry are taking up too much space (>80 GB). They are currently unable to remove any of the images.
- How would the customer like to achieve this? (List the functional requirements here)
A command for OpenShift that deletes the docker images. A possible fix is a command that will run these api calls.
- Is there already an existing RFE upstream or in Red Hat Bugzilla?
Not that I could find
- List any affected packages or components.
Hi Eric. Is this not doing what you need: https://docs.openshift.org/latest/admin_guide/pruning_resources.html#pruning-images
Hi Paul, the only issue with that is it doesn't seem to leave any room for specifying what images to remove. It only suggests removing old images, not allowing certain images, and their later versions, to be completely removed from the registry. Please correct me if my understanding of this command is incorrect.
Thanks, that makes sense. For now, if you want to remove specific images from the internal registry you should be able to log in to the registry and run the docker cli commands to do so.
I think being able to specify which images to prune is reasonable.
Paul, just to be certain, when you say login "and run the docker cli commands to do so" you mean using things like `docker rmi`? Has that been confirmed to work with the OpenShift internal Docker Registry? I thought that would only remove the images from the local download (i.e. the images you get when you run `docker pull`) not the ones that you have tagged and then pushed to your internal registry?
The only way that I have found to delete images from a private registry is to use api calls that I haven't even been able to verify yet. An example of these can be found at http://www.mooshammer.us/blog/2014/12/24/basics-operation-on-a-private-docker-registry/
does a deletion of images in following way address your/customers issue?
$ oc get images
NAME DOCKER REF
# delete all images in joe1/hello-openshift
$ oc get images | sed -n 's,.*joe1/hello-openshift@\(.*\),images/\1,p' | xargs oc delete
# wait for registry's prune to remove any garbage
I'm affraid those API calls are soft deletes only. The deleted manifests/layers/blobs will no longer be available for pulls but the content will be still stored on registry's storage.
Thank you for that information on the api calls. Do you know how long it would take for the registry to remove any garbage? I am trying to test it in my environment, and it might simply be impatience, but I am not seeing any change yet.