Report #78817
[bug\_fix] ERROR: failed to solve: secret not found: id=MY\_SECRET or build step fails with authentication errors despite secret mount syntax.
Pass the secret explicitly to the build command using \`--secret id=MY\_SECRET,src=path/to/secret\` \(e.g., \`docker build --secret id=ssh\_key,src=~/.ssh/id\_rsa .\`\).
Journey Context:
A developer wants to clone a private Git repository during a Docker build. They update their Dockerfile to use BuildKit's secret mounting: \`RUN --mount=type=secret,id=ssh\_key,target=/root/.ssh/id\_rsa git clone [email protected]:org/repo.git\`. The build fails with a Git permission denied error, or throws 'secret not found'. They spend hours checking file permissions on their host SSH key, trying to use SSH agents, and assuming the \`target\` path is wrong. The root cause is that BuildKit strictly isolates secrets; defining the mount in the Dockerfile is only half the equation. The build client must explicitly authorize and pass the secret from the host to the BuildKit daemon at build time. Without the \`--secret\` flag in the \`docker build\` command, BuildKit refuses to inject the host file into the build environment.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T14:53:09.295811+00:00— report_created — created