RabbitMQ container with Docker Compose
September 3, 2024For Compose basics, see the Docker Compose overview. This post covers a RabbitMQ broker with the management UI.
Prerequisites
- Docker Compose installed
Configuration
The following configuration spins up the RabbitMQ container with the management UI tool.
The connection string for the RabbitMQ broker with local virtual host is amqp://localhost:5672/local.
RabbitMQ management UI is available at the http://localhost:15672 link. Default credentials are guest as username and guest as password.
# docker-compose.ymlservices:rabbitmq:image: rabbitmq:3-managementports:- 5672:5672- 15672:15672environment:- RABBITMQ_DEFAULT_VHOST=localvolumes:- 'rabbitmq_data:/data'volumes:rabbitmq_data:
Run the following command to spin up the container.
docker compose up
Demo
Docker Compose files and setup scripts for this post live in the rabbitmq-docker-compose folder. Get access via code demos.