下载好延迟插件,我下载的是
rabbitmq_delayed_message_exchange-3.12.0.ez
通过远程登录工具登录到ubuntu,查看docker中已有的容器:
# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b9b6c5ab5673 elasticsearch:7.7.0 "/tini -- /usr/local…" 15 hours ago Up 47 minutes 0.0.0.0:9200->9200/tcp, :::9200->9200/tcp, 0.0.0.0:9300->9300/tcp, :::9300->9300/tcp elasticsearch
0a696ea5b98c rabbitmq:management "docker-entrypoint.s…" 16 hours ago Up 49 minutes 4369/tcp, 5671/tcp, 0.0.0.0:5672->5672/tcp, :::5672->5672/tcp, 15671/tcp, 15691-15692/tcp, 25672/tcp, 0.0.0.0:15672->15672/tcp, :::15672->15672/tcp rabbitmq
获得rabbitmq的容器ID,此处的ID为:0a696ea5b98c。
将下载的延迟插件上传到ubuntu的某个目录,我这里上传到/home/yangj下,然后将其复制到Docker中的RabbitMq容器中的plugins文件夹下。
# docker cp /home/yangj/rabbitmq_delayed_message_exchange-3.12.0.ez 0a696ea5b98c:/plugins
Successfully copied 50.2kB to 0a696ea5b98c:/opt/rabbitmq/plugins
进入容器查看该目录下是否有该压缩包
docker exec -it 0a696ea5b98c bash
若有,则在容器中的命令行执行一下命令添加插件
rabbitmq-plugins enable rabbitmq_delayed_message_exchange
退出容器,重启该容器。
exit
docker restart 0a696ea5b98c