Install Apache ActiveMQ using Docker Compose

Apache ActiveMQ does not have an official Docker Image, so you can use a Docker Image at https://hub.docker.com/r/symptoma/activemq. This Docker Image has been updated to the latest version of Apache ActiveMQ!

The contents of our docker-compose.yaml file for installing ActiveMQ with Docker Compose will look like this:

A note to you is that since version 5.16.0, by default, ActiveMQ’s WebConsole is not exposed to outside access, so here I only expose port 61616 of ActiveMQ server! The 2 folders inside the ActiveMQ container are also mounted to the external folders for us to easily work with it.

The result when running the command “docker compose up” in the directory containing the docker-compose.yaml file with the above content is as follows:

So we have started an ActiveMQ server with WebConsole already!

If you want to expose WebConsole for external access, you can customize the Dockerfile file at https://github.com/symptoma/activemq/blob/master/Dockerfile. This is the Dockerfile used to build the Docker Image that I am using above.

First, download the latest version of ActiveMQ at https://activemq.apache.org/components/classic/download/. Extract the downloaded file, find the following line in the /conf/jetty.xml file in the extracted directory:

change the value of the host property to 0.0.0.0:

then copy this jetty.xml file to the same directory as the above Dockerfile.

For Dockerfile, add the following line to override ActiveMQ’s jetty.xml file in Docker Container when running it:

then run Docker build command to build Docker Image from this Dockerfile:

Result:

Once we have the Docker Image, we will modify the docker-compose.yaml file above to change the Docker Image name and expose the WebConsole port as follows:

and run the command “docker compose up” again:

Now you can access the ActiveMQ WebConsole using the address http://localhost:8161/:

Log in with username and password as admin, you will see the following results:

Add Comment