docker search rocketmq
检索具体版本
curl https://registry.hub.docker.com/v1/repositories/foxiswho/rocketmq/tags | tr -d '[\[\]" ]' | tr '}' '\n' | awk -F: -v image='foxiswho/rocketmq' '{if(NR!=NF && $3 != ""){printf("%s:%s\n",image,$3)}}'
查看当前镜像所有的版本shell命令
curl https://registry.hub.docker.com/v1/repositories/foxiswho/rocketmq/tags\ | tr -d '[\[\]" ]' | tr '}' '\n'\ | awk -F: -v image='foxiswho/rocketmq' '{if(NR!=NF && $3 != ""){printf("%s:%s\n",image,$3)}}'
docker run -d -p 9876:9876 --name rmqserver foxiswho/rocketmq:server-4.5.1
docker run -d -p 10911:10911 -p 10909:10909\ --name rmqbroker --link rmqserver:namesrv\ -e "NAMESRV_ADDR=namesrv:9876" -e "JAVA_OPTS=-Duser.home=/opt"\ -e "JAVA_OPT_EXT=-server -Xms128m -Xmx128m"\ foxiswho/rocketmq:broker-4.5.1
docker run -d --name rmqconsole -p 8180:8080 --link rmqserver:namesrv\ -e "JAVA_OPTS=-Drocketmq.namesrv.addr=namesrv:9876\ -Dcom.rocketmq.sendMessageWithVIPChannel=false"\ -t styletang/rocketmq-console-ng
然后通过如下命令检查一下启动情况
docker ps|grep rocketmq
http://192.168.23.131:8180/
由于我在宿主机安装rocketmq,测试如下:
#测试消息发送命令
sh tools.sh org.apache.rocketmq.example.quickstart.Producer
#测试消息接收命令
sh tools.sh org.apache.rocketmq.example.quickstart.Consumer
查看rmqbroker IP
docker inspect rmqbroker
Broker容器中默认的配置文件的路径为
/etc/rocketmq/broker.conf
进入rmqbroker容器
docker exec -it rmqbroker /bin/bash
cd /etc/rocketmq/
vi broker.conf
官网:Apache RocketMQ
参考:
Docker中RocketMQ的安装与使用_冯立彬的博客-CSDN博客_docker rocketmq