SSH forward for private repos buildkit
Forward host SSH agent into build to clone private git; key never enters the image
docker buildx build --ssh default -t <name> . # Dockerfile: RUN --mount=type=ssh git clone git@host:repo
more buildkit
all 4 commands →
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
Secret mount during build
RUN --mount=type=secret,id=npmrc,target=/root/.npmrc npm ci