How to "delete" an image from a private Docker registry?

I am writing a docker API client, and it is difficult to work with the registry API. I try to remove the image from the registry, but 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.' } ]

EDIT

I am updating my question since I found a variable REGISTRY_STORAGE_DELETE_ENABLED.

Now I run the registry container so

docker run -d -p 5000:5000 -e REGISTRY_STORAGE_DELETE_ENABLED=true --name registry2 registry

What makes a new mistake

[ { code: 'MANIFEST_UNKNOWN', message: 'manifest unknown' } ]

Obviously, the error UNSUPPORTEDreally meant that a certain function was disabled.

However, everything I read suggests that deleting the manifest link (digest from the HEAD request) should remove the repository. I just want to make the repository in my personal registry inaccessible, I believe that it is deleted.

How to remove an image from the private registry so that it cannot be pulled out?

+4

Source: https://habr.com/ru/post/1656422/


All Articles