In my case, this was because of the under-expressed use cases from documents. Almost all examples tell you to use .
and Dockerfile
(capital D), but they mostly do not tell explicitly how to customize.
docker image build --tag any_image_tag --file any_file_name path_to_your_context_folder
This one is better in my opinion, and I hope it will help those coming here. any_file_name
is really any file name with build instructions in it. "dockerfile" in it is not needed, but it helps to identify and give the full path if it differs from the context folder. path_to_your_context_folder
is basically where your work resides, such as a web application.
For example, the following is my current test in windows where COPY . /app
uses the context folder as the .
:
docker image build --tag nested_image --file C:\WorkSpace\myapp\dockerfiles\any_file_name C:\WorkSpace\myapp\contextfiles\
PS: The topic really has interesting answers to the same problem, but by lots of exotic causes. Mine is just a side note to a hidden-in-plain-sight problem.
build
>context
option is set to./
or something meaningful. I was getting this error because I had inadvertently typed..
there. – Deedradeeds