I'm writing an API client for docker and the registry API is difficult to work with. I'm trying to delete an image from the registry however I keep getting this error
[ { code: 'UNSUPPORTED', message: 'The operation is unsupported.' } ]
My steps to get this are as follows,
> GET http://localhost:5000/v2/
> registry/2.0
> registry/2.0
> GET http://localhost:5000/v2/_catalog/
> { repositories: [ 'alpine' ] }
> GET http://localhost:5000/v2/alpine/tags/list
> { name: 'alpine', tags: [ 'latest' ] }
> HEAD http://localhost:5000/v2/alpine/manifests/latest
> sha256:df73ed0973f15f40496c148330f9b559f0a5583c03f6ac8d26adadf6f4690aff
> DELETE http://localhost:5000/v2/alpine/manifests/sha256:df73ed0973f15f40496c148330f9b559f0a5583c03f6ac8d26adadf6f4690aff
[ { code: 'UNSUPPORTED', message: 'The operation is unsupported.' } ]
I'm updating my question since I found the REGISTRY_STORAGE_DELETE_ENABLED
variable.
I now run the registry container like so,
docker run -d -p 5000:5000 -e REGISTRY_STORAGE_DELETE_ENABLED=true --name registry2 registry
Which produces a new error,
[ { code: 'MANIFEST_UNKNOWN', message: 'manifest unknown' } ]
Clearly the UNSUPPORTED
error, really meant that the particular feature was disabled.
However everything I read says that deleting the manifest's entity reference (the digest from the HEAD request) should remove the repository. I just want to make a repository in my private registry unreachable, I consider that deleted.
In order to pull images from your private repository, you'll need to login to Docker. If no registry URI is specified, Docker will assume you intend to use or log out from Docker Hub. Triton comes with several images built-in. You can view the available list with triton images .
If we do not want to find dangling images and remove them one by one, we can use the docker image prune command. This command removes all dangling images. If we also want to remove unused images, we can use the -a flag. The command will return the list of image IDs that were removed and the space that was freed.
This is stored within /var/lib/docker on the docker host, probably under a container or overlay sub directory, and then under a unique directory name per container. And then that, within Docker Desktop on Mac, is within a VM.
Go to the Container Registry page. Click on the image name to see version(s) of that image. In the registry, check the box next to the version(s) of the image that you want to delete. Click DELETE on the top of the page.
Even if this is an old question: The solution is simple.
DELETE http://localhost:5000/v2/alpine/manifests/sha256:df73ed0973f15f40496c148330f9b559f0a5583c03f6ac8d26adadf6f4690aff
is wrong because the digest is prefixed with sha256:
. Simple remove the prefix and then a delete is possible:
DELETE http://localhost:5000/v2/alpine/manifests/df73ed0973f15f40496c148330f9b559f0a5583c03f6ac8d26adadf6f4690aff
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