Docker Community Forums

Share and learn in the Docker community.

Delete repository from v2 private registry

(Riteshpats) #1

I tried deleting images from a private registry
post which the blobs and the manifest of the pushed image gets deleted .

but it leaves behind an empty repository with the tag of the images which it contained .

Steps Followed:

docker push  push the image
The push refers to a repository [] (len: 1)
aef768067415: Pushed
82152269d8b3: Pushed
latest: digest: sha256:c7d713292dd6dc833ef6364cc6c821ce9523883bc97cc24bedbc572343644b68 size: 1937  get the digest value of the pushed image

[root@slc01olq docker]# curl -i -X GET  get the blobs associated with the image
HTTP/1.1 200 OK
“schemaVersion”: 1,
“name”: “hello-world-abc”,
“tag”: “latest”,
“architecture”: “amd64”,
“fsLayers”: [
“blobSum”: “sha256:a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4”
“blobSum”: “sha256:4276590986f6a900029d4afb65b0969777f5ff9f70a00f896ec3b7372072381c”

• Delete the manifest and the Blobs::

curl -i -X DELETE
HTTP/1.1 202 Accepted

curl -i -X DELETE
HTTP/1.1 202 Accepted

curl -i -X DELETE
HTTP/1.1 202 Accepted

• Try to pull ::

docker pull
Using default tag: latest
Pulling repository
Error: image hello-world-abc:latest not found

• Search the image

docker search

curl -i -X GET
HTTP/1.1 200 OK


Problem statement  The image is getting deleted , but an empty repository remins and I want to delete this as the above search returns an o/p :: {“name”:“hello-world-abc”,“tags”:[“latest”]}  but actually the latest tag has been deleted

(Tobias Munk) #2

Any news on this? We’re having the same issue.

(Kkim1975) #3

Any update on this? We also noticed the same behavior.

(Issjohnm) #4

I believe if you run garbage collection,
docker exec dockerregistry_registry_1 bin/registry garbage-collect /etc/docker/registry/config.yml
the tag will then be removed from the list of available tags and appear like:
I am uncertain how to completely remove the “name” from the registry.

(Issjohnm) #5

Let me be more clear. I am uncertain how to remove the repository “name” from the registry via the API. You can manually remove the repository from the registry after removing the last manifest by just deleting it on the registry server.

sudo rm -rf docker/registry/v2/repositories/old_repo/

It will no longer appear in the catalog after that, but I don’t recommend just deleting the repository without first removing all the manifests and running garbage collection.

To get a list of manifests that may still be on the registry, you can run:

docker exec privateregistry_registry_1 bin/registry garbage-collect --dry-run /etc/docker/registry/config.yml | grep 'old_repo: marking manifest' | awk '{print $4}'

This will give you a list of all the manifest IDs on your registry that haven’t been cleaned up yet. If you don’t have a script, you would need to use the delete api to remove them one at a time:
curl -X DELETE -H "Authorization: Basic abcde12345" https://private.registry/v2/old_repo/manifests/sha256:<manifest_id_here>

(Vladkras) #6

And what should I do next? I deleted manifests, collected garbage, but repo still exists in the list

(Mdebord) #7

Would like to confirm, based on the above replies - the official way to delete the repo from the catalog (AFTER all manifests under it are purged) is to just delete it from disk?

In other words, there is no API call or garbage collection to remove the empty repository entry, it must be deleted manually from disk?