raykendo
raykendo

Reputation: 640

Docker build from local Dockerfile hangs (Windows 10)

I'm brand new to Docker, and I'm trying to run a Dockerfile on my Windows 10 machine, but it's hanging initially and not doing anything.

My Dockerfile:

FROM busybox:latest
CMD ["date"]

My command from docker

$ docker build -f /projects/docker_test .

Other things of note:

Docker Toolbox installed on Windows 10 Home edition

Environmental variable:

HOME = G:\projects\

Dockerfile location:

G:\projects\docker_test\Dockerfile 

File created initially with Notepad.

EDIT: I am able to load other docker containers just fine. Docker simply hangs when I try to access a local Dockerfile.

Upvotes: 1

Views: 5887

Answers (3)

The reason for this is If we have any other folders or nested folders and files present in the same directory. Then this is happening and resolution is either to add .dockerignorefile or just move it to a folder and then move to that folder from command prompt and then execute docker build command.

Upvotes: 2

rpabon
rpabon

Reputation: 1201

What worked for me was adding a .dockerignore file and add there the folders that are not part of the built image (in my case /node_modules).

Upvotes: 9

Ricardo Branco
Ricardo Branco

Reputation: 6079

The -f option is used to specify the path to the Dockerfile.

Try with:

docker build -t docker_test -f /projects/docker_test/Dockerfile /projects/docker_test

or:

cd G:\projects\docker_test\
docker build -t docker_test .

Upvotes: 2

Related Questions