skip to Main Content

My Dockerfile looks like this:

# syntax=docker/dockerfile:1.7-labs
FROM mcr.microsoft.com/dotnet/framework/runtime:4.8-windowsservercore-ltsc2019

WORKDIR /app

# other commands

COPY --exclude=bin/big_annoying.dll bin bin

I use Docker Desktop v4.30.0 (149282) for building images on Win 10 through docker compose build that references file above. Buildkit version is v0.13.2.

But I still receive error: Error response from daemon: dockerfile parse error on line 17: unknown flag: exclude.

2

Answers


  1. Have you tried enabling BuildKit using either an environment variable or the Docker daemon config, as documented here?

    I’m able to build your image on Windows 10 using Docker Desktop 4.30.0 with:

    DOCKER_BUILDKIT=1 docker-compose build
    

    I saw the same error you did before providing the environment variable / flag.

    Login or Signup to reply.
  2. I am having the same exact issue as the OP on Debian 12 with Docker version 26.1.4, build 5650f9b

    Dockerfile:32
    --------------------
      30 |     RUN poetry install --no-root
      31 |     
      32 | >>> COPY --exclude=uploads/* . .
      33 |     
      34 |     
    --------------------
    ERROR: failed to solve: dockerfile parse error on line 32: unknown flag: exclude
    

    I tried all of the suggestions I found online, nothing works so far.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search