How to run Artemis MQ as Docker Image

In this tutorial, we will explore how to run Apache Artemis MQ, a high-performance messaging broker, within a Docker container. By containerizing Artemis MQ, you can easily deploy and manage your messaging infrastructure while leveraging the benefits of isolation, scalability, and portability offered by Docker. Let’s dive into the world of containerized messaging with Artemis MQ!

Hard requirements

To run this example, you need a containerization platform such as Docker or Podman. Let’s assume you have Docker available on your machine.

Next, start the service:

service docker start

Deploying Artemis MQ Image

You can find the basic Broker Container Image at

Next, execute the docker run command which will download the basic Broker Image ( and run it locally for you:

docker run --rm -e AMQ_USER=admin -e AMQ_PASSWORD=admin -p 61616:61616 --name artemis

In the above example, we are using the AMQ_USER and AMQ_PASSWORD environment variables to configure an Admin user. Check that the server started:

artemis mq docker

As we have exported the port 61616, we are able to connect from our Host using the OpenWire protocol to send and receive messages, subscribe to destinations, and perform various messaging operations.

Running the Image with Docker-compose

If your Artemis broker needs to integrate with other container image, it is a good idea, especially for test purpose, to include it in a docker-compose.yaml file. Here is a sample docker-compose.yaml file which reference the latest version of the Image:

version: '2'

      - "5672:5672"
      - "61616:61616"
      - ./broker/broker.xml:/opt/amq/conf/broker.xml
      AMQ_USER: "admin"
      AMQ_PASSWORD: "admin"

In the above example, we are providing the broker configuration from the Host folder./broker/broker.xml. Also, we are setting the AMQ user and password using environment variables.

You can start ArtemisMQ with Docker Compose as follows:

docker-compose up

Sending and Receiving Messages from/to the Container Image

Finally, we will show how to produce and consume messages on the Container Image of Artemis MQ

Provided that you have used the –name parameter to set the Container Image name, you can produce messages as follows:

docker exec artemis /home/jboss/broker/bin/artemis producer --destination demoqueue   --message-size 1024 --message-count 10

Then, to consume messages, you can run the following command:

docker exec artemis /home/jboss/broker/bin/artemis consumer --destination demoqueue   --message-count 10 --verbose

As you can see from the following Image, messages from the Queue “demoqueue” are being consumed:

artemis mq docker image tutorial


In this tutorial, we have covered the essential steps to run Apache Artemis MQ in a Docker container. We started by pulling the official Artemis image from the Docker Hub and customizing the container configuration as per our requirements. We explored how to create and configure brokers, manage queues and addresses, and expose ports for communication.