Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

docker build hangs in directory with many files

Tags:

docker

windows

Windows 10. I have in folder just:

app (directory with many files)
Dockerfile (simpliest docker file)

I run "docker build ." and it just hangs. If I remove "app" directory. Build runs ok. In docker file just one line:

FROM node

Didn't find any issues like that. It fills like it tries to scan the directory or something.

Any advice?

UPD: It seems that I should use .dockerignore https://docs.docker.com/engine/reference/builder/#/dockerignore-file

like image 330
WHITECOLOR Avatar asked Oct 21 '25 16:10

WHITECOLOR


1 Answers

When you run docker build ... the Docker client sends the context (recursive contents of the directory) via REST to the Docker daemon for building. If that context is large, this could take some time (depending on a variety of factors, if your daemon is local / remote, platform maybe, etc...).

How long are you giving it to hang before giving up? Could be that it's still just working? Or could be that the context was so large maybe the client / daemon experienced an issue. Checking the (client / daemon) logs would help debug that.

And yes, a .dockerignore file (basically a .gitignore but for Docker context) is probably what you're looking for, unless you need the contents of the app directory during your build.

like image 161
johnharris85 Avatar answered Oct 23 '25 07:10

johnharris85



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!