PCFreak Logo (c) Der PCFreak

Linux/Docker generate entropy

I recently ran into an issue where a docker container I started hung when generating som certificates/keys. After more than 1 hour it started successfully. As I found out, the system did not have enough entropy to generate the certificates/keys.

If you run in such a problem this is a good workarround to generate entropy:

while /bin/true; do dd if=/dev/urandom of=/tmp/100 bs=1024 count=100000; for i in {1..10}; do cp /tmp/100 /tmp/tmp_$i_$RANDOM; done; rm -f /tmp/tmp_* /tmp/100; done

Just run the above code in another session on the system where you want to start the docker container and after a very short time (much faster than before) the task needing entropy will succeed.