Traefik Label Generator
Build Traefik v2/v3 Docker labels visually for docker-compose.
Client-side only — nothing leaves your browser
Label syntax is identical between v2 and v3 for these options.
Used as router/service identifier
Port your app listens on inside the container
Comma-separate for multiple hosts: a.example.com, b.example.com
Name of the certificatesResolver from your traefik.yml
Reference middlewares defined elsewhere (file provider, other containers).
Set when the container is on multiple networks
labels:
- "traefik.enable=true"
- "traefik.http.middlewares.myapp-https-redirect.redirectscheme.scheme=https"
- "traefik.http.middlewares.myapp-https-redirect.redirectscheme.permanent=true"
- "traefik.http.routers.myapp.rule=Host(`app.example.com`)"
- "traefik.http.routers.myapp.entrypoints=web"
- "traefik.http.routers.myapp.service=myapp"
- "traefik.http.routers.myapp.middlewares=myapp-https-redirect"
- "traefik.http.routers.myapp-secure.rule=Host(`app.example.com`)"
- "traefik.http.routers.myapp-secure.entrypoints=websecure"
- "traefik.http.routers.myapp-secure.service=myapp"
- "traefik.http.routers.myapp-secure.tls=true"
- "traefik.http.routers.myapp-secure.tls.certresolver=letsencrypt"
- "traefik.http.services.myapp.loadbalancer.server.port=3000"Paste under your service in docker-compose.yml. Indentation is YAML-correct.
What Are Traefik Docker Labels?
Traefik labels are key-value pairs you attach to a Docker container that tell Traefik how to route traffic to it. When the Docker provider is enabled, Traefik watches the Docker socket for containers carrying labels with the traefik.* prefix and dynamically builds routers, services, and middlewares from them — no separate config file edit required. This makes labels the standard way to expose containers behind Traefik in docker-compose, Docker Swarm, and Portainer setups.
Anatomy of a Traefik Label
Every Traefik label follows the same dotted-key structure. The first segment is always traefik, followed by the resource type (router, service, middleware), the resource name, and the property being set.
| Label | Purpose |
|---|---|
| traefik.enable=true | Opt this container into Traefik routing |
| traefik.http.routers.<name>.rule | Match expression (Host, Path, Headers...) |
| traefik.http.routers.<name>.entrypoints | Which entrypoint(s) to listen on (web, websecure) |
| traefik.http.routers.<name>.tls=true | Terminate TLS for this router |
| traefik.http.routers.<name>.tls.certresolver | Name of the cert resolver (e.g. letsencrypt) |
| traefik.http.routers.<name>.middlewares | Comma-separated middleware chain to apply |
| traefik.http.services.<name>.loadbalancer.server.port | Port the container listens on internally |
| traefik.docker.network | Pick a specific network when container is on many |
Common Traefik Middlewares
| Middleware | What it does |
|---|---|
| redirectscheme | Force HTTP requests to redirect to HTTPS |
| stripprefix | Remove a leading path before forwarding to the backend |
| addprefix | Prepend a path before forwarding |
| basicauth | Require HTTP basic authentication (htpasswd users) |
| headers | Set, replace, or remove request/response headers |
| ipallowlist | Allow only specific source IP ranges (v3) |
| ratelimit | Throttle requests per source |
| compress | gzip-compress responses |
| forwardauth | Delegate auth to an external service (Authelia, Authentik) |
Frequently Asked Questions
What is the difference between Traefik labels and a config file?
Why are my Traefik labels not working?
How do I configure multiple hosts or middlewares with labels?
Are Traefik v2 and v3 labels the same?
Can I use Traefik with Docker without labels?
Related Tools
Need to manage SSH connections?
SSH Workbench lets you connect, browse files, and manage servers visually.
Try SSH Workbench Free