Skip to content

Strange behaviour when pushing an image after deleting the manifest from the registry #2094

Open

Description

@lorenzobenvenuti

Hi,

I'm experiencing an unexpected behaviour when deleting a manifest. I'm doing some experiments in order to understand how to cleanup a local registry thats hosts some images that are build by periodic tasks. The idea was to:

  • Create image with tag 1
  • Run the container
  • Remove image with tag 1 from the registry (= remove the manifest and run garbage collector to remove "dangling" layers)
  • Repeat

To validate this strategy I tried to setup a testing environment.

$ docker run -d -p 5000:5000 -e REGISTRY_STORAGE_DELETE_ENABLED=true -v /home/lorenzob/registry:/var/lib/registry --name reg registry:2.5.1

$ docker tag ubuntu:latest localhost:5000/lorenzo/ubuntu:1.0

$ docker push localhost:5000/lorenzo/ubuntu:1.0

$ du -sh registry/
47M	registry/

At this point I tried to remove the image:

$ curl -I -X HEAD http://localhost:5000/v2/lorenzo/ubuntu/manifests/1.0
HTTP/1.1 200 OK
Content-Length: 9033
Content-Type: application/vnd.docker.distribution.manifest.v1+prettyjws
Docker-Content-Digest: sha256:27f101313deea7d60456d92440dc7e1584b5ef3d9984d5564e588ee3ee760042
Docker-Distribution-Api-Version: registry/2.0
Etag: "sha256:27f101313deea7d60456d92440dc7e1584b5ef3d9984d5564e588ee3ee760042"
X-Content-Type-Options: nosniff
Date: Sat, 03 Dec 2016 16:02:27 GMT

$ curl -X DELETE http://localhost:5000/v2/lorenzo/ubuntu/manifests/sha256:27f101313deea7d60456d92440dc7e1584b5ef3d9984d5564e588ee3ee760042

$ curl -X GET http://localhost:5000/v2/lorenzo/ubuntu/manifests/1.0
{"errors":[{"code":"MANIFEST_UNKNOWN","message":"manifest unknown","detail":{"Tag":"1.0"}}]}

$ du -sh registry/
47M	registry/

The manifest is gone, the layers are still there. Running the garbage collector does the trick:

$ docker exec reg /bin/registry garbage-collect /etc/docker/registry/config.yml
time="2016-12-03T16:05:13Z" level=info msg="Deleting blob: /docker/registry/v2/blobs/sha256/5b/5ba4f30e5bea63dcc2e7054b8b4f41ab1e5fcc7db0a88fc79359b890bcfe2258" go.version=go1.6.3 instance.id=7320555a-9170-4b25-8d07-425a5cc7d25f 
time="2016-12-03T16:05:13Z" level=info msg="Deleting blob: /docker/registry/v2/blobs/sha256/9d/9d7d19c9dc56f51e04f598d8bb8dba1f5cde61434935959ef827ced31f1eb80c" go.version=go1.6.3 instance.id=7320555a-9170-4b25-8d07-425a5cc7d25f 
time="2016-12-03T16:05:13Z" level=info msg="Deleting blob: /docker/registry/v2/blobs/sha256/a3/a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4" go.version=go1.6.3 instance.id=7320555a-9170-4b25-8d07-425a5cc7d25f 
time="2016-12-03T16:05:13Z" level=info msg="Deleting blob: /docker/registry/v2/blobs/sha256/ac/ac6ad7efd0f97fbaa04d98cbfa6deb994382723ba32b23e46c0ef5b0afcc543e" go.version=go1.6.3 instance.id=7320555a-9170-4b25-8d07-425a5cc7d25f 
time="2016-12-03T16:05:13Z" level=info msg="Deleting blob: /docker/registry/v2/blobs/sha256/e7/e7491a747824095463fa464d4d5f7941ff65277012f8102464e9531eb59db7a5" go.version=go1.6.3 instance.id=7320555a-9170-4b25-8d07-425a5cc7d25f 
time="2016-12-03T16:05:13Z" level=info msg="Deleting blob: /docker/registry/v2/blobs/sha256/27/27f101313deea7d60456d92440dc7e1584b5ef3d9984d5564e588ee3ee760042" go.version=go1.6.3 instance.id=7320555a-9170-4b25-8d07-425a5cc7d25f

