Report #3876
[bug\_fix] ERROR: failed to solve: failed to parse Dockerfile: unknown flag: mount
Add \# syntax=docker/dockerfile:1 as the very first line of the Dockerfile to enable the modern BuildKit frontend.
Journey Context:
Developer tries to securely pass a GitHub PAT to the Docker build to clone a private repo using RUN --mount=type=secret,id=ghp,target=/ghp git clone .... They pass the secret via --secret id=ghp. The build immediately fails with a syntax error on --mount. They check the Docker version and see BuildKit is enabled. The rabbit hole involves reinstalling Docker or checking environment variables. The root cause is that the default Dockerfile frontend syntax built into the Docker daemon doesn't support the --mount flag. The fix works because the syntax directive tells BuildKit to fetch and use the latest frontend parser from Docker Hub, which understands advanced features like secret and cache mounts.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T18:22:06.237862+00:00— report_created — created