docker buildx build --cache-from type=local,src=/tmp/cache --cache-to type=local,dest=/tmp/cache .

Category: Docker

docker buildx build --cache-from type=local,src=/tmp/cache --cache-to type=local,dest=/tmp/cache .

Cache build layers in a local directory

The local cache type writes BuildKit layers to a directory you control, handy when no registry or CI cache service exists. Point --cache-from at the directory a previous run filled via --cache-to to warm the next build. Combine with type=registry when a registry is available.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.