docker中运行rabbitmq容器无法通过web页面访问
Docker容器中运行Rabbitmq:
# 运行 rabbitmq 镜像
docker run -d -p 5672:5672 -p 15672:15672 --name my-rabbitmq image_id
# 查看容器:docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
efaa4f33c1f0 d445c0adc9a5 "docker-entrypoint.s…" 23 hours ago Up 23 hours 4369/tcp, 5671-5672/tcp, 15691-15692/tcp, 25672/tcp, 0.0.0.0:15672->15672/tcp, :::15672->15672/tcp my-rabbitmq
# 页面访问
http://82.134.70.232:15672/
访问结果:
解决办法:
进入容器内部,安装web页面插件
[root@iZm5e2qo2apzvi67ytmow5Z ~]# docker exec -it 479b9ad0b751 /bin/bash
root@479b9ad0b751:/# rabbitmq-plugins enable rabbitmq_management
Enabling plugins on node rabbit@479b9ad0b751:
rabbitmq_management
The following plugins have been configured:
rabbitmq_management
rabbitmq_management_agent
rabbitmq_prometheus
rabbitmq_web_dispatch
Applying plugin configuration to rabbit@479b9ad0b751...
The following plugins have been enabled:
rabbitmq_management
started 1 plugins.
再次访问: