Unexpected `CopyIgnoredFile` warning
Description
We started to see CopyIgnoredFile warning since recent for COPY . .
This is a neat shortcut to copy everyting included, given your dockerignore contains something like
/*
!/some
Reproduce
docker build .
Expected behavior
No response
docker version
$ docker version
Client: Docker Engine - Community
Version: 29.2.0
API version: 1.53
Go version: go1.25.6
Git commit: 0b9d198
Built: Mon Jan 26 19:27:07 2026
OS/Arch: linux/amd64
Context: default
Server: Docker Engine - Community
Engine:
Version: 29.2.0
API version: 1.53 (minimum version 1.44)
Go version: go1.25.6
Git commit: 9c62384
Built: Mon Jan 26 19:27:07 2026
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: v2.2.1
GitCommit: dea7da592f5d1d2b7755e3a161be07f43fad8f75
runc:
Version: 1.3.4
GitCommit: v1.3.4-0-gd6d73eb8
docker-init:
Version: 0.19.0
GitCommit: de40ad0
docker info
$ docker info
Client: Docker Engine - Community
Version: 29.2.0
Context: default
Debug Mode: false
Plugins:
buildx: Docker Buildx (Docker Inc.)
Version: v0.31.1
Path: /usr/libexec/docker/cli-plugins/docker-buildx
compose: Docker Compose (Docker Inc.)
Version: v5.0.2
Path: /usr/libexec/docker/cli-plugins/docker-compose
Server:
Containers: 7
Running: 5
Paused: 0
Stopped: 2
Images: 65
Server Version: 29.2.0
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Using metacopy: false
Native Overlay Diff: true
userxattr: false
Logging Driver: json-file
Cgroup Driver: systemd
Cgroup Version: 2
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
CDI spec directories:
/etc/cdi
/var/run/cdi
Swarm: inactive
Runtimes: io.containerd.runc.v2 runc
Default Runtime: runc
Init Binary: docker-init
containerd version: dea7da592f5d1d2b7755e3a161be07f43fad8f75
runc version: v1.3.4-0-gd6d73eb8
init version: de40ad0
Security Options:
apparmor
seccomp
Profile: builtin
cgroupns
Kernel Version: 6.14.0-37-generic
Operating System: Ubuntu 24.04.3 LTS
OSType: linux
Architecture: x86_64
CPUs: 12
Total Memory: 15.29GiB
Name: roland
ID: d25654b8-8a03-41f4-832e-ca0958fec624
Docker Root Dir: /var/lib/docker
Debug Mode: false
Username: etriasnl
Experimental: false
Insecure Registries:
::1/128
127.0.0.0/8
Live Restore Enabled: false
Additional Info
No response
The fix for this issue was merged in moby/buildkit#6356 on November 13, 2025, but it's not yet in any official Docker release. Docker Engine 29.2.0 uses BuildKit v0.27.0, Just wait for the update. This issue is not related to CLI either
Looking at https://github.com/moby/buildkit/pull/6356, I see it's part of BuildKit v0.27.0, which is used by Docker 29.2, so I think it's the reverse and that PR to have introduced the problem, not solved it.
The change in behavior is in the Dockerfile frontend https://github.com/moby/buildkit/commit/143a046f6230fbb0a8e840daacf92d9b77b3cdfc, so the parsing used for the Dockerfile, and part of dockerfile v1.21.0
mkdir test && cd test
cat > .dockerignore <<'EOF'
/*
!/some
EOF
cat > Dockerfile <<'EOF'
FROM scratch
COPY . .
EOF
With the above, I get the warning:
docker build --no-cache .
# ...
# => => unpacking to moby-dangling@sha256:ff039ba2427511592c8627270aca2b70975589bf58a46d25e12a837f437a14 0.0s
#
# 1 warning found (use docker --debug to expand):
# - CopyIgnoredFile: Attempting to Copy file "." that is excluded by .dockerignore (line 2)
Updating the Dockerfile to use the previous (v1.20.0) syntax;
cat > Dockerfile <<'EOF'
# syntax=docker/dockerfile:1.20.0
FROM scratch
COPY . .
EOF
Doesn't produce the warning;
docker build --no-cache .
# ...
# => => unpacking to moby-dangling@sha256:436b8636ddbcfeeff19131f2a420ee1222441f1471e54a55ad0b8d90ee21ff 0.0s
In general, I wouldn't recommend pinning to an older version of the syntax, but it's a possible workaround if this is causing issues.
Looks like a ticket was opened in the BuildKit repository as well, so let me mark this as duplicate;
- https://github.com/moby/buildkit/issues/6512