Running RabbitMQ with Docker

Short post today, mostly just wanted to how to setup RabbitMQ for local development. Refer back to my previous post to learn more about RabbitMQ.

Prerequisite
For complete guide reference, check out the Docker Hub Website for RabbitMQ.

Why use Docker?

Before starting my current job at iHerb, I would go straight for the Windows installation (my development environment) for all of my development tools needs. It was straight forward and "just worked" a lot of the time.

What I've begun to realize experimenting with all these different tooling and services is that things can get a bit cluttered, you will have a bunch of supporting systems that need to be run - caches, queues, databases and it can be a hassle to manage them through window services and executables. Additionally some of these require additional dependencies outside of the executable itself, which prompts you to install even more tooling.

The great thing about docker is that it defines a pre-built environment that has all of the dependencies needed, as well as keeps itself isolated to a non-user defined space, separating out your usual work space from your tooling work space.

You have complete control to start/stop various tools from the command line, making it great way to manage these services.

Installation

First we'll need to create the container for RabbitMQ. I'm choosing the version that contains the management plugin, which has a UI to manage the rabbitmq service.

Run the command:
docker run -d -p 5672:5672 -p 15672:15672  --name rabbitmq rabbitmq:3-management

  •  docker run - The command used to declare that you want to create a new container
  • -d - The new container will run in detached mode, or that it is not tied to the command line
  • -p 5672:5372 - Opening the port to localhost to be used for messaging
  • -p 15672:15672 - Opening the port to localhost to be used for the management UI
  • --name - The docker name of the container
  • rabbitmq:3-management - The name of the image to be pulled (rabbitmq is the repository, and 3-management is the tag)

Using the Management UI

Once your container is running, you should be able to navigate to the RabbitMQ UI to opening up your browser and going to http://localhost:15672/

It should look something like this:



Starting the Container Again

There may be a time when your container may stop due to a restart or some other circumstance.

You should be able to run it again with the command:
docker start <container name>


And that's it! You should now have a working RabbitMQ service running through Docker.

Comments

Popular posts from this blog

Uncle Bob's Clean Architecture

C4 Model: Describing Software Architecture

Multi-Tenant Design: The Basics