Reputation: 21
So I have private docker registry and all I want to do is to be able to delete manifests and dangling layers. What I am doing is finding digest of the manifest in Registry API, then sending DELETE on /v2/NAME/manifests/SHA256 which is working perfectly fine. Then I run garbage collector by docker exec -it CONTAINERID bin/registry garbage-collect -m /etc/docker/registry/config.yml GC finds some loose blobs deletes them.
It looks good but when I push the same image again to registry it says layers already exists, and I can't pull this image from registry. When I try to GET manifest from API, tag is on the tags list but GET /v2/NAME/manifests/TAG returns 404
Here is my docker-compose.yaml
registry:
restart: always
image: registry:2
ports:
- 5000:5000
environment:
REGISTRY_STORAGE_DELETE_ENABLED: "true"
volumes:
- /var/lib/registry:/var/lib/registry
and config.yaml
version: 0.1
log:
fields:
service: registry
storage:
cache:
blobdescriptor: inmemory
filesystem:
rootdirectory: /var/lib/registry
http:
addr: :5000
headers:
X-Content-Type-Options: [nosniff]
health:
storagedriver:
enabled: true
interval: 10s
threshold: 3
Upvotes: 2
Views: 2272
Reputation: 21
I found an answer maybe its not the best solution but it works. Problem is storage.cache that holds layers. When I removed this sections from config.yaml everything worked as it should. If you need cache then you should find way to clear layers from cache after GC.
Upvotes: 0