前置條件:
已經(jīng)安裝好docker
1.查找鏡像(有2種方式)
①登錄rabbitmq官網(wǎng)找到docker鏡像,選擇想要的鏡像的tag
https://www.rabbitmq.com/download.html
https://hub.docker.com/_/rabbitmq
如果需要訪問web管理頁面,就選擇tag為management的
ps:帶有alpine的是用最小linux鏡像構(gòu)建的,體積最小可以達(dá)5M初學(xué)者不建議這么折騰,而且 Alpine Linux使用了muslmusl實(shí)現(xiàn)的DNS服務(wù)不會使用resolv.conf文件中的search和domain兩個配置,通過DNS來進(jìn)行服務(wù)發(fā)現(xiàn)時需要注意。,帶有-management的是帶有web控制臺
②直接用docker search 搜索,默認(rèn)下載標(biāo)簽為latest的鏡像(無法打開web管理頁面)
[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.下載鏡像(有時候網(wǎng)絡(luò)問題超時,多嘗試幾次即可。我這里選擇的是可以訪問web管理界面的tag)
sudo docker pull rabbitmq:management
3.創(chuàng)建容器并運(yùn)行(15672是管理界面的端口,5672是服務(wù)的端口。這里順便將管理系統(tǒng)的用戶名和密碼設(shè)置為admin admin)
docker run -dit --name Myrabbitmq -e RABBITMQ_DEFAULT_USER=admin -e RABBITMQ_DEFAULT_PASS=admin -p 15672:15672 -p 5672:5672 rabbitmq:management
到此這篇關(guān)于用docker部署RabbitMQ環(huán)境的文章就介紹到這了,更多相關(guān)docker部署RabbitMQ環(huán)境內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!