I have a docker pipelines script that ends with
- docker login --username $DOCKER_HUB_USERNAME --password $DOCKER_HUB_PASSWORD <our-private-repo> - docker push $IMAGE
However, it looks like docker pushes images that are already present in the repository. I get the following output. This takes quite a bit of time as these layers are large.
b92ae2c28af1: Preparing 7bb9bf8c293d: Preparing 2939806abd05: Preparing eb84ae861586: Preparing 227d94b074c0: Preparing 066828d986f0: Preparing daa6e91e491c: Preparing 6b60013e5875: Preparing d6335a641f5e: Preparing 5c33df241050: Preparing ffc4c11463ee: Preparing daa6e91e491c: Waiting 6b60013e5875: Waiting d6335a641f5e: Waiting 066828d986f0: Waiting ffc4c11463ee: Waiting 7bb9bf8c293d: Pushed b92ae2c28af1: Pushed eb84ae861586: Pushed daa6e91e491c: Pushed 066828d986f0: Pushed 227d94b074c0: Pushed 5c33df241050: Pushed d6335a641f5e: Pushed ffc4c11463ee: Pushed 2939806abd05: Pushed 6b60013e5875: Pushed
When I do the exact same command on my own machine (Docker version 17.12.0-ce, build c97c6d6) I get the following (i.e. only the newly built last layer is actually being pushed. The id:s of the previous layers are the same for each build, but somehow the pipelines docker push does not recognize that the layers have already been pushed (by a previous build).
3133fd13fb37: Pushed 7bb9bf8c293d: Layer already exists 2939806abd05: Layer already exists eb84ae861586: Layer already exists 227d94b074c0: Layer already exists 066828d986f0: Layer already exists daa6e91e491c: Layer already exists 6b60013e5875: Layer already exists d6335a641f5e: Layer already exists 5c33df241050: Layer already exists ffc4c11463ee: Layer already exists
Our repository is using the
registry:2 image of the docker registry.