You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Garbage collect deletes blobs in disk but blobs are still in memory and registry does not accept the push twice #4569
By default conf.yml has the following configuration set, which keeps blob descriptors in memory:
storage:
cache:
blobdescriptor: inmemory
Image tag deletion process deletes blobs and layers from disk, but does not delete in memory descriptors.
Due to in memory descriptors, it's not possible to re-push the same image because registry uses cache layers but such layers are not there actually.
Reproduce
reproducable in both latest V3 (`3.0.0-rc.2) and V2; I'll use V3 in this example
When a image is pushed into the registry, deleted and garbage collect is executed, the blobs are fully removed from disk:
# start a registry
docker run -d -e REGISTRY_STORAGE_DELETE_ENABLED=true -p 5000:5000 --rm --name registry-in-memory-blobs registry:3.0.0-rc.2
# creating a random tag and push it
docker tag registry:3.0.0-rc.2 localhost:5000/registry:3.0.0-rc.2
docker push localhost:5000/registry:3.0.0-rc.2
# then delete the tag and run garbage collect
curl -X DELETE http://localhost:5000/v2/registry/manifests/sha256:776203b7933004f7b6cada731e171469e3e267a1e77912fd8e0fc26c16f896f2
docker exec registry-in-memory-blobs /bin/registry garbage-collect /etc/distribution/config.yml
Previous commands successfully deleted blobs from disk, but their descriptions are still in memory.
When the same push takes place again, registry says blobs/layers are already there and does not really accept the push, but uses the cache layers instead of pushing:
But no new layers were created on disk, and if we try to pull it will not work:
docker pull localhost:5000/registry:3.0.0-rc.2
# Error response from daemon: manifest for localhost:5000/registry:3.0.0-rc.2 not found: manifest unknown: manifest unknown
So, the HTTP DELETE request and garbage collect successfully deleted the blobs and layers from disk, but haven't deleted the in memory blob descriptors. It makes inconsistency between what is in memory and what is in disk.
If the blobdescriptor: inmemory is not set, them this behavir does not happen
Expected behavior
registry allows to push the same image after deleting it
Hi guys, I am using registry image v3.0.0 official one , this behavior is still happening. I need to restart the registry container after garbage-collect cmd being executed in order to prevent this. Any feedback on this issue ??
Confirming this is still a problem for me for both v2 and v3 registry, here's the smallest test script I've got:
# run a local registry
docker rm -f local-registry
docker run -d --name local-registry -p 6000:5000 -e REGISTRY_STORAGE_CACHE_BLOBDESCRIPTOR=inmemory -v "$(pwd)/private-registry:/var/lib/registry" registry:2.8.3
# create a simple dockerfile with a few shared layers between 2 images
cat > Dockerfile <<'EOF'FROM busybox:1.36 AS baseWORKDIR /outRUN printf 'a' > aRUN printf 'b' > bRUN printf 'c' > cFROM base AS image-oneRUN printf 'd-1' > dCMD ["true"]FROM base AS image-twoRUN printf 'd-2' > dCMD ["true"]EOF# build both images
docker build -t localhost:6000/test:image-one --target image-one .
docker build -t localhost:6000/test:image-two --target image-two .# tag, push and pull image one as latest
docker tag localhost:6000/test:image-one localhost:6000/test:latest
docker push localhost:6000/test:latest
docker pull localhost:6000/test:latest
# tag, push and pull image two over the top
docker tag localhost:6000/test:image-two localhost:6000/test:latest
docker push localhost:6000/test:latest
docker pull localhost:6000/test:latest
# run garbage collection
docker exec local-registry registry garbage-collect -m /etc/docker/registry/config.yml
# repush image one back over the top of image two
docker tag localhost:6000/test:image-one localhost:6000/test:latest
docker push localhost:6000/test:latest
# pull is broken, only when the cache is enabled on the registry
docker pull localhost:6000/test:latest
v3 exhibits the same failure with the same script, just needs the config path changed
# run a local registry
docker rm -f local-registry
docker run -d --name local-registry -p 6000:5000 -e REGISTRY_STORAGE_CACHE_BLOBDESCRIPTOR=inmemory -v "$(pwd)/private-registry:/var/lib/registry" registry:3.0.0
# create a simple dockerfile with a few shared layers between 2 images
cat > Dockerfile <<'EOF'FROM busybox:1.36 AS baseWORKDIR /outRUN printf 'a' > aRUN printf 'b' > bRUN printf 'c' > cFROM base AS image-oneRUN printf 'd-1' > dCMD ["true"]FROM base AS image-twoRUN printf 'd-2' > dCMD ["true"]EOF# build both images
docker build -t localhost:6000/test:image-one --target image-one .
docker build -t localhost:6000/test:image-two --target image-two .# tag, push and pull image one as latest
docker tag localhost:6000/test:image-one localhost:6000/test:latest
docker push localhost:6000/test:latest
docker pull localhost:6000/test:latest
# tag, push and pull image two over the top
docker tag localhost:6000/test:image-two localhost:6000/test:latest
docker push localhost:6000/test:latest
docker pull localhost:6000/test:latest
# run garbage collection
docker exec local-registry registry garbage-collect -m /etc/distribution/config.yml
# repush image one back over the top of image two
docker tag localhost:6000/test:image-one localhost:6000/test:latest
docker push localhost:6000/test:latest
# pull is broken now for image one only when the cache is enabled
docker pull localhost:6000/test:latest
Activity
Ollegio commentedon Mar 10, 2025
similar issue here #4525
they said nothing about cache, but I think it should be the same problem, also possible solution
#4525 (comment)
milosgajdos commentedon Mar 10, 2025
Think we need this to get over the finish line #3323
milosgajdos commentedon Mar 10, 2025
@Ollegio feel free to open a new PR; I'm happy to review it and push it through.
dkvrgic commentedon Apr 17, 2025
Hi guys, I am using registry image v3.0.0 official one , this behavior is still happening. I need to restart the registry container after garbage-collect cmd being executed in order to prevent this. Any feedback on this issue ??
DanielLeone commentedon Dec 15, 2025
Confirming this is still a problem for me for both v2 and v3 registry, here's the smallest test script I've got:
v3 exhibits the same failure with the same script, just needs the config path changed