All tools / Docker Compose examples
RabbitMQ with Docker Compose
RabbitMQ with the management UI, a named volume and a health check.
Customize names, versions and passwords →
compose.yaml
services:
rabbitmq:
image: rabbitmq:4.1-management
restart: unless-stopped
hostname: rabbitmq
environment:
RABBITMQ_DEFAULT_USER: "admin"
RABBITMQ_DEFAULT_PASS: "change-me"
volumes:
- rabbitmq-data:/var/lib/rabbitmq
ports:
- "127.0.0.1:5672:5672"
- "127.0.0.1:15672:15672"
healthcheck:
test: ["CMD", "rabbitmq-diagnostics", "-q", "ping"]
interval: 30s
timeout: 10s
retries: 5
volumes:
rabbitmq-data:
Passwords here are placeholders (change-me). The generator creates random ones for you.
How to use it
Commands
docker compose up -d docker compose ps docker compose logs -f
- Apps connect to amqp://admin:<password>@localhost:5672. The management UI is at http://localhost:15672.
Prefer Kubernetes? See the RabbitMQ Kubernetes version.