Update docker-compose healthcheck and restart policies
Replaces the db service healthcheck command with a custom script and adjusts its parameters for longer timeouts and retries. Also changes the app service's depends_on syntax and adds a restart policy to improve container reliability.
这个提交包含在:
父节点
bd1a92d660
当前提交
6938580513
共有 1 个文件被更改,包括 7 次插入 和 7 次删除
|
|
@ -14,10 +14,10 @@ services:
|
|||
- ./:/var/www/html:rw
|
||||
command: ["./script.sh"]
|
||||
depends_on:
|
||||
db:
|
||||
condition: service_healthy
|
||||
- db
|
||||
networks:
|
||||
- mynet
|
||||
restart: on-failure
|
||||
|
||||
db:
|
||||
build:
|
||||
|
|
@ -30,11 +30,11 @@ services:
|
|||
networks:
|
||||
- mynet
|
||||
healthcheck:
|
||||
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
|
||||
timeout: 20s
|
||||
retries: 10
|
||||
interval: 10s
|
||||
start_period: 30s
|
||||
test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
|
||||
timeout: 30s
|
||||
retries: 20
|
||||
interval: 15s
|
||||
start_period: 60s
|
||||
|
||||
volumes:
|
||||
db_data: {}
|
||||
|
|
|
|||
正在加载…
在新工单中引用