wiki:deleting_images_private_docker_registry
Table of Contents
Deleting images from private docker registry
Your registry has to have set REGISTRY_STORAGE_DELETE_ENABLED variable.
- get all repos
curl -s localhost:52000/v2/_catalog | jq
- get all tags in repo
curl -s localhost:52000/v2/test/tags/list | jq
- 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>
or
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
References
wiki/deleting_images_private_docker_registry.txt · Last modified: 2024/01/12 11:30 by antisa