标签:keep mon sed which nta env blank volumes registry
编写时间:2020-05-08
参考文档:docker安装rabbitmq
1. 编写docker-compose.yml
version: ‘3‘ services: rabbitmq: image: rabbitmq:3.8.3-management container_name: rabbitmq restart: always hostname: myRabbitmq ports: - 15672:15672 - 5672:5672 volumes: - ./data:/var/lib/rabbitmq environment: - RABBITMQ_DEFAULT_USER=root - RABBITMQ_DEFAULT_PASS=root
2. 浏览器访问 ip:15672即可,用户名,密码输入root登录。
注意:
1. application.yml文件中推荐为docker容器设置hostname,因为rabbitmq默认使用hostname作为存储数据的节点名,设置hostname可以避免生成随机的节点名,方便追踪数据。官网原文如下
One of the important things to note about RabbitMQ is that it stores data based on what it calls the "Node Name", which defaults to the hostname. What this means for usage in Docker is that we should specify
-h
/--hostname
explicitly for each daemon so that we don‘t get a random hostname and can keep track of our data:
2. RABBITMQ_DEFAULT_USER 和 RABBITMQ_DEFAULT_PASS 用来设置超级管理员的账号和密码,如果不设置,默认都是 guest
3. docker镜像使用像这样 rabbitmq:3.8.3-management 带有后缀 -management的镜像,之前使用没带这个后缀的镜像,网页访问失败,如下图。
标签:keep mon sed which nta env blank volumes registry
原文地址:https://www.cnblogs.com/yloved/p/12853029.html