$ du -sh registry/
132K	registry/

Fine, I thought: it's working! But when I tried to add a new version of the image...

$ docker tag ubuntu:latest localhost:5000/lorenzo/ubuntu:2.0 
$ docker push localhost:5000/lorenzo/ubuntu:2.0
$ du -sh registry/
188K	registry/

What? I was expecting this to be 47MB! The strange thing is that the manifest at http://localhost:5000/v2/lorenzo/ubuntu/manifests/2.0 seems ok, and I can even run a container from that image:

$ docker run --rm localhost:5000/lorenzo/ubuntu:2.0 echo "Hi"
Hi

Anyway if I try to delete it I receive an error:

$ curl -X DELETE http://localhost:5000/v2/lorenzo/ubuntu/manifests/sha256:27f101313deea7d60456d92440dc7e1584b5ef3d9984d5564e588ee3ee760042
{"errors":[{"code":"MANIFEST_UNKNOWN","message":"manifest unknown"}]}

This looks like a bug to me. Is this related to the fact that I'm actually adding the same image twice with different tags (so the digest is the same)?

Thank you,

lorenzo

PS: I think this has more to do with the registry than with docker itself, but to provide as much informations as I can I'm using docker 1.6.2:

$ docker version
Client version: 1.6.2
Client API version: 1.18
Go version (client): go1.5.1
Git commit (client): 7c8fca2
OS/Arch (client): linux/amd64
Server version: 1.6.2
Server API version: 1.18
Go version (server): go1.5.1
Git commit (server): 7c8fca2
OS/Arch (server): linux/amd64

