Comments (8)
Instead of using /bin/activemq console
I've started using command that runs activemq directly -> java $JAVA_OPTS -jar /activemq-home/activemq/bin/run.jar start
. Now I don't have any problem with this stopping and starting.
Example from dockerfile
ENV JAVA_OPTS=" \
-Xms256M \
-Xmx256M \
-Dorg.apache.activemq.UseDedicatedTaskRunner=true \
-Djava.util.logging.config.file=logging.properties \
-Dcom.sun.management.jmxremote \
-Dactivemq.classpath=/activemq-home/activemq/conf; \
-Dactivemq.home=/activemq-home/activemq \
-Dactivemq.base=/activemq-home/activemq \
"
COPY startamq.sh startamq.sh
CMD ["./startamq.sh"]
startamq.sh:
exec java $JAVA_OPTS -jar /activemq-home/activemq/bin/run.jar start
from docker-activemq.
Hi,
I think the issue is that activemq is not pid 1. That should be fixably by replacing
CMD ["/bin/sh", "-c", "bin/activemq console"]
with
CMD [ "bin/activemq", "console"]
You can immediately try it out if you start the container like this:
docker run rmohr/activemq bin/activemq console
If you then stop the container with docker stop
the exit code will hopefully look fine.
from docker-activemq.
Ok, does not help. A wrapping bash script is needed, which traps signals and then explicitly runs bin/activemq stop
.
from docker-activemq.
Nice solution, but that bypasses a whole lot of logic in the activemq
script.
I am afraid that the activemq
script itself has to be modified to support the exec
option. Which means contacting activemq developers :-/
from docker-activemq.
Using "tini" solves the problem.
Search for the "--init" flag here:
https://docs.docker.com/engine/reference/run/
More on this:
https://github.com/krallin/tini
from docker-activemq.
Thanks for the tini
info, I did not know about it :)
However this also does not work
$ cat docker-compose.yml
version: '3'
services:
activemq:
image: rmohr/activemq
init: true
ports:
- "61616:61616" # TCP
- "8161:8161" # UI
It stops the container very quickly, however the KILL
signal is not properly forwarded to the ActiveMQ, so it stops abruptly with exit code 143
.
I have found the problem - the java process is invoked as exec sh -c 'java some.jar args'
. This makes the shell running under PID 1, but the java itself will run under new PID. (we are using custom java
installation so its path here is different)
activemq@a9d909468041:/opt/apache-activemq-5.15.10$ ps axu
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
activemq 1 0.0 0.0 4296 708 ? Ss 12:05 0:00 sh -c "/opt/java/bin/java" -Xms64M -Xm
activemq 23 29.3 1.5 5481824 251840 ? Sl 12:05 0:12 /opt/java/bin/java -Xms64M -Xmx1G -Dja
activemq 108 0.1 0.0 18144 3172 pts/0 Ss 12:06 0:00 /bin/bash
activemq 164 0.0 0.0 36644 2832 pts/0 R+ 12:06 0:00 ps axu
The proper invocation should be exec sh -c 'exec java some.jar args'
. Then the java itself is using the PID 1 and the KILL
signal is properly forwarded to AMQ which then shuts down gracefully.
activemq@a9d909468041:/opt/apache-activemq-5.15.10$ ps axu
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
activemq 1 161 1.6 5282132 275824 ? Ssl 12:08 0:11 /opt/java/bin/java -Xms64M -Xmx1G -Dja
activemq 61 0.5 0.0 18144 3220 pts/0 Ss 12:08 0:00 /bin/bash
activemq 82 0.0 0.0 36644 2788 pts/0 R+ 12:08 0:00 ps axu
I will try to file a bug the upstream ActiveMQ -> https://issues.apache.org/jira/browse/AMQ-8364
from docker-activemq.
Hi Petr,
Nice catch, although i am not sure exit code 143 is as bad as you think.
Have a look a these conversations:
neo4j/docker-neo4j#30
docker-library/tomcat#57
Besides I have a container in which java is the main process (pid 1) and it also stops with exit code 143 (without tini)
I am not pretty sure that i am right, please let me know what you think of it.
Regards,
Peter
from docker-activemq.
Thanks you for your contribution.
As you probably noticed, I am not using this repo myself anymore for a long time and fail to find the time to maintain it for quite some time now too. Please consider using a fork. This repo is unmaintained and I am going to archive it soon.
from docker-activemq.
Related Issues (20)
- Maximum memory definition missed HOT 1
- set activemq.xml file path from env HOT 1
- ps: unrecognized option: p HOT 1
- user activemq problem AWS with efs HOT 1
- add ssl support HOT 2
- INFO: Starting in foreground, this is just for debugging purposes (stop process by pressing CTRL+C) HOT 1
- override login credentials HOT 1
- Plz tell me the passwd of root ? HOT 3
- For persistence you need to own the folders HOT 2
- Move to maintained base Java docker image HOT 2
- cli utilities not working HOT 1
- latest points to version 5.15.6 HOT 1
- How i can add -XX:+PrintGCDetails to get GC details HOT 1
- Support for 5.15.0 HOT 1
- Support for ActiveMQ 5.16.0 (Jul 1, 2020) HOT 1
- Question - Can I query the queues using REST? HOT 1
- What is the user and password? HOT 4
- Database /opt/activemq/data/kahadb/lock is locked by another server. HOT 3
- New version HOT 1
- Support for ActiveMQ 15.17.0 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from docker-activemq.