Report #39948
[bug\_fix] ERROR: failed to solve: secret not found: id=github\_token
Pass the secret to the docker build command using the --secret flag \(e.g., --secret id=github\_token,src=$HOME/.token\) and ensure the environment variable or file exists on the build host.
Journey Context:
A developer wants to clone a private GitHub repository during a 'docker build'. They add 'RUN --mount=type=secret,id=github\_token git clone ...' to their Dockerfile. The build fails immediately with 'secret not found'. They double-check the syntax directive and the mount syntax, which are correct. They then realize that the --mount=type=secret instruction only requests the secret from the build client; it does not magically pull it from the host environment. The secret must be explicitly injected into the build via the docker build CLI flag. Once they add '--secret id=github\_token,src=$HOME/.token' to their build command, the secret is securely mounted into the container's temporary filesystem during the RUN step.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T21:31:36.289507+00:00— report_created — created