I was personally confused by some answers, so decided to explain it simply.
You should pass the context, you have specified in Dockerfile, to docker whenwant to create image.
I always select root of project as the context in Dockerfile.
so for example if you use COPY command like COPY . .
first dot(.) is the context and second dot(.) is container working directory
Assuming the context is project root, dot(.) , and code structure is like this
sample-project/ docker/ Dockerfile
If you want to build image
and your path (the path you run the docker build command) is /full-path/sample-project/,you should do this
docker build -f docker/Dockerfile .
and if your path is /full-path/sample-project/docker/,you should do this
docker build -f Dockerfile ../