I am deploying the ActiveMQ Artemis in Docker from the quay.io using docker desktop in my local machine (using Windows 10).
I issued below command to start the latest image:
docker run -e AMQ_USER=admin -e AMQ_PASSWORD=admin -p8161:8161 -p61616:61616 -p5672:5672 --rm --name artemis quay.io/artemiscloud/activemq-artemis-broker
Note: dev.latest tag is not available, so used the latest tag.
The ActiveMQ Artemis instance in the Docker container starts successfully, and I’m able to login to the web console:
...
2022-06-18 20:08:26,820 INFO [org.apache.activemq.artemis.core.server] AMQ221007: Server is now live
2022-06-18 20:08:26,821 INFO [org.apache.activemq.artemis.core.server] AMQ221001: Apache ActiveMQ Artemis Message Broker version 2.22.0 [broker, nodeID=68f4db2b-ef42-11ec-b609-0242ac110002]
2022-06-18 20:08:27,607 INFO [org.apache.activemq.hawtio.branding.PluginContextListener] Initialized activemq-branding plugin
2022-06-18 20:08:27,746 INFO [org.apache.activemq.hawtio.plugin.PluginContextListener] Initialized artemis-plugin plugin
2022-06-18 20:08:28,414 INFO [io.hawt.HawtioContextListener] Initialising hawtio services
2022-06-18 20:08:28,438 INFO [io.hawt.system.ConfigManager] Configuration will be discovered via system properties
2022-06-18 20:08:28,443 INFO [io.hawt.jmx.JmxTreeWatcher] Welcome to Hawtio 2.14.2
2022-06-18 20:08:28,459 INFO [io.hawt.web.auth.AuthenticationConfiguration] Starting hawtio authentication filter, JAAS realm: "activemq" authorized role(s): "admin" role principal classes: "org.apache.activemq.artemis.spi.core.security.jaas.RolePrincipal"
2022-06-18 20:08:28,480 INFO [io.hawt.web.auth.LoginRedirectFilter] Hawtio loginRedirectFilter is using 1800 sec. HttpSession timeout
2022-06-18 20:08:28,520 INFO [io.hawt.web.proxy.ProxyServlet] Proxy servlet is disabled
2022-06-18 20:08:28,539 INFO [io.hawt.web.servlets.JolokiaConfiguredAgentServlet] Jolokia overridden property: [key=policyLocation, value=file:/home/jboss/broker/etc/jolokia-access.xml]
2022-06-18 20:08:28,788 INFO [org.apache.activemq.artemis] AMQ241001: HTTP Server started at http://172.17.0.2:8161
2022-06-18 20:08:28,789 INFO [org.apache.activemq.artemis] AMQ241002: Artemis Jolokia REST API available at http://172.17.0.2:8161/console/jolokia
2022-06-18 20:08:28,790 INFO [org.apache.activemq.artemis] AMQ241004: Artemis Console available at http://172.17.0.2:8161/console
2022-06-18 20:14:28,681 INFO [io.hawt.web.auth.LoginServlet] Hawtio login is using 1800 sec. HttpSession timeout
2022-06-18 20:14:30,401 INFO [io.hawt.web.auth.keycloak.KeycloakServlet] Keycloak integration is disabled
2022-06-18 20:14:34,273 INFO [io.hawt.web.auth.LoginServlet] Logging in user: admin
I am unable to view the Consumer, Producer, Sessions, Queues, etc tags.
I understand that we need to modify the IPs in jolokia-access.xml
and restart, but I can’t edit the file within docker exec -it artemis bash
within the image and restart it if executed without --rm
in Docker run command.
Is there any envrionment variable to disable cors or strict in jolokia-access.xml
?
Below is what I see at http://localhost:8161/console
:
The log indicates that the console is available at http://172.17.0.2:8161/console
. However, this is not accessible since the docker is totally a different network. When I try to access it I get below message:
This site can’t be reached 172.17.0.2 took too long to respond
And when I access the end point http://localhost:8161/console/jolokia
I get the message:
{ error_type: "java.lang.Exception", error: "java.lang.Exception : Origin null is not allowed to call this agent", status: 403 }
3
Answers
In order to bypass the jolokia in the docker,
Below is the steps I followed,
default.conf
to local system, using below commanddefault.conf
fileNote: don't forget the
;
at the end.copy the default to the nginx server, we can validate and reload the new config without stopping the container.
Since we are exposing the 80 port for the nginx container, we can hit the
http://localhost:80/console
to access the ArtemisMQ page.This can be use only for Development purpose. Not suitable for production.
Refered How to set nginx reverse proxy blog
Additional Note:
The
curl
command I used to verify.ArtemisCloud broker containers restrict access to the container network for security reasons but Docker Desktop for Windows doesn’t support the host networking driver.
You could overwriting the default broker config mounting your own
etc
folder on/home/jboss/broker/etc
, i.e.Docker makes deploying microservice applications very easy but it has some limitations for a production environment. I would take a look to the ArtemisCloud.io operator that provide a way to deploy the Apache ActiveMQ Artemis Broker on Kubernetes.
I solved creating a custom script launch.sh to override launcher in the image
quay.io/artemiscloud/activemq-artemis-broker
and disable CORS limitation to works web console runnig at docker.