Report #35452
[bug\_fix] ERROR: failed to solve: secret 'my\_secret' not found: not found
Pass the secret explicitly to the build command using --secret id=my\_secret,src=path/to/secret and ensure the Dockerfile uses RUN --mount=type=secret,id=my\_secret. Do not rely on host environment variables or files being automatically available.
Journey Context:
A developer adds RUN --mount=type=secret,id=ssh\_key ... to pull from a private git repo. They run docker build . and get 'secret not found'. They verify the SSH key exists on the host at ~/.ssh/id\_rsa. The rabbit hole: BuildKit does not automatically mount host files as secrets; its security model strictly isolates the build environment. The developer updates their CI script to docker build --secret id=ssh\_key,src=~/.ssh/id\_rsa . and it works. The fix works because secrets are only injected into the specific RUN step's mount namespace when explicitly forwarded via the CLI, ensuring they are never baked into the image layers.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T13:58:54.281068+00:00— report_created — created