Bug 1290237 - [RFE] Delete Docker Images from private registry
[RFE] Delete Docker Images from private registry
Product: OpenShift Container Platform
Classification: Red Hat
Component: RFE (Show other bugs)
Unspecified Unspecified
medium Severity medium
: ---
: ---
Assigned To: Ben Parees
Johnny Liu
Depends On:
Blocks: 1267746
  Show dependency treegraph
Reported: 2015-12-09 17:17 EST by Eric Jones
Modified: 2017-10-18 10:22 EDT (History)
13 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Eric Jones 2015-12-09 17:17:37 EST
- 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.  
Comment 2 Paul Weil 2015-12-09 17:31:21 EST
Hi Eric.  Is this not doing what you need: https://docs.openshift.org/latest/admin_guide/pruning_resources.html#pruning-images
Comment 3 Eric Jones 2015-12-09 17:37:39 EST
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.
Comment 4 Paul Weil 2015-12-10 09:29:04 EST
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.
Comment 5 Eric Jones 2015-12-10 10:08:41 EST
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/
Comment 6 Michal Minar 2015-12-10 10:36:58 EST

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
Comment 7 Michal Minar 2015-12-10 10:42:15 EST
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.
Comment 8 Eric Jones 2015-12-10 11:19:26 EST

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.
Comment 14 Ben Parees 2017-10-17 12:02:56 EDT
Just a summary on this:  i've created a new trello card to reflect what i understand the RFE to be:  ability to explicitly delete a specific image and have its registry blogs removed.  Ie the equivalent of what oc prune does, but allowing you to specify exactly what image(s) to prune.

Note You need to log in before you can comment on or make changes to this bug.