dockerdocker-composedockerfile

Failed to solve with frontend Dockerfile


I am pretty new to Docker and am trying to build a Docker image with plain HTML, but I have this error message, saying

failed to solve with frontend dockerfile.v0: failed to read dockerfile: open /var/lib/docker/tmp/buildkit-mount602954594/Dockerfile: no such file or directory

My folder directory is like this:

C:\Users\hailey\Desktop\GitTest
                               |- Dockerfile.txt
                               |- README.md
                               |- testHelloWorld.html

Inside of the Dockerfile, I have

FROM ubuntu
WORKDIR C/Users/hailey/Desktop/GitTest
COPY testHelloWorld.html .
EXPOSE 8080
CMD ["html","testHelloWorld.html"]

I did my command docker build . inside of the directory C:\Users\hailey\Desktop\GitTest and then got:

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

What did I do wrong?


Solution

  • The name of Docker files doesn't have any extension. It's just Dockerfile with capital D and lowercase f.

    You can also specify the Dockerfile name, such as docker build . -f Dockerfile.txt if you'd like to name it something else.