如何添加插件到RabbitMQ Docker图像?

rnmwe5a2  于 2022-11-08  发布在  RabbitMQ
关注(0)|答案(7)|浏览(160)

我正在使用https://hub.docker.com/_/rabbitmq/中的rabbitmq:3-management,但是它缺少一个我需要的rabbitmq_delayed_message_exchange插件。
如果这个插件在映像中不可用,我该如何启用它?

ltskdhd1

ltskdhd11#

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
pftdvrlh

pftdvrlh2#

正在更新已接受的答案。您可以将下载的插件复制到rabbitmq镜像中并安装它。
插件下载链接:https://github.com/rabbitmq/rabbitmq-delayed-message-exchange/releases

1.准备自定义映像:

  • 停靠文件 *
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
  • 停靠-撰写.yml*
rabbitmq:
  image: rabbitmq-custom
  ports:
    - "5672:5672"
    - "15672:15672"

2.建立映像

docker build -t rabbitmq-custom .

3.运行Docker composer :

docker-compose up
cmssoen2

cmssoen23#

根据https://hub.docker.com/_/rabbitmq,这里似乎还有第二个选项没有被调用。我觉得公认的答案是最好的解决方案,因为它允许更多的调整,但人们可能更喜欢另一种方法:

启用插件

  • [已接受答案...]*
    您也可以在/etc/rabbitmq/enabled_plugins挂载一个文件,其内容为以句点结尾的Erlang原子列表。
    示例enabled_plugins
[rabbitmq_federation_management,rabbitmq_management,rabbitmq_mqtt,rabbitmq_stomp].

免责声明:我还没有试过。

hyrbngr7

hyrbngr74#

这就是我在3.9版本中实现的

FROM rabbitmq:3.9-management

COPY rabbitmq.conf /etc/rabbitmq/rabbitmq.conf

RUN apt-get -o Acquire::Check-Date=false update && apt-get install -y curl

RUN curl -L https://github.com/rabbitmq/rabbitmq-delayed-message-exchange/releases/download/3.9.0/rabbitmq_delayed_message_exchange-3.9.0.ez > $RABBITMQ_HOME/plugins/rabbitmq_delayed_message_exchange-3.9.0.ez

RUN chown rabbitmq:rabbitmq $RABBITMQ_HOME/plugins/rabbitmq_delayed_message_exchange-3.9.0.ez

RUN rabbitmq-plugins enable rabbitmq_delayed_message_exchange
t5zmwmid

t5zmwmid5#

希望这也能有所帮助:

rabbitmq3:
  container_name: "rabbitmq"
  image: rabbitmq:3.8-management-alpine
  environment:
    - RABBITMQ_DEFAULT_USER=local
    - RABBITMQ_DEFAULT_PASS=localpwd
    - RABBITMQ_PLUGINS_DIR=/opt/rabbitmq/plugins:/usr/lib/rabbitmq/plugins
  ports:
    # AMQP protocol port
    - '5672:5672'
    # HTTP management UI
    - '15672:15672'
  volumes:
    - ./rabbit/enabled_plugins:/etc/rabbitmq/enabled_plugins
    - ./rabbit/plugins:/usr/lib/rabbitmq/plugins

在docker-compose的相同路径中添加一个“rabbit”文件夹,并将其与名为enabled_plugins的文件合并

[rabbitmq_management, rabbitmq_message_deduplication].

然后下载plugins .ez-VERSION你需要在一个文件夹plugins(在“兔子”文件夹).
https://github.com/noxdafox/rabbitmq-message-deduplication/releases

y4ekin9u

y4ekin9u6#

如果您已经有一个正在运行的容器,则只需运行
集装箱bash码头管理员姓名
在我的情况下,我需要启用rabbitmq_jms_topic_exchange
rabbitmq-插件启用rabbitmq_jms_topic_exchange

2j4z5cfb

2j4z5cfb7#

只是为了从官方的地方得到插件,我建议下一个Dockerfile

FROM rabbitmq:3.10-management-alpine

RUN apk --no-cache add curl

RUN curl -L https://github.com/rabbitmq/rabbitmq-delayed-message-exchange/releases/download/3.10.2/rabbitmq_delayed_message_exchange-3.10.2.ez > rabbitmq_delayed_message_exchange-3.10.2.ez && \
mv rabbitmq_delayed_message_exchange-3.10.2.ez plugins/

RUN rabbitmq-plugins enable rabbitmq_delayed_message_exchange

希望有用!

相关问题