CentOS7.6安装Rabbitmq

1.下载镜像,这里下载 3.7.17-management 版本,此版本为带管理后台的最新版

docker pull rabbitmq:3.7.17-management

2.创建目录

/root/runenv/opt/docker/rabbitmq/data  存放数据

/root/runenv/opt/docker/rabbitmq/logs  存放日志

3.启动 Rabbitmq

docker run -d --hostname iot-rabbitmq --name iot-rabbitmq -v /root/runenv/opt/docker/rabbitmq/data:/var/lib/rabbitmq -v /root/runenv/opt/docker/rabbitmq/rabbitmq.conf:/etc/rabbitmq/rabbitmq.conf:ro -v /root/runenv/opt/docker/rabbitmq/rabbitmq-env.conf:/etc/rabbitmq/rabbitmq-env.conf:ro -v /root/runenv/opt/docker/rabbitmq/enabled_plugins:/etc/rabbitmq/enabled_plugins:ro -v /root/runenv/opt/docker/rabbitmq/logs:/var/log/rabbitmq -p 5672:5672 -p 15672:15672 -e RABBITMQ_CONF_ENV_FILE=/etc/rabbitmq/rabbitmq-env.conf rabbitmq:3.7.17-management

4.启动后通过 docker ps -a 查看容器ID

5.将配置文件拷贝出来

docker cp 容器ID:/etc/rabbitmq/rabbitmq.conf /root/runenv/opt/docker/rabbitmq

docker cp 容器ID:/etc/rabbitmq/enabled_plugins /root/runenv/opt/docker/rabbitmq

6.停止并删掉原来的容器后重新启动容器

docker stop 容器ID

docker rm 容器ID

docker run -d --hostname iot-rabbitmq --name iot-rabbitmq -v /root/runenv/opt/docker/rabbitmq/data:/var/lib/rabbitmq -v /root/runenv/opt/docker/rabbitmq/rabbitmq.conf:/etc/rabbitmq/rabbitmq.conf:ro -v /root/runenv/opt/docker/rabbitmq/enabled_plugins:/etc/rabbitmq/enabled_plugins:ro -v /root/runenv/opt/docker/rabbitmq/logs:/var/log/rabbitmq/log -p 5672:5672 -p 156672:15672 rabbitmq:3.7.17-management

这样,Rabbitmq就装好了,可以通过 http://ip:15672 打开管理控制台进行查看

问题:通过 docker logs 容器ID查看后,发现日志目录没有设置上去,如果有知道的朋友希望能够指点。

你可能感兴趣的:(docker)