Docker Community Forums

Share and learn in the Docker community.

Unable to delete image from dockerhub repository by digest (not deleting the tag)

We accidentally pushed an image to a repository and want to remove the image from the docker hub registry. We’ve removed the tags from the erroneous image digest, but the image still exists in the repo and can be pulled with docker pull some/repository@digest

We don’t want to delete the repository entirely so that people pulling from the image don’t have any issues.

We’ve tried going through the api with these steps based on the api docs https://docs.docker.com/registry/spec/api/#deleting-an-image:
Auth:

curl -v -u myuser:mypassword "https://auth.docker.io/token?service=registry.docker.io&scope=repository:some/repository:delete,pull&offline_token=1&client_id=shell"

Delete:

curl -v -H "Authorization: Bearer <token>"  -X DELETE https://registry.hub.docker.com/v2/some/repository/manifests/<some-image-digest>

which returns

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

These docs say that this error could be attributed to delete being disabled (https://docs.docker.com/registry/configuration/#delete). But we’re not sure how the docker hub registry is configured. Is this the case? Or are we doing something wrong?

Thanks!

1 Like

hey @cfbuildpackseng
why are you not trying to delete the tag image from the docker hub ui( in tags section)
there is option to remove tag images.

1 Like

@nitishmowall My understanding is that deleting the tag in the ui would only delete the repository tag and not the image (manifest) itself. The bad image is still accessible using docker pull some/repository@<digest> even though the tag is gone and we don’t want the image to be accessible at all.

@cfbuildpackseng as far i know it also remove the manifest. So if you have tried then ok. If not, try it

1 Like