Activity

  1. stevvooe commented on Dec 15, 2016

    @stevvooe
    Collaborator

    docker run --rm localhost:5000/lorenzo/ubuntu:2.0 echo "Hi" still works because you didn't delete the image locally. If you run docker rmi localhost:5000/lorenzo/ubuntu:2.0, the image will be removed from the docker instance and it should no longer be pullable.

  2. lorenzobenvenuti commented on Dec 16, 2016

    @lorenzobenvenuti
    Author

    Thank you, it totally makes sense. Anyway, that doesn't explain why after pushing the image localhost:5000/lorenzo/ubuntu:2.0 (which actually has the same digest of the deleted one, being another tag of the same image) the registry size doesn't grow (and, consequently, the error received when I try to delete the manifest from the registry).

  3. stevvooe commented on Dec 20, 2016

    @stevvooe
    Collaborator

    @lorenzobenvenuti I see. You did have a push in there. It looks like the the gc isn't cleaning up the references when issuing the deletes.

    Could you reproduce the problem then include a the output of tree registry/ after each step?

  4. lorenzobenvenuti commented on Dec 20, 2016

    @lorenzobenvenuti
    Author
    $ docker run -d -p 5000:5000 -e REGISTRY_STORAGE_DELETE_ENABLED=true -v  /home/lorenzo/registry:/var/lib/registry --name reg registry:2.5.1
    
    $ tree registry/
    registry/
    
    0 directories, 0 files
    
    $ docker tag ubuntu:latest localhost:5000/lorenzo/ubuntu:1.0
    
    $ docker push localhost:5000/lorenzo/ubuntu:1.0
    The push refers to a repository [localhost:5000/lorenzo/ubuntu]
    5972ebe5b524: Pushed
    3d515508d4eb: Pushed
    bbe6cef52379: Pushed
    87f743c24123: Pushed
    32d75bc97c41: Pushed
    1.0: digest: sha256:7a64bc9c8843b0a8c8b8a7e4715b7615e4e1b0d8ca3c7e7a76ec8250899c397a size: 1357
    
    $ du -sh registry/
    49M	registry/
    
    $ tree registry/
    registry/
    └── docker
        └── registry
            └── v2
                ├── blobs
                │   └── sha256
                │       ├── 10
                │       │   └── 104bec311bcdfc882ea08fdd4f5417ecfb1976adea5a0c237e129c728cb7eada
                │       │       └── data
                │       ├── 4a
                │       │   └── 4a70713c436f2350e8a9f1c1e6c823290f331254c6c21d5657056499d8575608
                │       │       └── data
                │       ├── 4d
                │       │   └── 4daad8bdde31f5969d6a44800e993a911bed25853b2f89417b07ce7f0ac67714
                │       │       └── data
                │       ├── 63
                │       │   └── 63fe8c0068a811103c702452985368fc99014f83b5f0151cf631644f13f383b2
                │       │       └── data
                │       ├── 7a
                │       │   └── 7a64bc9c8843b0a8c8b8a7e4715b7615e4e1b0d8ca3c7e7a76ec8250899c397a
                │       │       └── data
                │       ├── b3
                │       │   └── b3e1c725a85f0953e81815b7c7aabfad9ebfd90af53f99248981282b8045d787
                │       │       └── data
                │       └── bd
                │           └── bd842a2105a862f62ba4ad726531029be49046c290307e9c07a688c89f4606e6
                │               └── data
                └── repositories
                    └── lorenzo
                        └── ubuntu
                            ├── _layers
                            │   └── sha256
                            │       ├── 104bec311bcdfc882ea08fdd4f5417ecfb1976adea5a0c237e129c728cb7eada
                            │       │   └── link
                            │       ├── 4a70713c436f2350e8a9f1c1e6c823290f331254c6c21d5657056499d8575608
                            │       │   └── link
                            │       ├── 4daad8bdde31f5969d6a44800e993a911bed25853b2f89417b07ce7f0ac67714
                            │       │   └── link
                            │       ├── 63fe8c0068a811103c702452985368fc99014f83b5f0151cf631644f13f383b2
                            │       │   └── link
                            │       ├── b3e1c725a85f0953e81815b7c7aabfad9ebfd90af53f99248981282b8045d787
                            │       │   └── link
                            │       └── bd842a2105a862f62ba4ad726531029be49046c290307e9c07a688c89f4606e6
                            │           └── link
                            ├── _manifests
                            │   ├── revisions
                            │   │   └── sha256
                            │   │       └── 7a64bc9c8843b0a8c8b8a7e4715b7615e4e1b0d8ca3c7e7a76ec8250899c397a
                            │   │           └── link
                            │   └── tags
                            │       └── 1.0
                            │           ├── current
                            │           │   └── link
                            │           └── index
                            │               └── sha256
                            │                   └── 7a64bc9c8843b0a8c8b8a7e4715b7615e4e1b0d8ca3c7e7a76ec8250899c397a
                            │                       └── link
                            └── _uploads
    
    41 directories, 16 files
    

    At this point something weird happened: repeating the same steps described in my first comment I wasn't able to delete an image:

    $ curl -I -X HEAD http://localhost:5000/v2/lorenzo/ubuntu/manifests/1.0
    HTTP/1.1 200 OK
    Content-Length: 6056
    Content-Type: application/vnd.docker.distribution.manifest.v1+prettyjws
    Docker-Content-Digest: sha256:54614ea840252c4fea094e14f347dda8b4db076561b051bb4d493516d98c56e9
    Docker-Distribution-Api-Version: registry/2.0
    Etag: "sha256:54614ea840252c4fea094e14f347dda8b4db076561b051bb4d493516d98c56e9"
    X-Content-Type-Options: nosniff
    Date: Tue, 20 Dec 2016 07:15:32 GMT
    
    $ curl -X DELETE http://localhost:5000/v2/lorenzo/ubuntu/manifests/sha256:54614ea840252c4fea094e14f347dda8b4db076561b051bb4d493516d98c56e9
    {"errors":[{"code":"MANIFEST_UNKNOWN","message":"manifest unknown"}]}
    

    Actually this time I did the test using a different VM: the old one was an Ubuntu 14.04 machine, this one is a 16.04. This means different docker versions (1.6 vs 1.12) and possibily different curl versions.
    Anyway, after reading this I was able to proceed; don't know why last time I didn't have to use the Accept:application/vnd.docker.distribution.manifest.v2+json header.

    $ curl -I -H Accept:application/vnd.docker.distribution.manifest.v2+json http://localhost:5000/v2/lorenzo/ubuntu/manifests/1.0
    HTTP/1.1 200 OK
    Content-Length: 1357
    Content-Type: application/vnd.docker.distribution.manifest.v2+json
    Docker-Content-Digest: sha256:7a64bc9c8843b0a8c8b8a7e4715b7615e4e1b0d8ca3c7e7a76ec8250899c397a
    Docker-Distribution-Api-Version: registry/2.0
    Etag: "sha256:7a64bc9c8843b0a8c8b8a7e4715b7615e4e1b0d8ca3c7e7a76ec8250899c397a"
    X-Content-Type-Options: nosniff
    Date: Tue, 20 Dec 2016 07:14:58 GMT
    
    $ curl -X DELETE http://localhost:5000/v2/lorenzo/ubuntu/manifests/sha256:7a64bc9c8843b0a8c8b8a7e4715b7615e4e1b0d8ca3c7e7a76ec8250899c397a
    
    $ curl -X GET http://localhost:5000/v2/lorenzo/ubuntu/manifests/1.0
    {"errors":[{"code":"MANIFEST_UNKNOWN","message":"manifest unknown","detail":{"Tag":"1.0"}}]}
    
    $ du -sh registry/
    49M	registry/
    
    $ tree registry/
    registry/
    └── docker
        └── registry
            └── v2
                ├── blobs
                │   └── sha256
                │       ├── 10
                │       │   └── 104bec311bcdfc882ea08fdd4f5417ecfb1976adea5a0c237e129c728cb7eada
                │       │       └── data
                │       ├── 4a
                │       │   └── 4a70713c436f2350e8a9f1c1e6c823290f331254c6c21d5657056499d8575608
                │       │       └── data
                │       ├── 4d
                │       │   └── 4daad8bdde31f5969d6a44800e993a911bed25853b2f89417b07ce7f0ac67714
                │       │       └── data
                │       ├── 63
                │       │   └── 63fe8c0068a811103c702452985368fc99014f83b5f0151cf631644f13f383b2
                │       │       └── data
                │       ├── 7a
                │       │   └── 7a64bc9c8843b0a8c8b8a7e4715b7615e4e1b0d8ca3c7e7a76ec8250899c397a
                │       │       └── data
                │       ├── a3
                │       │   └── a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4
                │       │       └── data
                │       ├── b3
                │       │   └── b3e1c725a85f0953e81815b7c7aabfad9ebfd90af53f99248981282b8045d787
                │       │       └── data
                │       └── bd
                │           └── bd842a2105a862f62ba4ad726531029be49046c290307e9c07a688c89f4606e6
                │               └── data
                └── repositories
                    └── lorenzo
                        └── ubuntu
                            ├── _layers
                            │   └── sha256
                            │       ├── 104bec311bcdfc882ea08fdd4f5417ecfb1976adea5a0c237e129c728cb7eada
                            │       │   └── link
                            │       ├── 4a70713c436f2350e8a9f1c1e6c823290f331254c6c21d5657056499d8575608
                            │       │   └── link
                            │       ├── 4daad8bdde31f5969d6a44800e993a911bed25853b2f89417b07ce7f0ac67714
                            │       │   └── link
                            │       ├── 63fe8c0068a811103c702452985368fc99014f83b5f0151cf631644f13f383b2
                            │       │   └── link
                            │       ├── a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4
                            │       │   └── link
                            │       ├── b3e1c725a85f0953e81815b7c7aabfad9ebfd90af53f99248981282b8045d787
                            │       │   └── link
                            │       └── bd842a2105a862f62ba4ad726531029be49046c290307e9c07a688c89f4606e6
                            │           └── link
                            ├── _manifests
                            │   ├── revisions
                            │   │   └── sha256
                            │   │       └── 7a64bc9c8843b0a8c8b8a7e4715b7615e4e1b0d8ca3c7e7a76ec8250899c397a
                            │   └── tags
                            └── _uploads
    
    39 directories, 15 files
    
    $ docker exec reg /bin/registry garbage-collect /etc/docker/registry/config.yml time="2016-12-20T07:21:35Z" level=info msg="Deleting blob: /docker/registry/v2/blobs/sha256/b3/b3e1c725a85f0953e81815b7c7aabfad9ebfd90af53f99248981282b8045d787" go.version=go1.6.3 instance.id=d76babff-5e68-4779-bc56-4fc91be31198
    time="2016-12-20T07:21:35Z" level=info msg="Deleting blob: /docker/registry/v2/blobs/sha256/bd/bd842a2105a862f62ba4ad726531029be49046c290307e9c07a688c89f4606e6" go.version=go1.6.3 instance.id=d76babff-5e68-4779-bc56-4fc91be31198
    time="2016-12-20T07:21:35Z" level=info msg="Deleting blob: /docker/registry/v2/blobs/sha256/10/104bec311bcdfc882ea08fdd4f5417ecfb1976adea5a0c237e129c728cb7eada" go.version=go1.6.3 instance.id=d76babff-5e68-4779-bc56-4fc91be31198
    time="2016-12-20T07:21:35Z" level=info msg="Deleting blob: /docker/registry/v2/blobs/sha256/4a/4a70713c436f2350e8a9f1c1e6c823290f331254c6c21d5657056499d8575608" go.version=go1.6.3 instance.id=d76babff-5e68-4779-bc56-4fc91be31198
    time="2016-12-20T07:21:35Z" level=info msg="Deleting blob: /docker/registry/v2/blobs/sha256/4d/4daad8bdde31f5969d6a44800e993a911bed25853b2f89417b07ce7f0ac67714" go.version=go1.6.3 instance.id=d76babff-5e68-4779-bc56-4fc91be31198
    time="2016-12-20T07:21:35Z" level=info msg="Deleting blob: /docker/registry/v2/blobs/sha256/63/63fe8c0068a811103c702452985368fc99014f83b5f0151cf631644f13f383b2" go.version=go1.6.3 instance.id=d76babff-5e68-4779-bc56-4fc91be31198
    time="2016-12-20T07:21:35Z" level=info msg="Deleting blob: /docker/registry/v2/blobs/sha256/7a/7a64bc9c8843b0a8c8b8a7e4715b7615e4e1b0d8ca3c7e7a76ec8250899c397a" go.version=go1.6.3 instance.id=d76babff-5e68-4779-bc56-4fc91be31198
    time="2016-12-20T07:21:35Z" level=info msg="Deleting blob: /docker/registry/v2/blobs/sha256/a3/a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4" go.version=go1.6.3 instance.id=d76babff-5e68-4779-bc56-4fc91be31198
    
    $ du -sh registry/
    156K	registry/
    
    $ tree registry/
    registry/
    └── docker
        └── registry
            └── v2
                ├── blobs
                │   └── sha256
                │       ├── 10
                │       ├── 4a
                │       ├── 4d
                │       ├── 63
                │       ├── 7a
                │       ├── a3
                │       ├── b3
                │       └── bd
                └── repositories
                    └── lorenzo
                        └── ubuntu
                            ├── _layers
                            │   └── sha256
                            │       ├── 104bec311bcdfc882ea08fdd4f5417ecfb1976adea5a0c237e129c728cb7eada
                            │       │   └── link
                            │       ├── 4a70713c436f2350e8a9f1c1e6c823290f331254c6c21d5657056499d8575608
                            │       │   └── link
                            │       ├── 4daad8bdde31f5969d6a44800e993a911bed25853b2f89417b07ce7f0ac67714
                            │       │   └── link
                            │       ├── 63fe8c0068a811103c702452985368fc99014f83b5f0151cf631644f13f383b2
                            │       │   └── link
                            │       ├── a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4
                            │       │   └── link
                            │       ├── b3e1c725a85f0953e81815b7c7aabfad9ebfd90af53f99248981282b8045d787
                            │       │   └── link
                            │       └── bd842a2105a862f62ba4ad726531029be49046c290307e9c07a688c89f4606e6
                            │           └── link
                            ├── _manifests
                            │   ├── revisions
                            │   │   └── sha256
                            │   │       └── 7a64bc9c8843b0a8c8b8a7e4715b7615e4e1b0d8ca3c7e7a76ec8250899c397a
                            │   └── tags
                            └── _uploads
    
    31 directories, 7 files
    
    $ docker tag ubuntu:latest localhost:5000/lorenzo/ubuntu:2.0
    
    $ docker push localhost:5000/lorenzo/ubuntu:2.0
    The push refers to a repository [localhost:5000/lorenzo/ubuntu]
    5972ebe5b524: Layer already exists
    3d515508d4eb: Layer already exists
    bbe6cef52379: Layer already exists
    87f743c24123: Layer already exists
    32d75bc97c41: Layer already exists
    2.0: digest: sha256:7a64bc9c8843b0a8c8b8a7e4715b7615e4e1b0d8ca3c7e7a76ec8250899c397a size: 1357
    

    It seems that nothing gets actually pushed to the registry; looks like the registry isn't aware of layer removal done by the garbage collector.

    $ du -sh registry/
    188K	registry/
    
    $ tree registry/
    registry/
    └── docker
        └── registry
            └── v2
                ├── blobs
                │   └── sha256
                │       ├── 10
                │       ├── 4a
                │       ├── 4d
                │       ├── 63
                │       ├── 7a
                │       ├── a3
                │       ├── b3
                │       └── bd
                └── repositories
                    └── lorenzo
                        └── ubuntu
                            ├── _layers
                            │   └── sha256
                            │       ├── 104bec311bcdfc882ea08fdd4f5417ecfb1976adea5a0c237e129c728cb7eada
                            │       │   └── link
                            │       ├── 4a70713c436f2350e8a9f1c1e6c823290f331254c6c21d5657056499d8575608
                            │       │   └── link
                            │       ├── 4daad8bdde31f5969d6a44800e993a911bed25853b2f89417b07ce7f0ac67714
                            │       │   └── link
                            │       ├── 63fe8c0068a811103c702452985368fc99014f83b5f0151cf631644f13f383b2
                            │       │   └── link
                            │       ├── a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4
                            │       │   └── link
                            │       ├── b3e1c725a85f0953e81815b7c7aabfad9ebfd90af53f99248981282b8045d787
                            │       │   └── link
                            │       └── bd842a2105a862f62ba4ad726531029be49046c290307e9c07a688c89f4606e6
                            │           └── link
                            ├── _manifests
                            │   ├── revisions
                            │   │   └── sha256
                            │   │       └── 7a64bc9c8843b0a8c8b8a7e4715b7615e4e1b0d8ca3c7e7a76ec8250899c397a
                            │   │           └── link
                            │   └── tags
                            │       └── 2.0
                            │           ├── current
                            │           │   └── link
                            │           └── index
                            │               └── sha256
                            │                   └── 7a64bc9c8843b0a8c8b8a7e4715b7615e4e1b0d8ca3c7e7a76ec8250899c397a
                            │                       └── link
                            └── _uploads
    
    36 directories, 10 files
    
    $ curl -X GET http://localhost:5000/v2/lorenzo/ubuntu/tags/list
    {"name":"lorenzo/ubuntu","tags":["2.0"]}
    

    At this point, judging from my first post, I was able to retrieve the manifest but not to delete it. This time I cannot even retrieve it.

    $ curl -X GET http://localhost:5000/v2/lorenzo/ubuntu/manifests/2.0
    {"errors":[{"code":"MANIFEST_UNKNOWN","message":"manifest unknown","detail":{"Name":"lorenzo/ubuntu","Revision":"sha256:7a64bc9c8843b0a8c8b8a7e4715b7615e4e1b0d8ca3c7e7a76ec8250899c397a"}}]}
    

    Hope this helps.

    Thank you,

    lorenzo

  5. stevvooe commented on Dec 21, 2016

    @stevvooe
    Collaborator

    @lorenzobenvenuti Looks like there is a bug in the gc implementation. The repository still has a bunch of links to blob content.

    If you delete repositories/lorenzo/ubuntu/_layers/sha256/*, does the last push work?

    @andrewnguyen @dmcgowan PTAL

  6. lorenzobenvenuti commented on Dec 21, 2016

    @lorenzobenvenuti
    Author

    Removing repositories/lorenzo/ubuntu/_layers/sha256/* doesn't help; I tried to repeat the above steps on a fresh registry and removed the sha256 directory content:

    $ sudo rm -rf registry/docker/registry/v2/repositories/lorenzo/ubuntu/_layers/sha256/*
    
    $ docker tag ubuntu:latest localhost:5000/lorenzo/ubuntu:2.0
    
    $ docker push localhost:5000/lorenzo/ubuntu:2.0
    The push refers to a repository [localhost:5000/lorenzo/ubuntu]
    5972ebe5b524: Layer already exists 
    3d515508d4eb: Layer already exists 
    bbe6cef52379: Layer already exists 
    87f743c24123: Layer already exists 
    32d75bc97c41: Layer already exists 
    2.0: digest: sha256:7a64bc9c8843b0a8c8b8a7e4715b7615e4e1b0d8ca3c7e7a76ec8250899c397a size: 1357
    
    $ du -sh registry/
    128K	registry/
    
    $ tree registry/
    registry/
    └── docker
        └── registry
            └── v2
                ├── blobs
                │   └── sha256
                │       ├── 10
                │       ├── 4a
                │       ├── 4d
                │       ├── 63
                │       ├── 7a
                │       ├── b3
                │       └── bd
                └── repositories
                    └── lorenzo
                        └── ubuntu
                            ├── _layers
                            │   └── sha256
                            ├── _manifests
                            │   ├── revisions
                            │   │   └── sha256
                            │   │       └── 7a64bc9c8843b0a8c8b8a7e4715b7615e4e1b0d8ca3c7e7a76ec8250899c397a
                            │   │           └── link
                            │   └── tags
                            │       └── 2.0
                            │           ├── current
                            │           │   └── link
                            │           └── index
                            │               └── sha256
                            │                   └── 7a64bc9c8843b0a8c8b8a7e4715b7615e4e1b0d8ca3c7e7a76ec8250899c397a
                            │                       └── link
                            └── _uploads
    
    28 directories, 3 files
    
    $ curl -X GET http://localhost:5000/v2/lorenzo/ubuntu/manifests/2.0
    {"errors":[{"code":"MANIFEST_UNKNOWN","message":"manifest unknown","detail":{"Name":"lorenzo/ubuntu","Revision":"sha256:7a64bc9c8843b0a8c8b8a7e4715b7615e4e1b0d8ca3c7e7a76ec8250899c397a"}}]}
    

    Let me know if I can help you further.

    lorenzo

  7. ehames commented on Dec 29, 2016

    @ehames

    @lorenzobenvenuti @stevvooe I was working on a cleanup script for one of my deployments and ran into this same issue:

    • push an image to an empty registry
    • clean up all layers
    • clean up the manifest for the image
    • run garbage collector
    • push same image again
    • pull image (fails!)

    Here is a gist to consistently reproduce it (once this issue is solved the last pull should succeed):
    https://gist.github.com/ehames/f904d81d7bc0554c3e602fad3f474808

    I have also uploaded the log:
    https://gist.github.com/ehames/99bb42ac946d9e97b265cdb9ee30693c

    I'm running the latest registry as of today
    registry latest 182810e6ba8c 27 hours ago 37.62 MB

  8. siju-vasudevan commented on Aug 31, 2017

    @siju-vasudevan

    Hello All ,

    I also faced similar kind of issue. I am using registry 2.5 backed by swift storage and using redis for caching. Issue occurs when I delete an image manifest digest and do garbage collection then when I try to push the same image to the registry, the push will get complete. But if you try to pull the same image from the registry you will get an error message saying that image not found. If you try to do a curl to get digest information for the same image you will get 404 error.

    After lots of debugging and testing found that the issue is with the caching layer or garbage collection is not updating the details in redis cache. After delete when you push the image the manifest digest layer is not getting uploaded to the backed and rest all the layers are getting uploaded.

    I logged into redis and checked for the keys . Found that all the keys are present including the deleted digest manifest layer.

    Next time i followed the below steps

    1. Issue curl command to delete the digest.
    2. Ran the registry in gc mode.
    3. logged into redis and removed the key associated with the digest.
    4. pushed the image. Image upload was successful and all the layers got uploaded.
      5 . pulled the image. Success.

    Hope this information will be useful for any one of you. Not sure whether GC process can also take care of updating the info in caching layer.

  9. added this to the milestone on Sep 1, 2017
  10. stevvooe commented on Sep 1, 2017

    @stevvooe
    Collaborator

    @siju-vasudevan Thanks for the analysis!

    It is very likely that this could be a cache invalidation issue. This would cause the registry to respond with "I have this blob" then have the pusher skip pushing that content.

    I've marked this with the 2.7 milestone and will look into a fix when I can. In the meantime, the workaround is to reset the cache after a GC run by clearing redis or restarting the registry, if you are using the inmemory cache.

  11. siju-vasudevan commented on Sep 1, 2017

    @siju-vasudevan

    HI Stephen,

    Thank you!

    From my analysis what i have found is that when you push the same image which you deleted registry is contacting redis . From the redis cache the information is not removed hence registry will get the information about the digest(200 ok). If the information is not available in the redis then you will get 404 error unknown blob and then the registry will try to push the digest data layer as well.

    Where as when 200 ok is received at that time registry is not pushing the digest manifest data layer but rest all data's are pushed.

    Kindly find the details below.

    1 . I pushed the hello-world image first and checked the swift backed. Could see 10 objects.
    2. After delete and gc process , i pushed the same image and found that one layer is missing, that is digest data layer.
    output2

    output1

    So basically when the registry gets the digest information from the redis, then it is ignoring the digest layer to upload.

    In real production environment clearing cache completely is not applicable.
    When performing delete operation we need to delete the digest key from the redis.

    Thanks,
    Siju

  12. stevvooe commented on Sep 1, 2017

    @stevvooe
    Collaborator

    In real production environment clearing cache completely is not applicable.

    Why not? The performance benefits of the cache here aren't great. Have you seen actual performance problems after clearing the cache?

  13. siju-vasudevan commented on Sep 6, 2017

    @siju-vasudevan

    Hi Stephan,

    We have seen slight performance problems while doing testing, it's not going to have a huge impact.

  14. 7 remaining items

  15. added
    priority/P1
    on Nov 8, 2018
  16. xs233 commented on Apr 18, 2019

    @xs233

    When to fix it?

  17. igcherkaev commented on Oct 3, 2019

    @igcherkaev

    This bug needs to be fixed ASAP.

  18. JakeMoh commented on Aug 15, 2020

    @JakeMoh

    The cache can be removed entirely . This solved my issue
    Capture

  19. removed this from the Registry/3.0.0 milestone on Jul 14, 2023
  20. aguidirh commented on Jul 31, 2024

    @aguidirh

    I am facing the same issue here.

    After deleting the images and running the garbage collector, trying to push the same images previously deleted won't work. Restarting the registry or disabling the cache is a temporary workaround I am using so far.

    Probably the cache should be updated after deleting/garbage collecting blobs in order to be aligned with the real content in the registry.

  21. binaryfire commented on Aug 2, 2025

    @binaryfire
    Contributor

    Does anyone know if this has been addressed in v3?

  22. commodis commented on Nov 16, 2026

    @commodis

    Does anyone know if this has been addressed in v3?

    I am experiencing the same problem on v3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugpriority/P1

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions