15

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.

Or Assayag
  • 5,662
  • 13
  • 57
  • 93
  • Possible duplicate of [How to delete images from a private docker registry?](https://stackoverflow.com/questions/25436742/how-to-delete-images-from-a-private-docker-registry) – David Maze Jan 09 '19 at 12:09
  • [This answer to the second question you linked](https://stackoverflow.com/a/43786939/10008173) includes a sequence of relevant HTTP API calls, and other answers include at least three links to external tools. It looks like you need to delete both the image tag and the specific layer manifests underneath it. – David Maze Jan 09 '19 at 12:12
  • Already tried them, still getting 'unsupported' error. – Or Assayag Jan 09 '19 at 13:02
  • 1
    Any luck? Facing the same. Would really like a reliable quick method of dealing with stale images – emmdee Jul 26 '19 at 04:35

2 Answers2

4

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)
wei li
  • 104
  • 6
-1

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.

krzsam
  • 19