version: '2.1'
services:
web:
depends_on:
db:
condition: service_healthy
build: ./
db:
image: postgres:alpine
restart: always
ports:
- "8082:5432"
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: vticket
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:5432"]
interval: 30s
timeout: 10s
retries: 5
我需要做哪些服务以等待数据库启动? 试图用不同的方式做到这一点。无论如何,它首先运行网络。