I try to build a simple image that uses the alpine linux image and prints "Hello StackOverflow!". What is the issue here?

Viewed 179

Windows PowerShell:

PS C:\Users\Administrator> docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
alpine              latest              d6e46aa2470d        13 days ago         5.57MB
alpine/git          latest              a8b6c5c0eb62        2 weeks ago         28.4MB

PS C:\Users\Administrator> docker build C:\dfiles
[+] Building 0.9s (2/2) FINISHED
 => [internal] load build definition from Dockerfile                                                               0.6s
 => => transferring dockerfile: 2B                                                                                 0.0s
 => [internal] load .dockerignore                                                                                  0.8s
 => => transferring context: 2B                                                                                    0.0s
failed to solve with frontend dockerfile.v0: failed to read dockerfile: open /var/lib/docker/tmp/buildkit-mount632819289/Dockerfile: no such file or directory

The path of where the dockerfile is stored: C:\dfiles

The code in my Dockerfile.txt:

FROM alpine
CMD ["echo", "Hello StackOverflow!"]
2 Answers

Simple

Use just Dockerfile with no Extention instead of Dockerfile.txt

The code in my Dockerfile.txt

The file needs to be called "Dockerfile", not "Dockerfile.txt". So remove the file extension from your file and try again.

Related