Invoking Java from container - directly or shell

40 views Asked by At

Is there a recommended practice to invoke Java process between invoking directly vs using shell as entry point?

I understand that shell will add extra file to maintain as downside, but provides flexibility in setting up JVM, e.g. JFR, memory conf, etc.

But any issues of using one over the other, e.g. SIGTERM?

1

There are 1 answers

0
Suchandra T On

As per the best practices is concerned there is no such recommendation for invoking java Processes.

As both approaches have their own pros and cons. it certainly depends on what your app does or is there any reconfiguration is required in such cases writing a shell makes sense.

An interesting read on this scenario How can I make the dotnet command the second command in docker?

Regarding SIGTERM scenario. The only difference will be if you invoke the java process directly Sigterm will be received by the Java process and in the case of the Shell program your shell PID will receive the shutdown event.

So to conclude I think usage depends on your requirements. Hope this helps.