You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Ephemeris Lappis <ep...@gmail.com> on 2023/04/14 11:27:10 UTC

ActiveMQ classic in Docker / Launch and graceful shutdown

Hello.

I see that when running ActiveMQ in a docker container, stopping the
container is slow and leaves it with a non zero exit code.

As I use a custom JDBC config file, I run activemq with :

CMD $ACTIVEMQ_HOME/bin/activemq start
xbean:$ACTIVEMQ_HOME/conf/activemq-with-postgresql.xml && bash

Then, I added "exec" to launch the script, but It seems that with
"start", the EXEC_OPTION that is used for "console" is not used.

I also noticed that without "&& bash" the container ends before
ActiveMQ is started...

Does anyone know a magic way to run ActiveMQ in the background, with a
correct graceful stop/shutdown, without changing the packaged shell ?

Thanks.

Regards.

Re: ActiveMQ classic in Docker / Launch and graceful shutdown

Posted by Ephemeris Lappis <ep...@gmail.com>.
Hello.

I see no answer, but I've a first working solution.

I've slightly modified the activemq script (in my docker file with
sed) to add 'exec' to the java command :

The lines :
    $EXEC_OPTION $DOIT_PREFIX "\"$JAVACMD\" $ACTIVEMQ_OPTS $ACTIVEMQ_DEBUG_OPTS
are replaced with :
    $EXEC_OPTION $DOIT_PREFIX "exec \"$JAVACMD\" $ACTIVEMQ_OPTS
$ACTIVEMQ_DEBUG_OPTS

and the activemq script itself is also run with 'exec' :
    CMD exec $ACTIVEMQ_HOME/bin/activemq console
xbean:$ACTIVEMQ_HOME/conf/activemq-with-postgresql.xml

This way, the PID 1 is the java process, and the SIGTERM is processed
as expected by ActiveMQ to do a graceful shutdown...

Nevertheless, I still have a strange non-zero exit code with value
143. Googling seems to say that it may be normal if the shutdown hook
returns such an exit code.

Can someone confirm ActiveMQ indeed produces such a 143 exit code ?

FYI, other containers with java processes, like Karaf for example,
stop gracefully with an exit code 0...

Thanks again.

Regards.

Le ven. 14 avr. 2023 à 13:27, Ephemeris Lappis
<ep...@gmail.com> a écrit :
>
> Hello.
>
> I see that when running ActiveMQ in a docker container, stopping the
> container is slow and leaves it with a non zero exit code.
>
> As I use a custom JDBC config file, I run activemq with :
>
> CMD $ACTIVEMQ_HOME/bin/activemq start
> xbean:$ACTIVEMQ_HOME/conf/activemq-with-postgresql.xml && bash
>
> Then, I added "exec" to launch the script, but It seems that with
> "start", the EXEC_OPTION that is used for "console" is not used.
>
> I also noticed that without "&& bash" the container ends before
> ActiveMQ is started...
>
> Does anyone know a magic way to run ActiveMQ in the background, with a
> correct graceful stop/shutdown, without changing the packaged shell ?
>
> Thanks.
>
> Regards.