Reputation: 7530
I admit, I am a newbie in the container-world. But I managed to get docker running on my W10 with WSL2. I can also use the docker-UI and run Containers/Apps or Images. So I believe that the infrastructure is in place and uptodate. Yet, when I try even the simplest Dockerfile, it doesn't seem to work and I don't understand the error-messages it gives: This is Dockerfile:
FROM ubuntu:20.04
(yes, a humble beginning - or an extremly slimmed down repro)
docker build Dockerfile
[+] Building 0.0s (2/2) FINISHED
=> ERROR [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 33B 0.0s
=> ERROR [internal] load .dockerignore 0.0s
=> => transferring context: 33B 0.0s
------
> [internal] load build definition from Dockerfile:
------
------
> [internal] load .dockerignore:
------
failed to solve with frontend dockerfile.v0: failed to build LLB: error from sender: Dockerfile is not a directory
Upvotes: 23
Views: 49065
Reputation: 1885
In my case I got this error when running docker
commands in a wrong directory. Just cd
to the dir where your Dockerfile is, and all is good again.
Upvotes: 1
Reputation: 113
First check Docker file name(D should be capital), then run docker build -f Dockerfile . (dot at the end).
Upvotes: 4
Reputation: 917
I had the same issue but a different solution (on Windows):
Dockerfile
Dockerfile
content was FROM ubuntu:20.04
(same as OP)docker build
knowing that I had a Dockerfile
in my current folderdocker build
again -- got "docker build" requires exactly 1 argument.
docker build Dockerfile
-- got unable to prepare context: context must be a directory: C:\z\docker\aem_ubuntu20\Dockerfile
docker build .
-- got error during connect: This error may indicate that the docker daemon is not running.
docker build .
-- success!docker build PATH
, where PATH
must be a folder name and that folder must contain a Dockerfile
Upvotes: 3
Reputation: 459
For me, I had a Linux symlink in the same directory as the Dockerfile. When running docker build
from Windows 10, it gave me the ERROR [internal] load build definition from Dockerfile
. I suspect Docker docker build .
scans the directory and, if it can't read one file, it crashes. For me, I mounted the directory with WSL and removed the symblink.
Upvotes: 1
Reputation: 668
I faced a similar issue, I use the docker desktop for windows. Restarted the laptop and the issue was resolved. Hope it may help someone.
Upvotes: 6
Reputation: 3681
You need to run docker build -f [docker_file_name] .
(don't miss the dot at the end).
If the name of your file is Dockerfile
then you don't need the -f
and the filename.
Upvotes: 46