How to add plugin to RabbitMQ docker image?
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.
RabbitMQ, a popular open-source message broker, offers a variety of plugins to extend its core functionality. Docker users can benefit from customizing their RabbitMQ instances with plugins to suit their specific needs. This article will guide you through the steps of adding a plugin to a RabbitMQ Docker image, from Dockerfile customization to deploying and managing your Docker container.
Step 1: Choose Your RabbitMQ Base Image
Start by selecting an appropriate RabbitMQ base image from Docker Hub. The official RabbitMQ images are tagged by RabbitMQ version and variant; for example, rabbitmq:3.8-management includes the RabbitMQ management plugin.
Step 2: Customizing the Dockerfile
Create a Dockerfile to customize the RabbitMQ image. This file will instruct Docker on how to build your custom image, including which plugins to enable.
In this Dockerfile, we start with the rabbitmq:3.8-management image. We then set an environment variable RABBITMQ_PLUGINS to list the plugins we want to enable, separated by commas. RUN rabbitmq-plugins enable --offline ${RABBITMQ_PLUGINS} enables these plugins in the Docker image.
Step 3: Build the Docker Image
After setting up your Dockerfile, build your custom Docker image using the following command:
This command builds a Docker image named my-custom-rabbitmq from the Dockerfile in the current directory.
Step 4: Running the Container
Run your custom RabbitMQ Docker container:
This command starts a detached container named my-rabbitmq-instance. It maps the default RabbitMQ ports: 5672 for the server and 15672 for the management interface.
Step 5: Verify Plugin Installation
Verify that the plugins have been installed and enabled by accessing the RabbitMQ management dashboard at http://localhost:15672 or querying the active plugins in the container:
Common Issues and Troubleshooting
If plugins are not loading, ensure that you have specified them correctly in the Dockerfile. Check the RabbitMQ logs for any errors:
Summary Table
| Key Component | Command/Code | Description |
| Docker Image | FROM rabbitmq:3.8-management | Starting point of the custom Docker image. |
| Plugin Setup | ENV RABBITMQ_PLUGINS=...
RUN rabbitmq-plugins enable --offline ${RABBITMQ_PLUGINS} | Sets up and enables specified RabbitMQ plugins. |
| Image Building | docker build -t my-custom-rabbitmq . | Builds the Docker image based on the Dockerfile. |
| Running Container | docker run -d ... my-custom-rabbitmq | Starts the container with RabbitMQ and the specified plugins running. |
| Verification | docker exec ... rabbitmq-plugins list | Checks which plugins are active in the running container. |
Conclusion
Adding plugins to a RabbitMQ Docker image involves selecting a base image, customizing the Dockerfile, building the new image, and running it. This control allows for tailoring RabbitMQ's functionality to specific requirements and ensuring that the necessary plugins are activated and running within a Docker environment. Proper verification and troubleshooting ensure smooth operation within your RabbitMQ deployment.
Related reading
- How to alter the TTL for a particular topic in Kafka
- How to always consume from latest offset in kafka-streams
- How to apply an SMT to a single topic in Kafka connect?
- How to ask RabbitMQ to retry when business Exception occurs in Spring Asynchronous MessageListener use case
- How to add users to Docker container?
- How to allow a Kubernetes Job access to a file on host
- How to assign client-id to a particular Kafka Producer or Topic?
- How to authenticate/authorize a consumer in Kafka for a topic before it consumes the message

System Design Fundamentals
Build a strong foundation in designing scalable, reliable distributed systems.
View the courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.