Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to call a spring-boot java application from docker shell script (entrypoint)?

I have a Dockerfile that ends with:

ENTRYPOINT ["java", "org.springframework.boot.loader.JarLauncher"]

Now I want to run some initialisation from a shell script before that. So I have to refactor that to:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

ENTRYPOINT[ /entrypoint.sh]

With:

!#/bin/bash
echo "some init"

#TODO
#ENTRYOINT["java", "org.springframework.boot.loader.JarLauncher"]

Question: how can I actually simulate the java entrypoint inside the shell script?

>Solution :

ShellScript can be edited to run normal Java file.

From docker documentation:

If you need to write a starter script for a single executable, you can ensure that the final executable receives the Unix signals by using exec

!#/bin/bash
echo "some init"

#Execute using linux 'exec' Java launcher
exec java org.springframework.boot.loader.JarLauncher
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading