# The minimal zookeeper service # github.com/yeasy/docker-compose-files # * zk: zk node for zookeeper, 0, 1, 2 # * zookeeper: zookeeper service, will default to connect to zookeeper # * cli: client to test zookeeper service version: '3' services: zookeeper1: image: yeasy/zookeeper:3.5.6 container_name: zookeeper1 hostname: zookeeper1 ports: - "2182:2181" # zk connection port environment: - ZK_ID=1 # when bootup, will read this and update the /tmp/zookeeper/myid file - ZK_HOST1=zk_zookeeper1 # specify the host addrs of each zk - ZK_HOST2=zk_zookeeper2 - ZK_HOST3=zk_zookeeper3 healthcheck: disable: true command: bash -c 'bash /tmp/start_zk.sh' zookeeper2: image: yeasy/zookeeper:3.5.6 container_name: zookeeper2 hostname: zookeeper2 ports: - "2183:2181" # zk connection port environment: - ZK_ID=2 # when bootup, will read this and update the /tmp/zookeeper/myid file - ZK_HOST1=zk_zookeeper1 # specify the host addrs of each zk - ZK_HOST2=zk_zookeeper2 - ZK_HOST3=zk_zookeeper3 healthcheck: disable: true command: bash -c 'bash /tmp/start_zk.sh' zookeeper3: image: yeasy/zookeeper:3.5.6 container_name: zookeeper3 hostname: zookeeper3 ports: - "2181:2181" # zk connection port environment: - ZK_ID=3 # when bootup, will read this and update the /tmp/zookeeper/myid file - ZK_HOST1=zk_zookeeper1 # specify the host addrs of each zk - ZK_HOST2=zk_zookeeper2 - ZK_HOST3=zk_zookeeper3 healthcheck: disable: true command: bash -c 'bash /tmp/start_zk.sh' cli: # used for testing zookeeper cmds, see /tmp/*.sh image: yeasy/zookeeper:3.5.6 container_name: cli hostname: cli environment: - ZK_HOST=zookeeper1 # zk host to connect to - ZK_HOST1=zk_zookeeper1 # specify the host addrs of each zk - ZK_HOST2=zk_zookeeper2 - ZK_HOST3=zk_zookeeper3 healthcheck: disable: true # bash /opt/zookeeper/bin/zkCli.sh -server ${ZK_HOST}:2181 command: bash -c 'while true; do sleep 20200116; done'