version: "3.8" services: nacos1: image: nacos/nacos-server:${NACOS_VERSION} container_name: nacos1 networks: nacos_net: ipv4_address: 172.16.238.10 volumes: - ./cluster-logs/nacos1:/home/nacos/logs ports: - "8848:8848" - "9848:9848" env_file: - ../env/nacos-ip.env restart: on-failure depends_on: mysql: condition: service_healthy nacos2: image: nacos/nacos-server:${NACOS_VERSION} container_name: nacos2 networks: nacos_net: ipv4_address: 172.16.238.11 volumes: - ./cluster-logs/nacos2:/home/nacos/logs ports: - "8849:8848" - "9849:9848" env_file: - ../env/nacos-ip.env restart: always depends_on: mysql: condition: service_healthy nacos3: image: nacos/nacos-server:${NACOS_VERSION} container_name: nacos3 networks: nacos_net: ipv4_address: 172.16.238.12 volumes: - ./cluster-logs/nacos3:/home/nacos/logs ports: - "8850:8848" - "9850:9848" env_file: - ../env/nacos-ip.env restart: always depends_on: mysql: condition: service_healthy mysql: container_name: mysql build: context: . dockerfile: ./image/mysql/5.7/Dockerfile image: example/mysql:5.7 networks: nacos_net: ipv4_address: 172.16.238.13 env_file: - ../env/mysql.env volumes: - ./mysql:/var/lib/mysql ports: - "3306:3306" healthcheck: test: [ "CMD", "mysqladmin" ,"ping", "-h", "localhost" ] interval: 5s timeout: 10s retries: 10 networks: nacos_net: driver: bridge ipam: driver: default config: - subnet: 172.16.238.0/24