Traefik Healthcheck
Add a healthcheck to a Traefik service in Docker Compose.
1 min read
Updated
A Docker Compose service definition that gives Traefik a healthcheck, so dependent services wait until the reverse proxy is actually ready. The Compose file is below.
docker-compose.yaml
yaml
---
version: '3.9'
networks:
net:
driver: bridge
services:
traefik:
image: traefik:2.11.0
restart: unless-stopped
networks:
- net
ports:
- 80:80
- 443:443
healthcheck:
test: nc -zv `hostname` 80 >/dev/null 2>&1 || exit 1
interval: 10s
timeout: 1s
retries: 3
start_period: 10sSomething wrong or want to discuss this article?
Get in touch
Related articles
- Sep 25, 2026 Ṣeto: a small orchestrator for DockerDocker · Networking · Security · Hardware · Traefik · Linux · Python
- Sep 18, 2026 Docker Swarm: How to Fix “error creating vxlan interface: file exists”Docker · Networking
- Sep 27, 2025 Fixing Docker Swarm Startup Failures on Debian 13 Due to Network TimingDocker · Linux · Networking