failed to solve with frontend dockerfile.v0: failed to read dockerfile?

I am new to Docker and i am trying to create an image from my application, i created Dockerfile in the same directory with package.json file with no extension, just Dockerfile

Now in Dockerfile:

FROM node:14.16.0
CMD ["/bin/bash"]

and i am trying to build the image with that command

docker build -t app .

But i got this constant error:

[+] Building 0.2s (2/2) FINISHED
 => [internal] load build definition from Dockerfile                                                           0.2s 
 => => transferring dockerfile: 2B                                                                             0.0s 
 => CANCELED [internal] load .dockerignore                                                                     0.0s 
 => => transferring context:                                                                                   0.0s
failed to solve with frontend dockerfile.v0: failed to read dockerfile: open /var/lib/docker/tmp/buildkit-mount457647683/Dockerfile: no such file or directory

My folder directory is like this:

   |- Dockerfile
   |- README.md
   |- src
   |- package.json
   |- public
   |- node-modules
   |-package-lock.json

My OS is : Windows 10 Pro


Solution 1:

Double check that you are in the right directory. I was in downloads/app

When I downloaded the app from Docker as part of their tutorial, I extracted it and it ended up in downloads/app**/app** Type dir in your terminal to see if you can see dockerfile or another folder called app.

Solution 2:

In windows when the Dockerfile is in .txt format I got this error. changing it to type "file" fixed the issue.

Solution 3:

I encountered a different issue, so sharing as an FYI. On Windows, I created the docker file as DockerFile instead of Dockerfile. The capital F messed things up.