#405

Garbage Collector does not remove multi-arch images

OpenXORTEX-DevOpsopened 1y ago

Hi, I use this docker registry UI and I have an issue...

Bug description

Garbage Collector does not remove multi-arch images. If the manifest file (application/vnd.docker.distribution.manifest.list.v2+json) is deleted from the library, only the manifest list is deleted. The garbage collector does not delete the images, as the manifests still exist.

How to Reproduce

Use this API command to an multi-arch image (e.g. built with docker buildx)

curl -s -H "Accept: application/vnd.docker.distribution.manifest.list.v2+json" --head http://DOCKERREGISTRY_HOST/v2/IMAGENAME/MANIFESTS/TAG

HTTP/2 200
server: nginx
date: Mon, 09 Dec 2024 07:24:08 GMT
content-type: application/vnd.docker.distribution.manifest.list.v2+json
content-length: 403
access-control-allow-credentials: true
access-control-allow-headers: Authorization
access-control-allow-headers: Accept
access-control-allow-headers: Cache-Control
access-control-allow-methods: HEAD
access-control-allow-methods: GET
access-control-allow-methods: OPTIONS
access-control-allow-methods: DELETE
access-control-allow-origin: *
access-control-expose-headers: Docker-Content-Digest
docker-content-digest: sha256:b858b2cda3537aee28ecd3b479168815e6bcf63ad5d47f6f054e0086321a2aa4
docker-distribution-api-version: registry/2.0
etag: "sha256:b858b2cda3537aee28ecd3b479168815e6bcf63ad5d47f6f054e0086321a2aa4"
x-content-type-options: nosniff
docker-distribution-api-version: registry/2.0

Delete docker-contest-digest:

curl -X DELETE http://127.0.0.1:8080/v2/ubuntu/manifests/sha256: b858b2cda3537aee28ecd3b479168815e6bcf63ad5d47f6f054e0086321a2aa4

Run garbage-collect and nothing is deleted

My private docker registry configuration

version: 0.1
log:
  fields:
    service: registry
storage:
  cache:
    blobdescriptor: inmemory
  filesystem:
    rootdirectory: /var/lib/registry
  delete:
    enabled: true
http:
  addr: :5000
  headers:
    X-Content-Type-Options:
      - nosniff
    Access-Control-Allow-Origin:
      - '*'
    Access-Control-Allow-Methods:
      - HEAD
      - GET
      - OPTIONS
      - DELETE
    Access-Control-Allow-Headers:
      - Authorization
      - Accept
      - Cache-Control
    Access-Control-Allow-Credentials:
      - 'true'
    Access-Control-Expose-Headers:
      - Docker-Content-Digest

Expected behavior

When run:

curl -s -H "Accept: application/vnd.docker.distribution.manifest.list.v2+json" http://DOCKERREGISTRY_HOST/v2/IMAGENAME/MANIFESTS/TAG

Result:

{
  "schemaVersion": 2,
  "mediaType": "application/vnd.docker.distribution.manifest.list.v2+json",
  "manifests": [
    {
      "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
      "digest": "sha256:c8211f332fd940b62e68b551a49c1f3ffbe07c17c9eba89ed4fcbe5f301dafe4",
      "size": 1477,
      "platform": {
        "architecture": "amd64",
        "os": "linux"
      }
    }
  ]
}

All digest from manifest and the manifestlist (docker-content-digest) must be deleted e.g.

curl -X DELETE http://127.0.0.1:8080/v2/ubuntu/manifests/sha256: c8211f332fd940b62e68b551a49c1f3ffbe07c17c9eba89ed4fcbe5f301dafe4

and

curl -X DELETE http://127.0.0.1:8080/v2/ubuntu/manifests/sha256: b858b2cda3537aee28ecd3b479168815e6bcf63ad5d47f6f054e0086321a2aa4

When both are deleted, the garbage collector works like a charm.

System information

  • OS: Ubuntu
  • Browser:
    • Name: Chrome
    • Version: newest
  • Docker registry UI:
    • Version: 2.5.7
    • Server: docker
    • Docker version: 27.3.1,
    • Docker registry ui tag: latest
    • OS/Arch: linux/amd64
    • Tools: docker-compose

Activity

0

No activity yet.