Pass a secret into the build without baking it into layers.
Section: Buildx Build Workflows
Pass build secret
bash
bash
docker buildx build --secret id=npmrc,src=$HOME/.npmrc -t myapp:dev .Explanation
A best practice for private package registries.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing Buildx Build Workflows
Forward SSH agent during build
Forward SSH credentials into the build for private Git access.
Build and load into local daemon
Build and load the result into the local Docker image store.