1. 镜像搜索
docker search rabbitmq
1
2. 镜像下载
docker pull rabbitmq
1
3. 启动容器
docker run -d --name rabbitmq --restart always \
-p 15672:15672 \
-p 5672:5672 \
rabbitmq
p 指定宿主机和容器端口映射(5672:服务应用端口,15672:管理控制台端口)
4. 插件安装
安装管理控制台插件
docker exec -it rabbitmq /bin/bash
rabbitmq-plugins enable rabbitmq_management
1
2
5. 启动验证
访问RabbitMQ控制台: http://ip:15672/
用户名/密码:guest/guest
6. 重置RabbitMQ队列
docker exec -it rabbitmq /bin/sh
rabbitmqctl stop_app
rabbitmqctl reset
rabbitmqctl start_app
7. 交换机点击报错问题
Management API returned status code 500
docker exec -it rabbitmq /bin/bash
# 进入容器
cd /etc/rabbitmq/conf.d/
echo management_agent.disable_metrics_collector = false > management_agent.disable_metrics_collector.conf
exit
# 重启容器
docker restart rabbitmq