{{tag>docker registry}} ====== Deleting images from private docker registry ====== Your registry has to have set [[https://stackoverflow.com/questions/39801094/how-to-delete-an-image-from-a-private-docker-registry|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/ or Delete the manifest or tag curl --request DELETE --header "Accept: application/vnd.docker.distribution.manifest.v2+json" localhost:52000/v2/test/manifests/ 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 [[https://distribution.github.io/distribution/about/garbage-collection/#run-garbage-collection|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:private_docker_registry|Private docker registry]] ====== References ====== * https://github.com/distribution/distribution/issues/1579 * https://distribution.github.io/distribution/spec/api/ * https://stackoverflow.com/questions/39801094/how-to-delete-an-image-from-a-private-docker-registry