Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

docker-compose up hangs forever. How to debug?

I have a project with a dockerfile and a docker-compose.yml for deploying it. But if I run docker-compose up, the command prints Building app and hangs forever. I do not see any steps being performed. It isn't downloading images either since there's no network traffic, and the images used are available in the cache.

How can I go about debugging and fixing this issue on my machine? Is there a verbose option for docker(-compose) that I could use?

like image 548
fctorial Avatar asked Jan 28 '20 03:01

fctorial


People also ask

How do I debug a docker compose file?

If you want to debug in Docker Compose, run the command Docker Compose Up using one of the two Docker Compose files as described in the previous section, and then attach using the appropriate Attach launch configuration. Launching directly using the normal launch configuration does not use Docker Compose.

How do I debug docker?

Create a remote debug configuration Before starting, the remote debug configuration should first launch the Docker run configuration and start the application in debug mode. From the main menu, select Run | Edit Configurations. and select Remote JVM Debug. and select Launch Docker Before Debug.


3 Answers

As this is the top hit for "docker-compose hangs", I'll post the solution for my problem that would have saved me 30 minutes of searching. If even docker-compose --version hangs, this might be your fix.

Docker-compose seems to hang indefinitely when the system has low entropy. You can check this by running:

cat /proc/sys/kernel/random/entropy_avail

If the output is less than 1000, that is almost certainly why it's hanging. I was experiencing this on a VPS, where the available entropy was less than 10.

The fix for me was to install haveged, which immediately increased my available entropy to over 2500, and caused docker compose to work normally.

Installation is as easy as

apt install haveged
like image 157
Phillip Elm Avatar answered Oct 22 '22 15:10

Phillip Elm


Try to run it with this option and see if helps:

docker-compose --verbose up

*Note: If you haven't build your container, run the same command with the option --build

like image 28
Felipe Malara Avatar answered Oct 22 '22 14:10

Felipe Malara


I ran into this problem last night, the problem for me was a large sub directory of images, 66GB. Adding the sub directory to .dockerignore file resolved the issue

like image 12
gordonbanderson Avatar answered Oct 22 '22 16:10

gordonbanderson