Docker "COPY --chmod not supported" (old syntax) in CI
COPY --chmod and ADD --chmod set file permissions during the copy, but the flag only exists under BuildKit with a modern Dockerfile frontend. Building with the legacy classic builder, or pinning an old # syntax= frontend, rejects the flag.
What this error means
A build fails at a COPY --chmod=... line with the parser reporting --chmod as unknown, or that it requires BuildKit.
docker
Error response from daemon: the --chmod option requires BuildKit. Refer to https://docs.docker.com/go/buildkit/ to build images with BuildKit enabledCommon causes
The classic (non-BuildKit) builder is in use
DOCKER_BUILDKIT=0 or an old daemon falls back to the legacy builder, which never learned --chmod.
A pinned old Dockerfile frontend
A # syntax=docker/dockerfile:1.0 line uses a frontend that predates the --chmod flag.
How to fix it
Enable BuildKit and a current frontend
- Set
DOCKER_BUILDKIT=1(or usedocker buildx build). - Pin a recent
# syntax=docker/dockerfile:1line.
Dockerfile
# syntax=docker/dockerfile:1
FROM alpine:3.20
COPY --chmod=755 entrypoint.sh /usr/local/bin/entrypoint.shSet permissions with a RUN chmod instead
- If you cannot enable BuildKit, COPY the file then chmod it.
- This works on the classic builder too.
Dockerfile
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
RUN chmod 755 /usr/local/bin/entrypoint.shHow to prevent it
- Keep
DOCKER_BUILDKIT=1in CI so modern COPY flags work. - Pin
# syntax=docker/dockerfile:1rather than an old frontend tag.
Related guides
Docker "the --mount option requires BuildKit" - Enable BuildKit in CIFix Docker "the --mount option requires BuildKit" in CI - RUN --mount cache/secret syntax used while the lega…
Docker "failed to solve: dockerfile.v0: not found" in CIFix the Docker BuildKit "failed to solve with frontend dockerfile.v0: failed to read dockerfile" error in CI,…
Docker "COPY --chown ... invalid user" - Fix Unknown User/Group in BuildsFix Docker "COPY --chown=appuser: invalid user" / "unable to find user" in CI - referencing a user or group t…