Entire docker image being pushed after every build


After running tests, I am building the container images to get deployed.
At this stage Circle once again grabs images that might already be present in the containerInfo section (I did not see any caching here for successive builds either) and after the containers get built, is pushing all the layers of the new container image to the google cloud container registry. Normally the delta layers are only 10s of MB but this causes Circle to upload two orders of magnitude data. This full download, build, full upload also takes upward of 9mins per build. Is this expected functionality?


Without layer caching, yes, that is expected.


Gotcha - thanks! Guess I need to get access to the layer caching alpha/beta


We haven’t announced anything about this just yet, but stay tuned!


@Eric is that in reference to perhaps caching image layers between builds? Because I would LOVE to know about that functionality as soon as it’s available!


Yep. I think the best place to get notifications about this will be to subscribe to the 2.0 top level category here on Discuss:

The first and third entry (watching, watching first post) will do this for you. I’m not sure about Tracking.

You’ll want to set this at: https://discuss.circleci.com/c/circleci-2-0



I was just about to post exactly this question and found this thread. This may be more of a Docker question than a Circle one, but can you please clarify why this requires client (Circle) side layer caching? I was under the impression that, since Docker knows the id/hash of the layers I’m pushing, it could detect that the layer already exists in the remote repository being pushed to (in my case also Google Container Registry, using v2).

When pushing images locally under otherwise exactly the same conditions, I get “Layer already exists” for the base layers as expected, but on Circle I instead get a message “Mounted from …” when pushing multiple images in one build and there’s an overlap in the base images used.



Hi Kristian, can you please DM me a link to example builds where you see this behavior?


You will see exactly that functionality without caching your layers locally.


To confirm, you’re saying that the behaviour I’m seeing is expected, i.e. full layer upload even when it is already present in the remote repository?


That is correct. When using a cache, Docker already knows if it’s uploaded. Without it, it will attempt the upload again and mount from elsewhere when possible.


That is in line with the observed behaviour but appears to redundant. Digging around a bit, I suspect this relates to https://github.com/docker/docker/issues/18924. While this is related to Docker and not really CircleCi, can you confirm that if the above issues was fixed, the behaviour would be as I expected (even without cache)?


Probably? I can’t really say definitively either way.