Registry build cache buildkit
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 .
more buildkit
all 4 commands →
Persistent cache mount in RUN
RUN --mount=type=cache,target=/root/.cache/pip pip install -r requirements.txt
Secret mount during build
RUN --mount=type=secret,id=npmrc,target=/root/.npmrc npm ci
SSH forward for private repos
docker buildx build --ssh default -t <name> . # Dockerfile: RUN --mount=type=ssh git clone git@host:repo