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?
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.
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.
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
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
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With