Docker Compose for RabbitMQ: Basic Setup

16/02/2024

Setting up RabbitMQ locally for development can be streamlined using Docker Compose. Here's a practical guide to get you started.

Basic Setup

Create a new file named docker-compose.yml with this configuration:

version: '3.8'
services:
  rabbitmq:
    image: rabbitmq:3.12-management
    ports:
      - "5672:5672"   # AMQP protocol port
      - "15672:15672" # Management UI port
    environment:
      - RABBITMQ_DEFAULT_USER=admin
      - RABBITMQ_DEFAULT_PASS=admin123
    volumes:
      - rabbitmq_data:/var/lib/rabbitmq

volumes:
  rabbitmq_data:

Running the Container

Start RabbitMQ using:

docker-compose up -d

Accessing Management UI

  1. Open http://localhost:15672
  2. Login with:
    • Username: admin
    • Password: admin123

Key Features

  • Persistent storage using named volume
  • Management UI enabled
  • Custom default credentials
  • Standard AMQP port mapping
#Docker #RabbitMQ #DevOps