✓ Works

Docker Compose v2 Healthcheck: Same Syntax as v1; Fully Supported

Docker Compose v2 + Healthcheck configuration

The `healthcheck` key in compose.yml has identical syntax in v1 and v2 (`test`, `interval`, `timeout`, `retries`, `start_period`). In Compose v2, the `depends_on` condition `service_healthy` works more reliably than in v1. Example: `test: ["CMD", "curl", "-f", "http://localhost:8080/health"]`.

Related Combinations

Docker Compose v2 + Docker Engine 23.0+ ✓ Works Docker Compose v2 + Ubuntu 22.04 LTS ✓ Works Docker Compose v2 + Ubuntu 24.04 LTS ✓ Works Docker Compose v2 + macOS (Docker Desktop) ✓ Works
Last verified: 2024-10-01  ·  Category: Docker Compose + Engine