Self-host Traefik
A cloud-native reverse proxy that auto-discovers your Docker containers via labels and provisions TLS for them automatically. More setup than a UI proxy, but unbeatable once your stack grows.
Key facts
Pick Traefik when your services live in Docker and you want routes and TLS to appear from container labels: the MIT-licensed Go binary watches the Docker socket, provisions Let's Encrypt certificates (wildcards too, but only via a DNS-01 challenge — our snippet uses HTTP-01) and reloads without restarts, with a dashboard, metrics and access logs built in. The README's release cycle is three or four minor versions a year, each supported only until the next ships; v3 is the current major (3.7.13 as of September 2026). Our snippet is the safe starting point — it disables `exposedByDefault`, so nothing is routed until you label it.
Follow the Traefik deploy guide →What you need
- Any VPS with at least 256 MB of RAM
- A domain you control — most self-hosted setups need HTTPS in front of them
- About an afternoon — budget time for troubleshooting
Paid link — we earn a commission if you shop through it.
Install with Docker Compose
Save this as compose.yml and run docker compose up -d:
# Traefik — reverse proxy; reads Docker labels, ACME via Let's Encrypt
services:
traefik:
image: traefik:v3
command:
- --providers.docker=true
- --providers.docker.exposedbydefault=false
- --entrypoints.web.address=:80
- --entrypoints.websecure.address=:443
- --certificatesresolvers.le.acme.email=you@example.com
- --certificatesresolvers.le.acme.storage=/letsencrypt/acme.json
- --certificatesresolvers.le.acme.httpchallenge.entrypoint=web
ports: ["80:80", "443:443"]
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- ./letsencrypt:/letsencrypt
# docker compose up -d — then label each app: traefik.http.routers.<n>.rule=Host(`app.example.com`)What you take on
Traefik's power is the socket and the labels; its docs are direct about the responsibility both carry: