Report #84362
[bug\_fix] ERROR: failed to solve: secret 'mysecret' not found: not found
Pass the secret explicitly to the docker build command using --secret id=mysecret,src=path/to/secret and ensure DOCKER\_BUILDKIT=1 is set if using an older Docker CLI.
Journey Context:
A developer wants to clone a private Git repository inside a Dockerfile. They update the Dockerfile to use RUN --mount=type=secret,id=gitcreds git clone .... The build immediately fails with 'secret not found'. They assume the syntax is wrong or the file path is incorrect. They spend hours tweaking the id and target paths. The missing piece is that BuildKit does not automatically inject host files as secrets; they must be explicitly provided at build time via the docker build command. The --mount instruction only declares an expectation of a secret. The fix requires appending --secret id=gitcreds,src=$HOME/.git-credentials to the docker build command to actually inject the host file into the build sandbox.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T00:11:42.037015+00:00— report_created — created