Skip to content
LATEST

🚀 Welcome to Upgradix by Shrash Studio – Your destination for free technology learning and career growth.

Upgradix
Upgradix Code. Learn. Ship.

Running RabbitMQ Locally with Docker & Management UI

Run the official rabbitmq:4-management image with Docker Compose to start a local broker in seconds. Expose port 5672 for your app traffic and port 15672 for the browser dashboard. You can then inspect queues, connections, and channels live without installing Erlang on your machine.

Running RabbitMQ Locally with Docker & Management UI

Quick Answer: Run the official rabbitmq:4-management image with Docker Compose to start a local broker in seconds. Expose port 5672 for your app traffic and port 15672 for the browser dashboard. You can then inspect queues, connections, and channels live without installing Erlang on your machine.

Imagine Priya is building a food delivery backend in Bengaluru. Her API must send 2,000 order events per minute to kitchen and delivery services.

She tries installing RabbitMQ directly on her laptop. First she hits an Erlang version mismatch, then a broken Windows service, and still has no visual dashboard.

How do we run a clean, repeatable RabbitMQ broker locally in under one minute?

1. Why Run RabbitMQ in Docker?

The problem without Docker

Installing RabbitMQ directly on your operating system ties your project to local machine settings.

  1. RabbitMQ needs a matching Erlang runtime, which often conflicts with other tools.
  2. Every teammate on Windows, macOS, or Linux follows different setup steps.
  3. Resetting stuck queues or broken configs takes manual cleanup.
  4. The web dashboard plugin is off by default and needs extra CLI commands.

We need one small file that starts the exact same broker on every developer laptop.

The solution: Docker Compose + Management UI

Docker Compose = a tool that starts containers from one simple YAML file.

Management UI = a built-in web dashboard to view queues, connections, and channels.

We run the rabbitmq:4-management image. It bundles Erlang, RabbitMQ, and the web dashboard together.

Local RabbitMQ Setup with Docker Compose

How Priya’s food delivery app and browser talk to the same container

Priya (Developer Laptop)
Runs docker compose up & opens browser
Port 5672 (AMQP) & Port 15672 (HTTP)
AMQP Broker (:5672)
Order API publishes food-order events
Management UI (:15672)
Live browser dashboard at localhost:15672
Persists queues & messages
Docker Volume (rabbitmq_data)
Keeps queues safe across container restarts
Developer / App RabbitMQ Container Persistent Storage Active Step

One Docker container serves both AMQP app traffic on port 5672 and the Management UI on port 15672.

2. Spin Up RabbitMQ with Docker Compose

Create a file named docker-compose.yml in your project folder.

Example 1: docker-compose.yml for Priya’s food delivery project

This config starts RabbitMQ 4 with the Management UI and a named data volume.

services:
  rabbitmq:
    image: rabbitmq:4-management
    container_name: bengaluru-orders-mq
    ports:
      - "5672:5672"     # AMQP protocol for C# apps
      - "15672:15672"   # Web Management UI
    environment:
      RABBITMQ_DEFAULT_USER: priya_dev
      RABBITMQ_DEFAULT_PASS: local_pass_123
    volumes:
      - rabbitmq_data:/var/lib/rabbitmq

volumes:
  rabbitmq_data:

Now start the container from your terminal with docker compose up -d.

Expected output

[+] Running 2/2
 ✔ Network orders_default       Created
 ✔ Container bengaluru-orders-mq Started

Port 5672 handles fast binary AMQP traffic from your C# producer and consumer.

Port 15672 serves the HTTP Management UI so you can inspect the broker in Chrome or Edge.

The named volume rabbitmq_data saves your queues on disk so restarts do not wipe them.

3. Explore Queues, Connections, and Channels Visually

Open http://localhost:15672 in your browser and log in with priya_dev and local_pass_123.

Connection = a long-lived TCP link between your app and the RabbitMQ broker.

Channel = a lightweight virtual lane inside one TCP connection for publishing or consuming.

Queue = a buffer that holds messages until a consumer processes them.

  1. Overview tab: Check message publish rate, delivery rate, and broker memory usage.
  2. Connections tab: See every connected microservice, its IP address, and how many channels it opened.
  3. Channels tab: Watch unacknowledged messages and consumer prefetch counts in real time.
  4. Queues and Streams tab: Create a test queue like order-events, publish a sample JSON message, and inspect it with Get Message(s).
Manual local install vs Docker Compose with Management UI
Without Docker With Docker Compose
Must install matching Erlang version first Erlang and RabbitMQ come pre-packaged
Different setup steps on Windows and macOS Same docker compose up -d command everywhere
Management plugin needs manual CLI enable Dashboard is ready immediately on port 15672
Hard to wipe and reset cleanly Run docker compose down -v for a fresh broker

The important terms to remember

  • Port 5672 = the default AMQP port that applications use to send and receive messages.
  • Port 15672 = the default HTTP port for the RabbitMQ Management UI.
  • Docker Volume = persistent storage mounted to /var/lib/rabbitmq so data survives restarts.

4. Common Mistakes to Avoid

1. Pulling rabbitmq:4 instead of rabbitmq:4-management

The base image does not include the web dashboard plugin. Opening localhost:15672 will fail with connection refused.

Better approach: Always use the -management tag for local development.

2. Using default guest/guest credentials in shared setups

RabbitMQ blocks guest/guest from connecting over non-localhost networks for security.

Better approach: Set RABBITMQ_DEFAULT_USER and RABBITMQ_DEFAULT_PASS in your Compose file.

5. Interview Questions & Practice

Question 1: Why does RabbitMQ use two different ports, 5672 and 15672?

What the interviewer expects: Clear separation between messaging traffic and admin monitoring.

Strong answer: "Port 5672 carries binary AMQP traffic for our food delivery services, which needs low latency. Port 15672 serves the HTTP Management UI and REST API for monitoring queues and channels. Keeping them separate lets us lock down 15672 in production."

Beginner: Hospital appointment queue

Start RabbitMQ with Docker Compose, open the Management UI, create a queue named appointment-reminders, and publish one JSON message from the UI.

Expected result: The queue shows 1 Ready message, and clicking Get Message(s) displays your JSON payload.

6. Next Steps

Previous article: Introduction to Message Brokers & RabbitMQ Architecture – review how exchanges, bindings, and queues fit together.

Next article: Your First C# Producer & Consumer with RabbitMQ.Client – connect a real .NET app to this local Docker broker on port 5672.

Discussion & Comments

0
Guest mode · Login / Register
Post directly as a guest or log in first.

No comments yet

Start the discussion above — ask a question, share a tip, or reply to a comment.

This article is protected. Printing and saving as PDF are disabled.