Docker安装RabbitMQ服务环境
后面我有一个项目需要用到消息队列,现在主流还是RabbitMQ Kafka,
先装个RabbitMQ测试环境跑一下
环境啥的就不多说了还是之前的环境
拉取镜像
注:可视化界面带有参数:management
[[email protected] ~]# docker pull rabbitmq:management
management: Pulling from library/rabbitmq
16ec32c2132b: Pull complete
3adbc39b91c4: Pull complete
d9bdef24433b: Pull complete
c30ffcfc7791: Pull complete
d09f1c15f6ed: Pull complete
0e6412cde6ab: Pull complete
72a3c57a2525: Pull complete
f105f85edcfc: Pull complete
5408f9208bcd: Pull complete
39e0b328d922: Pull complete
Digest: sha256:87cad55fdc727f68bb158c3cd64f27c7ded996f19f988fef4c7f5734c6cb2af3
Status: Downloaded newer image for rabbitmq:management
docker.io/library/rabbitmq:management
查看镜像
[[email protected] ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
rabbitmq management 80070f1f0c8f 2 days ago 253MB
goblog latest 4b4b017a2545 2 weeks ago 1.16GB
golang latest 0821480a2b48 3 weeks ago 862MB
hyperf/hyperf 7.4-alpine-v3.11-swoole e14802af67f0 3 months ago 108MB
制作容器并启动
docker run -d --hostname htz-rabbit --name rabbitmq -e RABBITMQ_DEFAULT_USER=admin -e RABBITMQ_DEFAULT_PASS=admin -p 15672:15672 -p 5672:5672 80070f1f0c8f
1a0005f6e0dbc3c9e54d0e8e624357d7104ee67ec7c9cb8b86811f1d1a3bae10
[[email protected] ~]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
1a0005f6e0db 80070f1f0c8f "docker-entrypoint.s…" About a minute ago Up About a minute 4369/tcp, 5671/tcp, 0.0.0.0:5672->5672/tcp, 15671/tcp, 15691-15692/tcp, 25672/tcp, 0.0.0.0:15672->15672/tcp rabbitmq
be8cf8bd2a78 goblog "bee run" 2 weeks ago Up 2 weeks 0.0.0.0:8080->8080/tcp goblogbeego
103fd0f26448 hyperf/hyperf:7.4-alpine-v3.11-swoole "/bin/sh" 3 months ago Exited (255) 6 weeks ago 0.0.0.0:9601->9601/tcp hyperf
[[email protected] ~]#
参数说明:
-d #后台运行
-- homename htz-rabbit #主机名
RABBITMQ_DEFAULT_USER=admin #可视化界面登录用户名
RABBITMQ_DEFAULT_PASS=admin #可视化界面登录密码
-p 15672:15672 #端口映射
80070f1f0c8f #镜像ID
登录mq 用web页面
http://192.168.1.98:15672/
相关文章