Or Assayag
Or Assayag

Reputation: 6336

Docker - How to delete image from a private registry

There is no good answer yet to "How to delete an image from a private registry" in docker.

Already tried the following:
Can't delete Docker Image from Registry
How to delete images from a private docker registry?
How to "delete" an image from a private Docker Registry?
But none of the above seems to work.

As everyone else, I already tried:

DELETE /v2/orassayag/osr_streamer_nginx/manifests/sha256:051adb935bff30abba811fd64da28a5f3b19a48f07c74b067e3bd61ab91152b5 HTTP/1.1

AND

DELETE /v2/orassayag/osr_streamer_nginx/manifests/051adb935bff30abba811fd64da28a5f3b19a48f07c74b067e3bd61ab91152b5 HTTP/1.1

and get every time:

{"errors":[{"code":"UNSUPPORTED","message":"The operation is unsupported."}]}

Anybody had success with this?

Update:
None of the solutions in the links I gave works, and still get 'unsupported' error.

Upvotes: 15

Views: 14141

Answers (2)

krzsam
krzsam

Reputation: 19

You can remove the tag via the Docker web interface - log in, open the repository where the image is, change to the tab called 'Tags', locate the image you want to delete - on the right hand side there is a button looking like vertical three dots - when you click it it shows option 'Delete' - when you remove this tag, this also removes the relevant image on the 'General' tab. Hope this is what you tried to achieve.

Upvotes: 0

wei li
wei li

Reputation: 104

This is a python script delete all image in private registry, it work on my private registry.

import requests
for repo in requests.get('https://192.168.2.31:5000/v2/_catalog', verify=False).json()['repositories']:
    headers = requests.get('https://192.168.2.31:5000/v2/%s/manifests/v1' % repo, headers = {'Accept': 'application/vnd.docker.distribution.manifest.v2+json'}, verify=False).headers
    if 'Docker-Content-Digest' in headers:
        requests.delete('https://192.168.2.31:5000/v2/%s/manifests/%s' % (repo, headers['Docker-Content-Digest']), verify=False)

Upvotes: 4

Related Questions