Report #8783
[bug\_fix] ERROR: failed to solve: secret not found: id=
Ensure BuildKit is used \(default in modern Docker\) and pass the secret explicitly via the docker build command using --secret id=,src=.
Journey Context:
A developer tries to securely pass a GitHub PAT or npm token into a Docker build using RUN --mount=type=secret,id=git\_token .... The build fails immediately with 'secret not found'. They check the Dockerfile syntax, which is correct. They then realize that unlike environment variables, BuildKit secrets are not automatically injected from the host environment or files. The secret must be explicitly mounted into the build via the CLI flag --secret. They update their build script to docker build --secret id=git\_token,src=$HOME/.gitconfig . and the build succeeds, keeping the token out of the image history and cache.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T06:22:43.417526+00:00— report_created — created