twuni / docker-registry.helm

Helm chart for a Docker registry. Successor to stable/docker-registry chart.
Apache License 2.0
309 stars 146 forks source link

Garbage collection cronjob leaves registry in an inconsistent state #104

Open 0xDEC0DE opened 1 year ago

0xDEC0DE commented 1 year ago

Prerequisites

Steps to reproduce

Setup

export REGISTRY=$NAME_OF_REGISTRY_INGRESS
export REGISTRY_POD=$NAME_OF_REGISTRY_POD_FROM_KUBECTL

docker login $REGISTRY
docker pull hello-world:latest
docker tag hello-world:latest ${REGISTRY}/hello-world:latest
docker push ${REGISTRY}/hello-world:latest
skopeo delete docker://${REGISTRY}/hello-world:latest
kubectl exec $REGISTRY_POD -- /bin/registry garbage-collect --delete-untagged=true /etc/docker/registry/config.yml

Test

docker push ${REGISTRY}/hello-world:latest
docker pull ${REGISTRY}/hello-world:latest

Expected result

Success

Actual behavior

It fails, claiming layers already exist, etc.

Workaround

Restarting the registry after garbage-collection makes it work as expected:

kubectl delete pod $REGISTRY_POD ; sleep 5  # XXX: restart registry
docker push ${REGISTRY}/hello-world:latest
docker pull ${REGISTRY}/hello-world:latest  # XXX: success
0xDEC0DE commented 1 year ago

Workaround

Disabling caching on the registry server will also make it behave correctly. This can be achieved by setting storage.cache.blobdescriptor to an "invalid" value in the configs, e.g.:

docker-registry:
  configData:
    storage:
      cache:
        blobdescriptor: disabled
nabaruns commented 1 year ago

Facing same issue.

BrianValente commented 9 months ago

Can confirm, workaround works.