This appears to be a specific Docker feature which treats Dockerfile
differently when it’s ignored. From the docs:
You can even use the
.dockerignore
file to exclude theDockerfile
and.dockerignore
files. These files are still sent to the daemon because it needs them to do its job. But theADD
andCOPY
instructions do not copy them to the image.
The Docker daemon running on our remote hosts needs the Dockerfile to run the build against the uploaded context. But it should not show up in the final image. Docker doesn’t appear to support this feature using a filename other than Dockerfile
.