Using docker buildkit "RUN --mount=type=cache" and saving cache across runs

Hi. I run docker builds with DOCKER_BUILDKIT=1 and want to use RUN --mount=type=cache on my pip install step in the Dockerfile, and of course keep the cached result across CircleCI runs. But docker does not make this cache available in the host filesystem (or at least does not document where it lives) … so is there a way in CircleCI to save_cache and restore_cache to maintain such a cache across runs?

4 Likes

I don’t think this is possible today in CircleCI. Controlling mount=type=cache host location is something being discussed in BuildKit, though. Allow controlling cache mounts storage location · Issue #1512 · moby/buildkit · GitHub