docker安装rabbitMq
首先安装docker
如果安装有docker卸载之前的docker
#先删除yumdocker
yum remove docker
#删除文件
yum remove docker-*
安装docker
curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun
执行docker查询版本号命令
docker -v
# 返回 Docker version 24.0.6, build ed223bc
运行docker
service docker start
查询docker rabbitmq
docker search rabbitmq
返回以下内容
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
rabbitmq RabbitMQ is an open source multi-protocol me… 4891 [OK]
bitnami/rabbitmq Bitnami Docker Image for RabbitMQ 103 [OK]
circleci/rabbitmq-delayed https://github.com/circleci/rabbitmq-delayed… 1
circleci/rabbitmq This image is for internal use 0
bitnami/rabbitmq-cluster-operator 1
rapidfort/rabbitmq RapidFort optimized, hardened image for Rabb… 9
bitnamicharts/rabbitmq 2
bitnamicharts/rabbitmq-cluster-operator 0
elestio/rabbitmq Rabbitmq, verified and packaged by Elestio 0
masstransit/rabbitmq Contains the RabbitMQ management Docker imag… 12
itisfoundation/rabbitmq 0
nasqueron/rabbitmqadmin RabbitMQ management plugin CLI tool Lightwei… 1 [OK]
clearlinux/rabbitmq RabbitMQ multi-protocol messaging broker wit… 0
itzg/rabbitmq-stomp Extension of the official rabbitmq image tha… 0 [OK]
corpusops/rabbitmq https://github.com/corpusops/docker-images/ 0
brightercommand/rabbitmq RabbitMQ management with delay plugin enabled 0
drud/rabbitmq rabbitmq 0 [OK]
nasqueron/rabbitmq RabbitMQ wth management, MQTT and STOMP plug… 0 [OK]
exozet/rabbitmq-delay-management deprecated 1
uselagoon/rabbitmq 0
betterweb/rabbitmq 0
newrelic/k8s-nri-rabbitmq New Relic Infrastructure RabbitMQ Integratio… 0
uselagoon/rabbitmq-cluster 0
betterweb/rabbitmq-swarm-cluster https://gitlab.com/BetterCorp/public/rabbitm… 0
faucet/event-adapter-rabbitmq Faucet rabbitmq event adaptor docker image … 0
我们使用第一个,进行拉取
docker pull rabbitmq:3.12-management
查看镜像
docker images
返回如下
REPOSITORY TAG IMAGE ID CREATED SIZE
rabbitmq latest bf93b07bd808 5 days ago 217MB
rabbitmq 3.12-management d01999da73ff 3 months ago 246MB
启动
docker run --name rabbitmq --restart=always -p 5672:5672 -p 15672:15672 -d rabbitmq:3.12-management
查看端口
lsof -i:15672
# 如果没有lsof 请使用yum install lsof 下载,要使用root
返回如下
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
docker-pr 15179 root 4u IPv4 117187 0t0 TCP *:amqp (LISTEN)
docker-pr 15184 root 4u IPv6 117192 0t0 TCP *:amqp (LISTEN)
查看已经允许的镜像
docker ps -a
返回如下
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
14ff787bcd41 rabbitmq:3.12-management "docker-entrypoint.s…" 4 minutes ago Up 4 minutes 4369/tcp, 5671/tcp, 0.0.0.0:5672->5672/tcp, :::5672->5672/tcp, 15671/tcp, 15691-15692/tcp, 25672/tcp, 0.0.0.0:15672->15672/tcp, :::15672->15672/tcp some-rabbitmq