Docker-compose部署Rocketmq

1.创建docker-compose-rocketmq.yaml

version: '3.5'
services:
 rmqnamesrv:
   image: rocketmqinc/rocketmq
   container_name: rmqnamesrv
   restart: always
   ports:
      - 9876:9876
   environment:
    #内存分配
    JAVA_OPT_EXT: "-server -Xms128m -Xmx128m"
   volumes:
     - /data/rocketmq-docker/namesrv/logs:/root/logs
     - /data/rocketmq-docker/namesrv/store:/root/store
   command: sh mqnamesrv
   networks:
     rocketmq:
       aliases:
         - rmqnamesrv
 rmqbroker:
   image: rocketmqinc/rocketmq
   container_name: rmqbroker
   restart: always
   depends_on:
     - rmqnamesrv
   ports:
     - 10909:10909
     - 10911:10911
   volumes:
     - /data/rocketmq-docker/broker/logs:/root/logs
     - /data/rocketmq-docker/broker/store:/root/store
     - /data/rocketmq-docker/broker/conf/broker.conf:/opt/rocketmq-4.4.0/conf/broker.conf
   command: sh mqbroker -c /opt/rocketmq-4.4.0/conf/broker.conf
   environment:
     NAMESRV_ADDR: "rmqnamesrv:9876"
     JAVA_OPT_EXT: "-server -Xms128m -Xmx128m -Xmn128m"
   networks:
     rocketmq:
       aliases:
         - rmqbroker
 rmqconsole:
   image: styletang/rocketmq-console-ng
   container_name: rocketmq-console
   restart: always
   ports:
     - 8080:8080
   depends_on:
     - rmqnamesrv
   volumes:
     - /etc/localtime:/etc/localtime:ro
     - /data/rocketmq-docker/console/logs:/root/logs
   environment:
     JAVA_OPTS: "-Drocketmq.namesrv.addr=rmqnamesrv:9876 -Dcom.rocketmq.sendMessageWithVIPChannel=false"
   networks:
     rocketmq:
       aliases:
         - rmqconsole
networks:
  rocketmq:
    name: rocketmq
    driver: bridge

2.启动

docker-compose -f docker-compose-rocketmq.yaml up -d

你可能感兴趣的:(docker,docker,rocketmq)