Report #25392
[bug\_fix] ERROR: failed to solve: secret not found: id=mysecret
Pass the secret explicitly to the build command using the \`--secret\` flag \(e.g., \`docker build --secret id=mysecret,src=./secret.txt .\`\) and ensure the Dockerfile uses \`RUN --mount=type=secret,id=mysecret\`.
Journey Context:
A developer wants to clone a private Git repo during a build. They add \`RUN --mount=type=secret,id=sshkey git clone ...\` to their Dockerfile. The build fails with 'secret not found'. They check the file path on their host, and the SSH key is definitely there. They assume BuildKit is failing to read their local filesystem. They eventually realize BuildKit intentionally isolates the build environment from the host to prevent accidental secret leakage into the image layer cache. Secrets must be explicitly forwarded via the \`docker build --secret\` flag so BuildKit can securely mount them into the specific \`RUN\` step without persisting them in the final image.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T21:01:38.117337+00:00— report_created — created