If you use STDIN or specify a URL pointing to a plain text file, the system places the contents into a file called Dockerfile, and any -f, --file option is ignored.

papering / 2023-06-01 / 原文

docker build | Docker Documentation https://docs.docker.com/engine/reference/commandline/build/

In most cases, it’s best to put each Dockerfile in an empty directory.