Centos7中Docker安装RabbitMQ

2020-07-28 16:04:14 浏览数 (1)

一、选择相应得镜像

访问:https://hub.docker.com/

选择一个合适的版本,这里选择3.7.17-management

拉取镜像 输入: docker pull rabbitmq:3.7.17-management

代码语言:javascript复制
[root@shendu ~]# docker pull rabbitmq:3.7.17-management
Trying to pull repository docker.io/library/rabbitmq ... 
3.7.17-management: Pulling from docker.io/library/rabbitmq
35c102085707: Pull complete 
251f5509d51d: Pull complete 
8e829fe70a46: Pull complete 
6001e1789921: Pull complete 
79bdb7145cce: Pull complete 
a53ba598956f: Pull complete 
78be6aa88825: Pull complete 
78743b5c9607: Pull complete 
af023e02a847: Pull complete 
2259c0afa940: Pull complete 
347b67546dd0: Pull complete 
a139db4173f7: Pull complete 
Digest: sha256:9fb2ba3cb46fbf88486ce522858c65bbcdfe80cc8c67eaf2a06be2cec0144fe6
Status: Downloaded newer image for docker.io/rabbitmq:3.7.17-management

查看是否拉取成功

代码语言:javascript复制
[root@shendu ~]# docker images
REPOSITORY           TAG                 IMAGE ID            CREATED             SIZE
docker.io/rabbitmq   3.7.17-management   7601e834fa14        46 hours ago        177 MB
[root@shendu ~]# 

二、启动RabbitMQ

代码语言:javascript复制
[root@shendu ~]# docker run -d -p 5672:5672 -p 15672:15672  --name myrabbitmq  7601e834fa14

-d:后台运行 -p:映射端口 -p 5672:5672 :把主机的5672端口映射成rabbitMQ的5672端口 -p 15672:15672 : web管理界面的 –name :起个名字 7601e834fa14:镜像的id

查询状态

代码语言:javascript复制
[root@shendu ~]# 
[root@shendu ~]# docker run -d -p 5672:5672 -p 15672:15672  --name myrabbitmq  7601e834fa14
346c168369d2d63e44c48fa0a25ac84a41a21463df084c0b8233f0dd5160441b
[root@shendu ~]# 
[root@shendu ~]# 
[root@shendu ~]# docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                                                                                        NAMES
346c168369d2        7601e834fa14        "docker-entrypoint..."   9 seconds ago       Up 8 seconds        4369/tcp, 5671/tcp, 0.0.0.0:5672->5672/tcp, 15671/tcp, 25672/tcp, 0.0.0.0:15672->15672/tcp   myrabbitmq
[root@shendu ~]# 

测试是否访问成功

在浏览器中输入: http://安装RabbitMQ的主机IP:15672

出现如下界面代表访问成功

输入默认的账号密码: 账号:guest 密码:guest

0 人点赞