【前言】
Docker :
Docker is a set of platform as a service (PaaS) products that use OS-level virtualization to deliver software in packages called containers.[6] Containers are isolated from one another and bundle their own software, libraries and configuration files; they can communicate with each other through well-defined channels.[7] All containers are run by a single operating system kernel and therefore use fewer resources than virtual machines.[8]
The service has both free and premium tiers. The software that hosts the containers is called Docker Engine.[8] It was first started in 2013 and is developed by Docker, Inc.[9]
Docker是一组平台即服务(PaaS)产品,它们使用操作系统级虚拟化以称为容器的软件包交付软件。[6]容器彼此隔离,并捆绑其自己的软件,库和配置文件;他们可以通过定义明确的渠道相互交流。[7]所有容器都由单个操作系统内核运行,因此使用的资源少于虚拟机。[8]
该服务有免费和高级两种。托管容器的软件称为Docker Engine。[8]它最初于2013年启动,由Docker,Inc.开发。[9]
Docker维基百科
RabbitMQ:
Docker is a set of platform as a service (PaaS) products that use OS-level virtualization to deliver software in packages called containers.[6] Containers are isolated from one another and bundle their own software, libraries and configuration files; they can communicate with each other through well-defined channels.[7] All containers are run by a single operating system kernel and therefore use fewer resources than virtual machines.[8]
The service has both free and premium tiers. The software that hosts the containers is called Docker Engine.[8] It was first started in 2013 and is developed by Docker, Inc.[9]
RabbitMQ是一种开源消息代理软件(有时称为面向消息的中间件),最初实现了高级消息队列协议(AMQP),并已通过插件体系结构进行了扩展,以支持面向流文本的消息协议(STOMP)。 ,MQ遥测传输(MQTT)和其他协议。[1]
RabbitMQ服务器程序是用Erlang编程语言编写的,并建立在Open Telecom Platform框架上,用于集群和故障转移。与代理接口的客户端库适用于所有主要编程语言。
RabbitMQ维基百科
【过程】
1、查看可用的RabbitMQ版本 https://hub.docker.com/_/rabbitmq?tab=tags
或者使用命令行来查看RabbitMQ版本
docker search RabbitMQ
2、获取RabbitMQ最新镜像
docker pull rabbitmq:latest
3、查看本地下载镜像
docker images
4、运行镜像
docker run -d --name rabbitmq -p 5672:5672 -p 15672:15672 -v `pwd`/data:/var/lib/rabbitmq --hostname myRabbit -e RABBITMQ_DEFAULT_VHOST=my_vhost -e RABBITMQ_DEFAULT_USER=admin -e RABBITMQ_DEFAULT_PASS=admin *0b9850762226*
docker run -d --hostname rabbitmq --name rabbitmq -e RABBITMQ_DEFAULT_USER=admin -e RABBITMQ_DEFAULT_PASS=admin -e RABBITMQ_DEFAULT_VHOST=my_vhost -p 15672:15672 -p 5672:5672 rabbitmq
参数说明:
-
-d 后台运行容器;
-
–name 指定容器名;
-
-p 指定服务运行的端口(5672:应用访问端口;15672:控制台Web端口号);
-
-v 映射目录或文件;
-
–hostname 主机名(RabbitMQ的一个重要注意事项是它根据所谓的 “节点名称” 存储数据,默认为主机名);
-
-e 指定环境变量;(RABBITMQ_DEFAULT_VHOST:默认虚拟机名;RABBITMQ_DEFAULT_USER:默认的用户名;RABBITMQ_DEFAULT_PASS:默认用户名的密码)
-
红线位置为镜像ID。
5、访问web页面(输入自己设置的默认用户名、密码)
【插曲】
1、docker run 后,使用docker ps 查看在运行中也存在RabbitMQ。web界面无法访问
进入RabbitMQdocker exec -it rabbitmq /bin/bash
开启web管理页面
rabbitmq-plugins enable rabbitmq_management
2、rabbitmq设置docker 运行自启动
docker ps -a
拿到RabbitMQ ID
设置RabbitMQ自启动
docker update 23365f7f39b2 --restart=always
重启docker
systemctl restart docker
查看在运行容器
docker ps
【结束】
结束就是结束了,没了 !!!!!!!!!!!!!!