In a Dockerfile, I have
COPY . .
I want to exclude an entire directory, in my case, node_modules directory.
Something like this:
FOR A ONE LINER SOLUTION, type the following in Command prompt or Terminal at project root.
echo node_modules > .dockerignore
This creates the extension-less . prefixed file without any issue. Replace node_modules with the folder you want to exclude.