Report #3187
[bug\_fix] the --mount option requires BuildKit or secret file /run/secrets/ not found during a RUN instruction.
Use BuildKit \(\`DOCKER\_BUILDKIT=1\` or \`docker buildx build\`\), declare \`RUN --mount=type=secret,id=mysecret,target=/run/secrets/mysecret ...\`, and pass the secret at build time with \`--secret id=mysecret,src=./secret.txt\` or \`--secret id=mysecret,env=MYSECRET\`.
Journey Context:
You add \`RUN --mount=type=secret,id=npmrc,target=/root/.npmrc npm ci\` to keep \`.npmrc\` out of the final image. The legacy builder rejects the mount syntax, and even with BuildKit the build fails because no secret was supplied. You switch to \`docker buildx build\` and add \`--secret id=npmrc,src=$HOME/.npmrc\`. The file appears only during that RUN and is never committed to a layer or the final image, satisfying both credential safety and reproducibility.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T15:39:44.610256+00:00— report_created — created