Docker安装Rabbitmq笔记
拉取Rabbitmq镜像
到Rabbitmq镜像仓库地址查找自己要拉取的版本号
有加-management的镜像,表示带Rabbitmq管理控制页面插件
$ docker image pull rabbitmq:3.8.3-management
3.8.3-management: Pulling from library/rabbitmq
23884877105a: Pull complete
bc38caa0f5b9: Pull complete
2910811b6c42: Pull complete
36505266dcc6: Pull complete
15c38f93e1dd: Pull complete
e878ebf9599a: Pull complete
b64578f205c7: Pull complete
8ace66b27141: Pull complete
02d0c3720a80: Pull complete
d2484c2a9bff: Pull complete
3ab36d5397dd: Pull complete
dbbb55dc996f: Pull complete
Digest: sha256:ebc57de5affd61e26a7d7e84e8a512fd6b373771b1a63528a574efbb251013c7
Status: Downloaded newer image for rabbitmq:3.8.3-management
docker.io/library/rabbitmq:3.8.3-management
创建数据卷
$ docker volume create rabbitmq_data
运行容器
$ docker run -d -p 5672:5672 -p 15672:15672 \
-v rabbitmq_data:/var/lib/rabbitmq \
--name rabbitmq01 \
--hostname rmq_node01 \
-e RABBITMQ_DEFAULT_USER=admin \
-e RABBITMQ_DEFAULT_PASS=admin \
rabbitmq:3.8.3-management
-d:后台运行
-p:指定端口,5672–client端通信口,15672 – 管理界面ui端口
-v:指定数据存放位置
–name:指定容器名称
–hostname: 指定rabbitmq主机名
-e:指定环境变量,RABBITMQ_DEFAULT_USER默认用户,RABBITMQ_DEFAULT_PASS默认账号