Secret mount during build buildkit
Use a secret file in one RUN without baking it into any layer; pair with --secret
RUN --mount=type=secret,id=npmrc,target=/root/.npmrc npm ci
more buildkit
all 4 commands →
SSH forward for private repos
docker buildx build --ssh default -t <name> . # Dockerfile: RUN --mount=type=ssh git clone git@host:repo
Registry build cache
docker buildx build --cache-to type=registry,ref=<reg>/cache,mode=max --cache-from type=registry,ref=<reg>/cache -t <reg>/<name> --push .
Persistent cache mount in RUN
RUN --mount=type=cache,target=/root/.cache/pip pip install -r requirements.txt