services: nginx: image: nginx:latest ports: - "80:80" healthcheck: test: ["CMD", "nc", "-z", "localhost", "80"] interval: 5s timeout: 10s retries: 15 start_period: 5s command: > sh -c "apt-get update && apt-get install -y netcat && nginx -g 'daemon off;'" networks: - app-network postgres: image: postgres:latest environment: POSTGRES_DB: mydb POSTGRES_USER: user POSTGRES_PASSWORD: password healthcheck: test: ["CMD", "nc", "-z", "localhost", "5432"] interval: 5s timeout: 10s retries: 15 start_period: 5s command: > sh -c "apt-get update && apt-get install -y netcat && docker-entrypoint.sh postgres" networks: - app-network redis: image: redis:latest healthcheck: test: ["CMD", "sh", "-c", "nc -z localhost 6379 || exit 1"] interval: 5s timeout: 10s retries: 15 start_period: 5s command: > sh -c "apk add --no-cache netcat-openbsd && redis-server" networks: - app-network networks: app-network: driver: bridge