Docker Image not getting cached


I use a docker image to start my circle containers. I created a docker image with a bunch of stuff that I always need and pushed it up to dockerhub. However, it turns out that in most builds, Circle still downloads the image again, instead of using the cached version. Also, the time to download the image keeps varying from anywhere between 2-15 mins.

This adds a lot of lag to our builds and is very frustrating. Any idea why the image is not being pulled from the cache every single time?


Although my “Spin Up Environment” step was much shorter than yours, I still tackled it by
a) Moving to workflows (for a variety of reasons)
b) Using special purpose docker images for different builds (moved away from the swiss army knife - 2 custom images, 2 off the shelf images for 8 builds in the workflow)
c) Based my images on circle’s default images (e.g. FROM circleci/ruby:2.3) theorizing the common layers underneath would be cached more often.

In practice, it’s moved from ~30s to ~10-15s per container start, 1-2s if my image is fully cached.

Otherwise, cutting down docker image size was the key. I found the insistence on removing intermediate files on each layer verify useful, as well docker history <imagetag> to see where space was coming from.


This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.