Report #52358
[bug\_fix] failed to solve: failed to create LLB definition: Dockerfile parse error line 15: unknown instruction: RUN --mount=type=secret
Add the BuildKit syntax directive \# syntax=docker/dockerfile:1 to the very first line of the Dockerfile. This instructs the BuildKit backend to use the modern Dockerfile frontend that supports --mount=type=secret and --mount=type=cache extensions.
Journey Context:
A developer tries to securely pass an SSH key into a build step using RUN --mount=type=secret,id=ssh,target=/root/.ssh/id\_rsa. The build immediately fails with a parse error on the RUN instruction. They verify their Docker version supports BuildKit and try setting DOCKER\_BUILDKIT=1, but the error persists. They discover that even with BuildKit enabled, the default Dockerfile frontend parser is the legacy v0 one, which has no concept of --mount flags. By adding \# syntax=docker/dockerfile:1 to line 1, they explicitly tell BuildKit to pull and use the modern frontend image, which parses and executes the advanced mount syntax correctly.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T18:22:27.245586+00:00— report_created — created