Mike3355
Mike3355

Reputation: 12081

\Dockerfile: The system cannot find the file specified

I have created a docker file to use node.js and nginx. When I run docker -t build <my docker file name> . I get the following error:

Dockerfile: The system cannot find the file specified.

Then in the docker file directory I created a folder name web and place my index.html and style.css file in it.

Question is: Any idea why I am getting this error?

Upvotes: 12

Views: 33100

Answers (2)

chilifan
chilifan

Reputation: 185

I ran into the same problem, which wasn't solved by the previous answer. For me, the problem was that my dockerfile (named Dockerfile for convention) was accidentally saved as a .txt file instead of whatever extension docker has. It was hard do notice because my computer was set to not show file endings, and the file icon was still the whale in the docker icon. Creating a dockerfile instead of a txtfile solved the issue.

Upvotes: 0

yamenk
yamenk

Reputation: 51738

The command docker -t build <my docker file name> . is being misused. It should be:

docker build -t <image-name> -f dockerFile .

where dockerFile is the name you gave to the Dockerfile.

The -t option specifies the tag or name to give to the Docker image.

The -f must be used, if you name the Dockerfile something other than Dockerfile

The . specifies the docker build context.

Upvotes: 12

Related Questions