User Tools

Site Tools


Deleting images from private docker registry

Your registry has to have set REGISTRY_STORAGE_DELETE_ENABLED variable.

  1. get all repos
    curl -s localhost:52000/v2/_catalog | jq 
  2. get all tags in repo
    curl -s localhost:52000/v2/test/tags/list | jq 
  3. get digest of test repo with image tagged as test33
    curl -s -I --request HEAD --header "Accept: application/vnd.docker.distribution.manifest.v2+json" localhost:52000/v2/test/manifests/test33 | grep ^Docker-Content-Digest | cut -d: -f2,3

Now you can:

Delete the blob identified by name and digest

curl --request DELETE --header "Accept: application/vnd.docker.distribution.manifest.v2+json" localhost:52000/v2/test/blobs/<digest>


Delete the manifest or tag

curl --request DELETE --header "Accept: application/vnd.docker.distribution.manifest.v2+json" localhost:52000/v2/test/manifests/<digest>

You have to use the hash type in digest like sha256:FEWIoj3242ji…

curl --request DELETE --header "Accept: application/vnd.docker.distribution.manifest.v2+json" localhost:52000/v2/test/manifests/sha256:FEWIoj3242ji

However, delete only removes references within the repositories. To recover space you will need to garbage collect. Example when running registry directly on server:

docker run --rm registry:2 garbage-collect [--dry-run] /etc/docker/registry/config.yml

Example when running registry as a docker container:

docker exec -it docker-registry sh # enter container first
/bin/registry garbage-collect [--dry-run] /etc/docker/registry/config.yml

Tested on

  • docker registry image 01.2024

See also


wiki/deleting_images_private_docker_registry.txt · Last modified: 2024/01/12 11:30 by antisa

Except where otherwise noted, content on this wiki is licensed under the following license: CC0 1.0 Universal
CC0 1.0 Universal Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki