最近在Linux上单独安装RabbitMQ实在是太痛苦,一直安装不成功,于是在Docker中来安装RabbitMQ。特此记录下。希望能够帮助到大家
Docker中安装RabbitMQ
首先你得安装的有Docker环境,如果有不懂的可以参考我的Docker专题:https://blog.csdn.net/qq_38526573/category_9619681.html
1. 查找镜像
查找带有可视化界面的镜像
代码语言:javascript复制[root@bobo01 ~]# docker search rabbitmq:management
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
macintoshplus/rabbitmq-management Based on rabbitmq:management whit python and… 6 [OK]
xiaochunping/rabbitmq xiaochunping/rabbitmq:management 2018-06-30 4
transmitsms/rabbitmq-sharded Fork of rabbitmq:management with sharded_exc… 0
yunyan2140/rabbitmq docker pull rabbitmq:management 0
2. 拉取镜像
代码语言:javascript复制docker pull docker.io/macintoshplus/rabbitmq-managemen
3. 查看镜像
代码语言:javascript复制[root@bobo01 ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
macintoshplus/rabbitmq-management latest c20a8529776b 4 years ago 216MB
4.制作容器并启动
代码语言:javascript复制docker run -d --hostname bobo-rabbit --name rabbitmq -e RABBITMQ_DEFAULT_USER=guest -e RABBITMQ_DEFAULT_PASS=guest -p 15672:15672 -p 5672:5672 c20
参数说明
-d #后台运行 – homename bobo-rabbit #主机名 RABBITMQ_DEFAULT_USER=guest #可视化界面登录用户名 RABBITMQ_DEFAULT_PASS=guest #可视化界面登录密码 -p 15672:15672 #端口映射 c20 #镜像ID
5. 查看
代码语言:javascript复制[root@bobo01 ~]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
8a987a1c374e c20 "/docker-entrypoint.…" 16 seconds ago Up 15 seconds 4369/tcp, 5671/tcp, 0.0.0.0:5672->5672/tcp, 15671/tcp, 25672/tcp, 0.0.0.0:15672->15672/tcp rabbitmq
6.访问
http://ip:15672 即可
搞定~