Install RabbitMQ using Docker

In this tutorial, we will learn how to install and set up RabbitMQ locally as a Docker container using Docker.

Full Docker Image from DockerHub

Assuming the Docker Desktop has been installed, we use the command docker pull rabbitmq:3.10-management to pull a RabbitMQ Docker image from DockerHub. 

For example:

rameshfadatare@Rameshs-MacBook-Air ~ % docker pull rabbitmq:3.10-management 

3.10-management: Pulling from library/rabbitmq

11e23ac719b3: Pull complete 

431d6e9b403d: Pull complete 

39626ae8f80b: Pull complete 

25839a1a0b4b: Pull complete 

d4bcf4e7b118: Pull complete 

c6bfe8c241c9: Pull complete 

ed028da66fdd: Pull complete 

857399c434b7: Pull complete 

ec1ad240cb9c: Pull complete 

dcc5d8d42a10: Pull complete 

Digest: sha256:244b4f37f7778dbf10e2a6c0713101945100f5b2dbff62ec57f812fd6b452c6e

Status: Downloaded newer image for rabbitmq:3.10-management

rameshfadatare@Rameshs-MacBook-Air ~ % 

Run RabbitMQ Docker Image in Docker Container

After the Docker image is downloaded and saved locally, we can start a RabbitMQ container using the following command:
docker run --rm -it -p 15672:15672 -p 5672:5672 rabbitmq:3.10-management
In the command above, port 5672 is used for the RabbitMQ client connections, and port 15672 is for the RabbitMQ management website. This command may take a minute to execute. After that, we can open a browser window and use the URL http://localhost:15672 to visit the RabbitMQ management website.

We can use the default username and password guest/guest to log into the RabbitMQ management website.

The following screenshot shows the website login page.

RabbitMQ HelloWorld Example

Check out - RabbitMQ Java HelloWorld Example

RabbitMQ Tutorial with Publish/Subscribe Example

Check out - RabbitMQ Tutorial with Publish/Subscribe Example