I pulled an image from my private registry (running
registry:2 from Hub), then immediately pushed it again. I expected to see “Layer already exists” for all layers, but one of the layers re-pushed:
$ docker pull my-private-repo.redacted.com/my-image:1.0.0 1.0.0: Pulling from my-image Digest: sha256:4d61fd5419960151dc37a3fa4ba0e0a8236de2f816cbaf7445c550938e1d1b1b Status: Image is up to date for my-private-repo.redacted.com/my-image:1.0.0 $ docker push my-private-repo.redacted.com/my-image:1.0.0 The push refers to a repository [my-private-repo.redacted.com/my-image] 72766d235de7: Layer already exists 694887710c2a: Layer already exists 8b53afdf0fad: Layer already exists 5404de47124a: Layer already exists 8c86c772e7b9: Pushing [==> ] 15.82MB/270.4MB 5a5b72363265: Layer already exists c7b3a0504d15: Layer already exists 9382c870b5a0: Layer already exists
I’m the only user of the repo.
The image in question was originally built and pushed to the registry from a Linux machine:
Client: Version: 17.06.2-ce API version: 1.30 Go version: go1.8.3 Git commit: cec0b72 Built: Tue Sep 5 20:00:17 2017 OS/Arch: linux/amd64 Server: Version: 17.06.2-ce API version: 1.30 (minimum version 1.12) Go version: go1.8.3 Git commit: cec0b72 Built: Tue Sep 5 19:59:11 2017 OS/Arch: linux/amd64 Experimental: false
I then pulled and pushed the image from a Mac
Client: Version: 17.06.0-ce API version: 1.30 Go version: go1.8.3 Git commit: 02c1d87 Built: Fri Jun 23 21:31:53 2017 OS/Arch: darwin/amd64 Server: Version: 17.06.0-ce API version: 1.30 (minimum version 1.12) Go version: go1.8.3 Git commit: 02c1d87 Built: Fri Jun 23 21:51:55 2017 OS/Arch: linux/amd64 Experimental: true
Why does Docker upload pre-existing images? The image layers are the same.