基础镜像已经打好 需要安装curl命令以便健康检查
看到以前的资料说是3版本废弃了depend下的condition,自己去使用和查资料的时候好像修复了。因为wait-for-it.sh这个实在是太难用了。使用condition需要确保镜像里有对应的命令,如curl
version: '3'
services:
mysql:
hostname: mysql
image: 10.10.3.5/cta/mysql_base:01
container_name: mysql
volumes:
- ./mysql/mysql.cnf:/etc/mysql/conf.d/mysql.cnf
- ./mysql/mysqld.cnf:/etc/mysql/mysql.conf.d/mysqld.cnf
- ./mysql/init:/docker-entrypoint-initdb.d/
#- ./mysql/data:/var/lib/mysql
privileged: true
network_mode: "host"
environment:
- MYSQL_ROOT_PASSWORD=123
- TZ=Asia/Shanghai
- LANG=en_US.UTF-8
healthcheck:
# mysqladmin -uroot -p123 ping -h127.0.0.1
test: [ "CMD", "mysqladmin" ,"ping", "-h", "localhost" ]
# test: [ "CMD", "mysqladmin","-u","root","-p","123" ,"ping", "-h", "127.0.0.1" ]
timeout: 45s
interval: 10s
retries: 10
nginx:
hostname: nginx
image: nginx:1.20.2
volumes:
- ./nginx/nginx.conf:/etc/nginx/nginx.conf
- ./nginx/platform.conf:/etc/nginx/conf.d/platform.conf
- ./nginx/svrshell:/root/svrshell
- ./nginx/aiviewer:/root/aiviewer
# 增加cta
- ./nginx/dwcta:/root/dwcta
# 增加input挂载
- /data1/inputdata:/data1/inputdata
container_name: nginx
privileged: true
network_mode: "host"
environment:
- TZ=Asia/Shanghai
- LANG=en_US.UTF-8
zk:
# zookeeper 修改了zoo.cfg的data和datalog路径 /opt/zk1/zookeeper-3.4.10
hostname: zk
image: 10.10.3.5/cta/zookeeper:3.4.10
healthcheck:
# test: ["CMD-SHELL", "curl -sS 127.0.0.1:2181 || exit 1"]
test: ["CMD-SHELL", "echo 'ruok' | curl -s telnet://localhost:2181 || exit 1"]
interval: 1m30s
timeout: 10s
retries: 3
start_period: 40s
depends_on:
mysql:
condition: service_healthy
# condition: service_started
volumes:
- ./zk/zoo.cfg:/conf/zoo.cfg
# - /opt/zk1/zookeeper-3.4.10/data:/data
# - /opt/zk1/zookeeper-3.4.10/datalog:/datalog
container_name: zk
privileged: true
network_mode: "host"
# ports:
# - 2181:2181
es_python:
hostname: es_python
image: es_python:1.1
volumes:
- /data1/es_data:/usr/share/elasticsearch/data
container_name: es_python
privileged: true
network_mode: "host"
environment:
- TZ=Asia/Shanghai
- LANG=en_US.UTF-8
# 应用
aiserverconfig:
# 20882 11383
hostname: aiserverconfig
image: 10.10.3.5/cta/aiserverconfig-cta_1215_20220112_002:latest
healthcheck:
test: ["CMD-SHELL", "curl -sS 127.0.0.1:11383 || exit 1"]
interval: 1m30s
timeout: 10s
retries: 3
start_period: 40s
depends_on:
mysql:
condition: service_healthy
zk:
condition: service_healthy
volumes:
- /etc/sign.conf:/etc/sign.conf
- /data1/container-root/aiserverconfig/log:/root/aiserverconfig/log
# 增加input挂载
- /data1/inputdata:/data1/inputdata
container_name: aiserverconfig
privileged: true
network_mode: "host"
aiserver:
# 20880 11381
hostname: aiserver
image: 10.10.3.5/cta/aiserver-cta_1215_20220112_002:latest
healthcheck:
test: ["CMD-SHELL", "curl -sS 127.0.0.1:11381/aiserver/ai/v1/echo || exit 1"]
interval: 1m30s
timeout: 10s
retries: 3
start_period: 40s
depends_on:
mysql:
condition: service_healthy
zk:
condition: service_healthy
aiserverconfig:
condition: service_healthy
volumes:
- /etc/sign.conf:/etc/sign.conf
- /data1/container-root/aiserver/log:/root/aiserver/log
# 增加input挂载
- /data1/inputdata:/data1/inputdata
container_name: aiserver
privileged: true
network_mode: "host"
pacsserver:
# 20881 22222 11380
hostname: pacsserver
image: 10.10.3.5/cta/pacsserver-cta_1215_20220112_002:latest
healthcheck:
test: ["CMD-SHELL", "curl -sS 127.0.0.1:11384/pacs/v2/dicom/echo || exit 1"]
interval: 1m30s
timeout: 10s
retries: 3
start_period: 40s
depends_on:
mysql:
condition: service_healthy
zk:
condition: service_healthy
aiserverconfig:
condition: service_healthy
aiserver:
condition: service_healthy
volumes:
- /etc/sign.conf:/etc/sign.conf
- /data1/container-root/pacsserver/log:/root/pacsserver/log
# 增加input挂载
- /data1/inputdata:/data1/inputdata
container_name: pacsserver
privileged: true
network_mode: "host"
platform:
# 11380 11345
hostname: platform
image: 10.10.3.5/cta/platform-cta_1215_20220112_002:latest
healthcheck:
test: ["CMD-SHELL", "curl -sS 127.0.0.1:11380/echo || exit 1"]
interval: 1m30s
timeout: 10s
retries: 3
start_period: 40s
depends_on:
mysql:
condition: service_healthy
zk:
condition: service_healthy
aiserverconfig:
condition: service_healthy
aiserver:
condition: service_healthy
volumes:
- /etc/sign.conf:/etc/sign.conf
- /data1/container-root/platform/log:/root/platform/log
# 增加input挂载
- /data1/inputdata:/data1/inputdata
container_name: platform
privileged: true
network_mode: "host"
ocrsvr:
# 28800
hostname: ocrsvr
image: 10.10.3.5/cta/ocrsvr-cta_1215_20220112_002:latest
depends_on:
mysql:
condition: service_healthy
zk:
condition: service_healthy
aiserverconfig:
condition: service_healthy
aiserver:
condition: service_healthy
volumes:
- /etc/sign.conf:/etc/sign.conf
- /data1/container-root/ocrsvr/log:/root/ocrsvr/log
# 增加input挂载
- /data1/inputdata:/data1/inputdata
container_name: ocrsvr
privileged: true
network_mode: "host"
lung:
# 20880 11381
hostname: lung
image: 10.10.3.5/cta/lung-cta_1215_20220112_002:latest
depends_on:
mysql:
condition: service_healthy
zk:
condition: service_healthy
aiserverconfig:
condition: service_healthy
aiserver:
condition: service_healthy
volumes:
- /etc/sign.conf:/etc/sign.conf
- /data1/container-root/lung/log:/root/lung/log
# 增加input挂载
- /data1/inputdata:/data1/inputdata
- /tmp/.X11-unix:/tmp/.X11-unix
container_name: lung
privileged: true
network_mode: "host"
environment:
- NVIDIA_DRIVER_CAPABILITIES=all
- DISPLAY
- XAUTHORITY
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: all
capabilities: [gpu]
启动顺序如下 需要depend的容器为healthy才会启动下一个
重启策略
deploy:
restart_policy:
condition: always
|