What is Docker layer caching based on?



Just debugged a tricky build failure in which the reusable key of setup_docker_remote prevented a newer version of an image from being pulled.

We’ve a base image called alpine-ruby:2.4 that previously used Ruby 2.4.3, but was recently updated to use Ruby 2.4.4.

Our CircleCI build, however, continued to use the 2.4.3 Ruby version of alpine-ruby:2.4 despite a newer version using Ruby 2.4.4 being available. This led to a head-scratching

Your Ruby version is 2.4.3, but your Gemfile specified 2.4.4

B/c running the image locally showed Ruby 2.4.4.

Seems that caching is based on tags instead of hashes? Or maybe this is only for the base image? :confused:.

In any case, this seems like a pretty severe drawback of Docker layer caching. Or maybe we’re not using it correctly?


It may not be instant but the build servers do pull newer versions of the same tag from Docker Hub.

Personally, my suggestion would be that if the full SemVer version of Ruby is specified in your Gemfile, I would set that for the image name as well as .circleci/config.yml. See related blog post.


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