Spring-boot application won't boot at startup inside docker Spring-boot application won't boot at startup inside docker docker docker

Spring-boot application won't boot at startup inside docker


Got it! Once I installed haveged on the host, the process immediately moved forward, and spring booted fine. I will post more once I do a bit more research into how docker interacts with haveged on the host.

In summary the following command issued on the host will fix the the issue:

apt-get install haveged -y

If anyone has a detailed understanding of this, feel free to post!

The thing that I don't understand at the moment, is why the host machine needed extra code, and everything wasn't isolated within the docker container.


For those who might come here later. I think easiest solution is to modify Dockerfile and have entry point as follows:

ENTRYPOINT ["java", **"-Djava.security.egd=file:/dev/./urandom"**,"-jar","app.jar"]

Had experience with apps hanging anywhere between 30 seconds and 15 minutes (or maybe more, but got killed).

From the other post that shares details:

Without this, Java uses /dev/random to seed its SecureRandom class, which can cause Java code to block unexpectedly.

Alternatively, in the $JAVA_HOME/jre/lib/security/java.security configuration file, add the line

securerandom.source=file:/dev/./urandom

Footnote: In the above examples, you need the crazy-looking filename, e.g., the extra /./, to trick Java into accepting your filename. If you just use /dev/urandom, Java decides you didn't really mean it and replaces what you wrote with /dev/random. Craziness!