Spinning Up a Basic ActiveMQ Artemis Docker Instance

To create a docker-compose.yml file for ActiveMQ Artemis (latest) with a few basic functionality to instantly have an EMS broker follow the instructions below.

  1. Use the apache/activemq-artemis Docker image.
  2. Enable persistence (default is true, but we can reinforce it).
  3. Mount a volume to store the broker's data (especially the /var/lib/artemis directory).

Contents of the docker-compose.yml file:

services:
  artemis:
    image: apache/activemq-artemis:latest
    container_name: artemis
    environment:
      - ARTEMIS_USERNAME=admin
      - ARTEMIS_PASSWORD=admin
      - ARTEMIS_NO_AUTO_CREATE=false
    ports:
      - "61616:61616"   # Core messaging (TCP)
      - "8161:8161"     # Web console
    volumes:
      - artemis-data:/var/lib/artemis
    restart: unless-stopped

volumes:
  artemis-data:

Notes

  • volumes: This mounts persistent storage for Artemis at /var/lib/artemis, which includes journal and bindings directories necessary for message persistence.
  • restart: unless-stopped: Ensures the container restarts unless you explicitly stop it.
  • ARTEMIS_NO_AUTO_CREATE=false: Ensures destinations (queues/topics) can be auto-created if not present.
  • By default, persistence is enabled in Artemis (persistence-enabled=true in broker.xml). This setup assumes default configuration is used.
  • To confirm or customize persistence settings like journal type or data directory, you’d need to mount a custom broker.xml. If you want that, let me know—I can help create it.

Starting the service

Run the following:

docker compose up -d

To verify persistence is working:

  1. Send messages to a queue.
  2. Restart the container with docker compose restart.
  3. Confirm that the messages are still there via the web console (http://localhost:8161).

  • Audentes fortuna iuvat. — Virgil
  • Aut viam inveniam aut faciam. — Hannibal Barca
  • Inveniam viam aut faciam. — Seneca
  • Fortis cadere, cedere non potest. — Latin Proverb
  • Non ducor, duco. — Motto of São Paulo
  • Per aspera ad astra. — Latin Proverb
  • Si vis pacem, para bellum. — Vegetius
  • Acta non verba. — Latin Proverb
  • Vincit qui se vincit. — Latin Proverb
  • Temet nosce. — Latin translation of the Delphic maxim
  • Ignis aurum probat, miseria fortes viros. — Seneca
  • Tandem fit surculus arbor. — Latin Proverb
  • Faber est suae quisque fortunae. — Appius Claudius Caecus
  • Labor omnia vincit improbus. — Virgil
  • Gutta cavat lapidem, non vi, sed saepe cadendo. — Ovid
  • Semper fidelis. — Latin Motto
  • Dum spiro, spero. — Cicero
  • Invictus maneo. — Latin Proverb
  • Nec aspera terrent. — Latin Motto
  • Amor fati. — Friedrich Nietzsche
"> ');