rabbitmq
docker hub 地址
Rabbitmq - Official Image | Docker Hub
Pull
docker pull rabbitmq
docker pull rabbitmq:3.9.13-management
默认账号密码为guest/guest,如需要更改,可参考如下
$ docker run -d --hostname my-rabbit --name some-rabbit -e RABBITMQ_DEFAULT_USER=user -e RABBITMQ_DEFAULT_PASS=password rabbitmq:3-management
默认数据路径为 /var/lib/rabbitmq,挂载参考如下
$ docker run -d --hostname my-rabbit --name some-rabbit -v /docker/rabbitmq:/var/lib/rabbitmq rabbitmq:3
默认端口为5672及15672,映射参考如下
$ docker run -d --hostname my-rabbit --name some-rabbit -p 5673:5672 -p 15673 :15672 rabbitmq:3
制作自带延迟队列的镜像
首先下载rabbitmq_delayed_message_exchange插件文件
Releases · rabbitmq/rabbitmq-delayed-message-exchange · GitHub
注意:选择跟rabbitmq版本对应的插件
制作Dockerfile
FROM ccr.ccs.tencentyun.com/cscoder.cn/rabbitmq:3.8-management
COPY ["rabbitmq_delayed_message_exchange-3.8.17.8f537ac.ez","/plugins/rabbitmq_delayed_message_exchange-3.8.17.8f537ac.ez"]
RUN rabbitmq-plugins enable --offline rabbitmq_delayed_message_exchange
注:插件放在/plugins文件夹下
生成
sudo docker build -t ccr.ccs.tencentyun.com/cscoder.cn/rabbitmq:3.8-management-delayed .
启用
sudo docker run -d -p 0.0.0.0:5672:5672 -p 0.0.0.0:15672:15672 --name temp ccr.ccs.tencentyun.com/cscoder.cn/rabbitmq:3.8-management-delayed