Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add plugin to RabbitMQ docker image?

I am using rabbitmq:3-management from https://hub.docker.com/_/rabbitmq/ however, it is missing a plugin that I need rabbitmq_delayed_message_exchange.

How can I enable this plugin if it is not available in the image?

like image 373
atkayla Avatar asked Oct 15 '18 14:10

atkayla


People also ask

How do I use rabbitmq with docker?

Open a terminal, navigate to your rabbitmq-go folder and run docker-compose up . This command will pull the rabbitmq:3-management-alpine image, create the container rabbitmq and start the service and webUI. You should see something like this: Once you see this, open your browser and head over to http://localhost:15672.

Where is rabbitmq plugin folder?

/usr/lib/rabbitmq/plugins is an additional directory where nothing is installed by the RabbitMQ package itself.

How do I access rabbitmq docker container?

If you open your Docker engine, you will see the RbbitMQ container set and running. If you open http://localhost:15672/ on a browser, you will be able to access the management Ui, and now you can log in using the docker-compose set username and password. And now you can see the RabbitMQ instance is up and running.

How do I start a RabbitMQ container in Docker?

Assuming the Docker Desktop has been installed, we use the command docker pull rabbitmq:3-management to pull a RabbitMQ Docker image from DockerHub. After the Docker image is downloaded and saved locally, we can start a RabbitMQ container using the following command.

How do I pull a RabbitMQ image with tag 3-management?

In this article, we will use the RabbitMQ image with a tag 3-management, which is a Docker image with the RabbitMQ management plugin installed and enabled by default. Assuming the Docker Desktop has been installed, we use the command docker pull rabbitmq:3-management to pull a RabbitMQ Docker image from DockerHub.

How to add plugins to RabbitMQ?

The files must be copied to one of the plugins directories specified by $RABBITMQ_PLUGINS_DIR. Assuming that plugins correctly specify a dependency on the core RabbitMQ server and their files were copied to the correct directory, they will show up in rabbitmq-plugins list and can be enabled with rabbitmq-plugins enable.

What is/usr/lib/RabbitMQ/plugins?

/usr/lib/rabbitmq/plugins is an additional directory where nothing is installed by the RabbitMQ package itself. But it is a fixed non-changing path where external plugins can be installed from Debian/RPM packages or can be put there by a provisioning tool.


2 Answers

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 
like image 170
atkayla Avatar answered Oct 13 '22 23:10

atkayla


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 
like image 23
nsv Avatar answered Oct 14 '22 00:10

nsv