nacos-docker/example/cluster-hostname.yaml
2023-03-21 19:51:06 +08:00

73 lines
1.5 KiB
YAML

version: "3.8"
services:
nacos1:
hostname: nacos1
container_name: nacos1
image: nacos/nacos-server:${NACOS_VERSION}
volumes:
- ./cluster-logs/nacos1:/home/nacos/logs
ports:
- "7848:7848"
- "8848:8848"
- "9868:9848"
- "9850:9849"
env_file:
- ../env/nacos-hostname.env
restart: always
depends_on:
mysql:
condition: service_healthy
nacos2:
hostname: nacos2
image: nacos/nacos-server:${NACOS_VERSION}
container_name: nacos2
volumes:
- ./cluster-logs/nacos2:/home/nacos/logs
ports:
- "7849:7848"
- "8849:8848"
- "9869:9848"
- "9851:9849"
env_file:
- ../env/nacos-hostname.env
restart: always
depends_on:
mysql:
condition: service_healthy
nacos3:
hostname: nacos3
image: nacos/nacos-server:${NACOS_VERSION}
container_name: nacos3
volumes:
- ./cluster-logs/nacos3:/home/nacos/logs
ports:
- "7850:7848"
- "8850:8848"
- "9870:9848"
- "9852:9849"
env_file:
- ../env/nacos-hostname.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
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