安装Zookeeper
拉取镜像
shell
docker pull zookeeper:3.9.2
启动容器
-d后台启动,-p映射容器2181端口到宿主机2181端口,限制容器最大内存占用为128m,--restart容器自动重启
shell
docker run -d -p 2181:2181 -m 128m --restart=always --name zookeeper zookeeper:3.9.2
安装RocketMQ
shell
docker pull apache/rocketmq:4.9.7
启动顺序mqnamesrv------》mqbroker
shell
docker run -d -p 9876:9876 -m 256m --restart=always --name rmqnamesrv apache/rocketmq:4.9.7 sh mqnamesrv
mqbroker中的rmqnamesrv、namesrv、9876端口号和上面的保持一致
shell
docker run -d -p 10909:10909 -p 10911:10911 --restart=always --name rmqbroker --link rmqnamesrv:namesrv -e "NAMESRV_ADDR=namesrv:9876" -e "JAVA_OPT_EXT=-server -Xmn128m -Xms256m -Xmx256m" apache/rocketmq:4.9.7 sh mqbroker
安装RocketMQ Dashboard
shell
docker pull apacherocketmq/rocketmq-dashboard:latest
启动后访问localhost:9877
shell
docker run -d -t -p 9877:8080 -m 256m --restart=always --name rocketmq-dashboard -e "JAVA_OPTS=-Drocketmq.namesrv.addr=127.0.0.1:9876" apacherocketmq/rocketmq-dashboard:latest