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."}]}
Update:
None of the solutions in the links I gave works, and still get 'unsupported' error.
By running simple command docker images -a or docker images . After that you make sure which image want to remove, to do that executing this simple command docker rmi <your-image-id> . Then you can confirm that image has been removed or not by list all the images and check.
By default the registry container keep the data in /var/lib/registry within the container. You can bind mount a local directory on your host like the example did -v /mnt/registry:/var/lib/registry ; which in this case the data will be kept on your host at /mnt/registry.
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)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With