进入自己的容器
[river@bogon ~]$ sudo docker ps
[sudo] password for river:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
0831e1d395ff river/centos-2 "init" 42 hours ago Up 42 hours 0.0.0.0:3306->3306/tcp, 0.0.0.0:6379->6379/tcp trusting_wilbur
[river@bogon ~]$ sudo docker exec -it 0831e1d395ff bash
RabbitMQ是用Erlang语言编写的,先安装Erlang
yum -y install epel-release
yum -y install erlang socat
[root@0831e1d395ff /]# erl -version
Erlang (SMP,ASYNC_THREADS,HIPE) (BEAM) emulator version 5.10.4
安装RabbitMQ
获取安装包
wget https://www.rabbitmq.com/releases/rabbitmq-server/v3.6.10/rabbitmq-server-3.6.10-1.el7.noarch.rpm
通过运行导入GPG密钥:
rpm –import https://www.rabbitmq.com/rabbitmq-release-signing-key.asc
运行RPM安装RPM包:
rpm -Uvh rabbitmq-server-3.6.10-1.el7.noarch.rpm
启动RabbitMQ
# systemctl start rabbitmq-server
# systemctl enable rabbitmq-server
# systemctl status rabbitmq-server
使能控制台
# rabbitmq-plugins enable rabbitmq_management
# rabbitmqctl add_user admin 123456
# set_user_tags admin administrator
# rabbitmqctl set_user_tags admin administrator
# rabbitmqctl set_permissions -p / admin “.*” “.*” “.*”
生成新的image
sudo docker commit -m="has mysql" -a="river" 0831e1d395ff river/centos-mysql-redis-rabbitmq
stop 之前的容器,否则端口被占用
sudo docker stop 0831e1d395ff
启动新的容器(加上了5672 和 15672 两个端口)
sudo docker run -itd --privileged=true -p 3306:3306 -p 6379:6379 -p 5672:5672 -p 15672:15672 river/centos-mysql-redis-rabbitmq init
sudo docker exec -it 3a958e106be4 bash
web登录进来看看效果
image.png参考地址
https://www.linuxprobe.com/install-rabbitmq-on-centos-7.html
网友评论