前置条件:
已经安装好docker
1.查找镜像(有2种方式)
①登录rabbitmq官网找到docker镜像,选择想要的镜像的tag
https://www.rabbitmq.com/download.html
https://hub.docker.com/_/rabbitmq
如果需要访问web管理页面,就选择tag为management的
ps:带有alpine的是用最小linux镜像构建的,体积最小可以达5m初学者不建议这么折腾,而且 alpine linux使用了muslmusl实现的dns服务不会使用resolv.conf文件中的search和domain两个配置,通过dns来进行服务发现时需要注意。,带有-management的是带有web控制台
②直接用docker search 搜索,默认下载标签为latest的镜像(无法打开web管理页面)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
[testhadoop@sz-145-centos101 ~]$ sudo docker search rabbitmq
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
rabbitmq RabbitMQ is an open source multi-protocol ... 2691 [OK]
bitnami /rabbitmq Bitnami Docker Image for RabbitMQ 30 [OK]
tutum /rabbitmq Base docker image to run a RabbitMQ server 19
frodenas /rabbitmq A Docker Image for RabbitMQ 12 [OK]
kbudde /rabbitmq-exporter rabbitmq_exporter for prometheus 11 [OK]
arm32v7 /rabbitmq RabbitMQ is an open source multi-protocol ... 7
cyrilix /rabbitmq-mqtt RabbitMQ MQTT Adapter 7 [OK]
gonkulatorlabs /rabbitmq DEPRECATED: See maryville /rabbitmq 5 [OK]
aweber /rabbitmq-autocluster RabbitMQ with the Autocluster Plugin 4
pivotalrabbitmq /rabbitmq-autocluster RabbitMQ with the rabbitmq-autocluster plu... 3
pivotalrabbitmq /rabbitmq-server-buildenv Image used to build and test RabbitMQ serv... 3
authentise /rabbitmq A RabbitMQ image that will run a bash scri... 2 [OK]
deadtrickster /rabbitmq_prometheus RabbitMQ + Prometheus RabbitMQ Exporter pl... 2
henrylv206 /rabbitmq-autocluster RabbitMQ Cluster 2 [OK]
riftbit /rabbitmq3 RabbitMQ 3.x Container based on Alpine Lin... 1
|
ps:如果是普通用户登录,需要sudo,不然会提示错误
[testhadoop@sz-145-centos101 ~]$ docker search rabbitmq
Get http:///var/run/docker.sock/v1.19/images/search?term=rabbitmq: dial unix /var/run/docker.sock: permission denied. Are you trying to connect to a TLS-enabled daemon without TLS?
2.下载镜像(有时候网络问题超时,多尝试几次即可。我这里选择的是可以访问web管理界面的tag)
1
|
sudo docker pull rabbitmq:management
|
3.创建容器并运行(15672是管理界面的端口,5672是服务的端口。这里顺便将管理系统的用户名和密码设置为admin admin)
1
|
docker run -dit --name Myrabbitmq -e RABBITMQ_DEFAULT_USER=admin -e RABBITMQ_DEFAULT_PASS=admin -p 15672:15672 -p 5672:5672 rabbitmq:management
|
到此这篇关于用docker部署rabbitmq环境的文章就介绍到这了,更多相关docker部署rabbitmq环境内容请搜索服务器之家以前的文章或继续浏览下面的相关文章希望大家以后多多支持服务器之家!
原文链接:https://www.cnblogs.com/yy-cola/p/11089800.html