I just downloaded Docker Toolbox for Windows 10 64bit today. I\'m going through the tutorial. I\'m receving the following error when trying to build an image using a Docke
Be sure your DOCKERfile
is in the ROOT of the application directory, I had mine in src which resulted in this error because Docker was not finding the path to DOCKERfile
I have got this error (in MacBook) though I used correct command to create image,
docker build -t testimg .
Later I found that path is the problem. Just navigate to the correct path that contains docker file. Just double check your current working directory .Nothing to panic!
Below command worked for me docker build -t docker-whale -f Dockerfile.txt .
Two ways to build a dockerfile:
You can decide not to specify the file name of which to build from and just build it specifying a path (doing it this way the file name must be Dockerfile
with no extension appended, eg: docker build -t docker-whale:tag path/to/Dockerfile
or
You can specify a file with -f
and it doesn't matter what extension (within reason .txt
, .dockerfile
, .Dockerfile
etc..) you decide to use, eg docker build -t docker-whale:tag /path/to/file -f docker-whale.dockerfile
.
I got this on Windows when the path I was working in was under a Junction directory. So my fix was to not work under that path.
I had created my DockerFile by VS2017 Docker Support tool and had the same error. After a while I realised I was not in the correct directory that contains the Dockerfile (~\source\repos\DockerWebApplication\)
. cd'ed to the correct file (~/source/repos/DockerWebApplication/DockerWebApplication)
which was inside the project and successfully created the docker image.