How to add plugin to RabbitMQ docker image?
According to https://hub.docker.com/_/rabbitmq it seems there is a second option not yet evoked here. I feel accepted answer is the best solution for it allows more tweaks, but one might prefer the other method:
Enabling Plugins
[Accepted answer...]
You can also mount a file at
/etc/rabbitmq/enabled_plugins
with contents as an erlang list of atoms ending with a period.Example
enabled_plugins
[rabbitmq_federation_management,rabbitmq_management,rabbitmq_mqtt,rabbitmq_stomp].
DISCLAIMER: I have not tried it yet.
FROM rabbitmq:3.7-management
RUN apt-get update && \
apt-get install -y curl unzip
RUN curl https://dl.bintray.com/rabbitmq/community-plugins/3.7.x/rabbitmq_delayed_message_exchange/rabbitmq_delayed_message_exchange-20171201-3.7.x.zip > rabbitmq_delayed_message_exchange-20171201-3.7.x.zip && \
unzip rabbitmq_delayed_message_exchange-20171201-3.7.x.zip && \
rm -f rabbitmq_delayed_message_exchange-20171201-3.7.x.zip && \
mv rabbitmq_delayed_message_exchange-20171201-3.7.x.ez plugins/
RUN rabbitmq-plugins enable rabbitmq_delayed_message_exchange
Just updating the accepted answer. You may copy the downloaded plugin into rabbitmq image and install it.
Plugin download link: https://github.com/rabbitmq/rabbitmq-delayed-message-exchange/releases
1. Prepare custom image:
Dockerfile
FROM rabbitmq:3.7.18-management
COPY ./rabbitmq_delayed_message_exchange-20171201-3.7.x.ez /opt/rabbitmq/plugins/
RUN rabbitmq-plugins enable rabbitmq_delayed_message_exchange
docker-compose.yml
rabbitmq:
image: rabbitmq-custom
ports:
- "5672:5672"
- "15672:15672"
2. Build the image
docker build -t rabbitmq-custom .
3. Run the docker composer:
docker-compose up