Registry build cache
Persist full layer cache in a registry for CI; mode=max caches intermediate stages
docker buildx build --cache-to type=registry,ref=<reg>/cache,mode=max --cache-from type=registry,ref=<reg>/cache -t <reg>/<name> --push .
- tool
- buildkit4 commands
More buildkit commands
-
RUN --mount=type=cache,target=/root/.cache/pip pip install -r requirements.txtReuse package cache across builds without bloating layers; survives between runs
-
RUN --mount=type=secret,id=npmrc,target=/root/.npmrc npm ciUse a secret file in one RUN without baking it into any layer; pair with --secret
-
docker buildx build --ssh default -t <name> . # Dockerfile: RUN --mount=type=ssh git clone git@host:repoForward host SSH agent into build to clone private git; key never enters the image