Repository navigation
Description
Description
#2270 This is still a problem in version 2.8.3.
Deleted images do not persist on the registry server after garbage collecting.
However, registry serve thinks the blobs are still in the server and says "layer already exists" on push request,
while it shows manifest error on pull request for the same image.
Reproduce
First, push a sample image into the registry and delete it with the provided API and garbage collector.
# Push an image to the registry
docker push localhost:5000/sample:latest
# Delete the image from the registry
curl -v -X DELETE "http://$DSLICE_URL/v2/sample/manifests/$(
curl -I -H "Accept: application/vnd.docker.distribution.manifest.v2+json" "http://$DSLICE_URL/v2/sample/manifests/latest" \
| awk '$1 == "Docker-Content-Digest:" { print $2 }' \
| tr -d $'\r' \
)"
# Run the garbage collector
docker exec -it docker-registry /bin/registry garbage-collect /etc/docker/registry/config.yml
Now, the expected behavior is the image blobs and manifests are completely cleared, and registry serve must be aware that the image is not on the registry server.
However, if we push the same image again, it shows the message "Layer already exists", but the blobs of the layers have been already gone by the garbage collector.
docker push localhost:5000/sample:latest
Thus, if we try to pull the image, it shows error response.
docker pull localhost:5000/sample:latest # Error response from daemon: manifest for localhost:5000/sample:latest not found: manifest unknown: manifest unknown
Expected behavior
registry serve must perceive the absence of the layers after their blobs are deleted by the garbage collector.
registry version
2.8.3
Additional Info
No response
Activity
Ollegio commentedon Mar 10, 2025
It appears that manifest cache is not cleared when the manifest is actually deleted.
adding
after statter initialization here
seems to solve the problem
However, I haven't tested it thoroughly