Notes on caching Docker layers in CircleCI

I’ve been playing with Docker layer caching on the free tier, and have written up some strategies I tried. There is an out-of-the-box cache device in CircleCI available to paid users, for an extra fee, but with a bit of extra work, anyone can have access to faster builds. My article is fairly discursive, since the kind of caching that is preferred will vary from one project/team to another.

Long story short, it is my opinion that using an external registry was more effective than using the CircleCI caching device, since the cache is always kept up-to-date.

I am inclined to make some tweaks to my current config. In particular, it would be good to scan the registry to check the age of the latest image, and if it is more than (say) five days old, force the build to not use the cache. That will probably be the subject of another post…

2 Likes

Very nice, thanks for sharing!

1 Like

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