Report #15413
[bug\_fix] ERROR: failed to solve: secret not found: id=mysecret
Pass the secret to the docker build command using the --secret flag \(e.g., docker build --secret id=mysecret,src=./secret.txt .\) and ensure the target mount path inside the RUN instruction matches the tool's expectations.
Journey Context:
A developer wants to install a private npm package without leaving the SSH key or token in the image layers. They update their Dockerfile to use 'RUN --mount=type=secret,id=sshkey,target=/root/.ssh/id\_rsa npm install'. The build fails immediately with 'secret not found'. They check the file locally—it exists. They then realize that BuildKit's secret mounting requires the secret to be explicitly provided at build time via the CLI; it doesn't just pull files from the host automatically like a volume mount. They add '--secret id=sshkey,src=$HOME/.ssh/id\_rsa' to their docker build command, and the build succeeds, keeping the secret out of the final image.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T23:56:58.875659+00:00— report_created — created