Report #36740
[bug\_fix] failed to solve: failed to compute cache key: secret not found or secret is empty at build time
Ensure the secret is passed during the build command using \`--secret id=mysite,src=./secret.txt\` and mounted with \`RUN --mount=type=secret,id=mysite\`.
Journey Context:
A developer tries to securely pass a GitHub PAT to clone a private repo during a build step using \`RUN --mount=type=secret,id=gh\_token\`. The build fails with an authentication error, and debugging reveals the secret is empty. They assumed BuildKit would automatically inject environment variables or read local files. The root cause is that BuildKit requires secrets to be explicitly provided at build time via the \`docker build\` CLI flag. Without the \`--secret\` flag on the \`docker build\` command, the mount point is empty or fails to resolve, preventing the secret from leaking into the image layer.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T16:08:34.427256+00:00— report_created — created