version: "3"
services:
  etcd0:
    image: quay.io/coreos/etcd:v3.4.0
    container_name: etcd
    ports:
      - 23790:2379
      - 23800:2380
    volumes:
      - etcd0:/etcd-data
    environment:
      - ETCD0=localhost
    command:
      - /usr/local/bin/etcd
      - -name
      - etcd0
      - --data-dir
      - /etcd_data
      - -advertise-client-urls
      - http://etcd0:2379
      - -listen-client-urls
      - http://0.0.0.0:2379
      - -initial-advertise-peer-urls
      - http://etcd0:2380
      - -listen-peer-urls
      - http://0.0.0.0:2380
      - -initial-cluster
      - etcd0=http://etcd0:2380
    networks:
      - easyfl

  docker-register:
    image: wingalong/docker-register
    container_name: docker-regiser
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    environment:
      - HOST_IP=172.25.0.1
      - ETCD_HOST=etcd0:2379
    networks:
      - easyfl
    depends_on:
      - etcd0

  tracker:
    image: easyfl-tracker
    container_name: easyfl-tracker
    ports:
      - "12666:12666"
    volumes:
      - /home/zwm/easyfl/tracker:/app/tracker
    networks:
      - easyfl
    environment:
      - PYTHONUNBUFFERED=1

  client:
    image: easyfl-client
    ports:
      - "23400-23500:23400"
    volumes:
      - /home/zwm/easyfl/easyfl/datasets/femnist/data:/app/easyfl/datasets/femnist/data
    command: ["--is-remote", "True", "--local-port", "23400", "--server-addr", "easyfl-server:23501", "--tracker-addr", "easyfl-tracker:12666"]
    networks:
      - easyfl
    environment:
      - PYTHONUNBUFFERED=1
    depends_on:
      - tracker
#      - etcd0
#      - docker-register

  server:
    image: easyfl-server
    container_name: easyfl-server
    ports:
      - "23501:23501"
    command: ["--is-remote", "True", "--local-port", "23501", "--tracker-addr", "easyfl-tracker:12666"]
    networks:
      - easyfl
    environment:
      - PYTHONUNBUFFERED=1
    depends_on:
      - tracker
#      - etcd0
#      - docker-register

#  trigger_run:
#    image: easyfl-run
#    command:
#      - --server-addr
#      - 172.21.0.1:23501
#      - --etcd-addr
#      - 172.21.0.1:2379
#    networks:
#      - easyfl
#    depends_on:
#      - client
#      - server

volumes:
  etcd0:

networks:
  easyfl: