Skip to content

Docker

Cache mount

Quick answer

A cache mount is a BuildKit feature that persists a directory across builds without including it in the resulting image layer.

A cache mount is a BuildKit feature that persists a directory across builds without including it in the resulting image layer.

Why it matters

It is the correct way to cache package manager directories inside a Dockerfile — the download cache survives, but it never bloats the shipped image.

Your next build could be twice as fast, at half the price

Start free. Migrating away is the same one line, and we publish that diff too.