This is an automated email from the ASF dual-hosted git repository.

jlmonteiro pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/activemq.git


The following commit(s) were added to refs/heads/main by this push:
     new 7d5291e671 AMQ-9588: Run ActiveMQ with regular user in Docker 
container, and hook to easily stop the container (#1665)
7d5291e671 is described below

commit 7d5291e67185796e7021fc2abc739d162541cb9a
Author: JB Onofré <[email protected]>
AuthorDate: Wed Feb 11 18:39:07 2026 +0100

    AMQ-9588: Run ActiveMQ with regular user in Docker container, and hook to 
easily stop the container (#1665)
---
 assembly/src/docker/Dockerfile    |  9 +++++++++
 assembly/src/docker/entrypoint.sh | 15 ++++++++++++++-
 2 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/assembly/src/docker/Dockerfile b/assembly/src/docker/Dockerfile
index d12e372d3d..c6b917a443 100644
--- a/assembly/src/docker/Dockerfile
+++ b/assembly/src/docker/Dockerfile
@@ -29,7 +29,10 @@ ENV PATH $PATH:$ACTIVEMQ_HOME/bin
 # activemq_dist can point to a directory or a tarball on the local system
 ARG activemq_dist=NOT_SET
 
+RUN groupadd -r activemq && useradd -r -g activemq activemq
+
 COPY entrypoint.sh /usr/local/bin/entrypoint.sh
+RUN chown activemq:activemq /usr/local/bin/entrypoint.sh && chmod +x 
/usr/local/bin/entrypoint.sh
 
 # Install build dependencies and activemq
 ADD $activemq_dist $ACTIVEMQ_INSTALL_PATH
@@ -37,6 +40,12 @@ RUN set -x && \
   cp -r $ACTIVEMQ_INSTALL_PATH/apache-activemq-* $ACTIVEMQ_HOME && \
        rm -r $ACTIVEMQ_INSTALL_PATH/apache-activemq-*
 
+RUN chown -R activemq:activemq $ACTIVEMQ_HOME
+
+STOPSIGNAL SIGTERM
+
+USER activemq
+
 EXPOSE 8161 61616 5672 61613 1883 61614 1099
 ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
 CMD ["activemq", "console"]
diff --git a/assembly/src/docker/entrypoint.sh 
b/assembly/src/docker/entrypoint.sh
index 27d60fd0ae..e7110e5c59 100755
--- a/assembly/src/docker/entrypoint.sh
+++ b/assembly/src/docker/entrypoint.sh
@@ -89,4 +89,17 @@ if [ -z "${ACTIVEMQ_OPTS}" ]; then
   export ACTIVEMQ_OPTS
 fi
 
-exec "$@"
+_term() {
+  echo "Received signal, stopping ActiveMQ..."
+  if [ -n "${child_pid:-}" ] && kill -0 "${child_pid}" 2>/dev/null; then
+    kill -TERM "${child_pid}" 2>/dev/null || true
+  fi
+}
+
+trap _term TERM INT
+
+"$@" &
+child_pid=$!
+wait "${child_pid}"
+
+exit $?


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact


Reply via email to