Solve a “hanging” docker-compose

For a lot of things I’m using docker and docker-compose. With one of my docker hosts I noticed something odd. Sometimes it took a while to fire up docker-compose. I could see the command was being executed by the shell but I had to wait (sometimes up to a minute) before docker-compose seemed to “react”. This kept me quite puzzled.

I ended up “Googling” the issue and ended up at an issue about the same behaviour (https://github.com/docker/compose/issues/6678) Within this issue a trace showed docker compose seems to access /dev/random. This is a blocking call. When there is not enough entropy available /dev/random will wait until it has enough to provide you with a random number.

As the host itself is a VM it can have a lack of entropy as it is “less noisy” than “real” hardware. One of the “symptoms” is /dev/random starting to block.

The solution is quite easy, make sure you feed /dev/random with a daemon which generates random numbers (and it’s own entropy). One of those daemons is haveged, so a simply installation of the daemon solved the problem.

Sometimes it can be so easy……