docker pull rabbitmq
[root@ch ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
rabbitmq latest bcef1e37beb2 11 days ago 226MB
docker run -d -p 5672:5672 -p 15672:15672 --name myrabbitmq 自己镜像id此处我的是bcef1e37beb2
[root@ch ~]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
6e0b25e8599c rabbitmq "docker-entrypoint.s…" 21 minutes ago Up 17 minutes 4369/tcp, 0.0.0.0:5672->5672/tcp, :::5672->5672/tcp, 5671/tcp, 15691-15692/tcp, 25672/tcp, 0.0.0.0:15672->15672/tcp, :::15672->15672/tcp myrabbitmq
[root@ch ~]# docker exec -it myrabbitmq bash
root@6e0b25e8599c:/#
rabbitmq-plugins enable rabbitmq_management
默认账户密码都是 guest
开启插件 后,需要开放15672和5672端口,不然rabbitmq主页会出现无法访问
The reason is that the default image disables metrics collector in the management_agent plugin
解决方案:
1. 进入容器内部
`docker exec -it 容器名字 /bin/bash`
进如容器后进到该目录下
cd /etc/rabbitmq/conf.d/
2. 执行命令
#修改 management_agent.disable_metrics_collector = false
echo management_agent.disable_metrics_collector = false > management_agent.disable_metrics_collector.conf
3. 退出容器
exit
4. 重启容器
docker restart 容器名字或者Id
http://192.168.88.100:15672/
试验结果: 拒绝访问
ping www.baidu.com
完全正常
systemctl stop firewalld.service
systemctl status firewalld.service
完全关闭
完全联通
rabbitmq-plugins enable rabbitmq_management