The Dockerfile is outside the build context
Commonbuild.dockerfile points at a file outside build.context: an absolute path, a ../ path, or the temporary Dockerfile-with-features that Dev Containers generate. Compose does not grant fs.read for it, and Buildx 0.37.2 enforces the check.
Confirm
docker compose config | grep -nE 'context:|dockerfile:' docker buildx version
A dockerfile: path that is not inside its context:, with Buildx v0.37.2 or later
Fix
- Move the Dockerfile inside the build context and make dockerfile: a path relative to it. This needs no permission at all.
- If you cannot (Dev Containers generate the file), run that one build with the check off: BUILDX_BAKE_ENTITLEMENTS_FS=0 docker compose build. Only for a project you trust.
- Upgrade Compose to the first release that includes #14325 when it ships, and drop the variable.
BUILDX_BAKE_ENTITLEMENTS_FS=0 docker compose build
Trusted projects only, for one command. It turns off a security check.