This free Traefik Docker labels generator turns a short form into the exact labels: block your docker-compose.yml needs: router, TLS, HTTP to HTTPS redirect, Docker network and the common middlewares 🚦. It runs in your browser, explains every label it writes, and warns you with the concrete value to fix instead of leaving you to decode a 404 from Traefik’s logs.
If you have ever copied Traefik labels from a forum post, watched basic auth silently fail because Compose ate the $ signs in your hash, or wondered why Traefik picked the wrong network, this is built for that.
What This Traefik Docker Labels Generator Does
Fill in one service and the Traefik Docker labels generator returns everything Traefik needs to route it:
- 🧭 Routers: Host rules for one or more domains, an optional path prefix with StripPrefix, entrypoints, the container port and the backend scheme.
- 🔒 HTTPS: TLS with your certificate resolver, plus an HTTP to HTTPS redirect as a second router in the labels or as entrypoint-wide static config.
- 🐳 Docker provider:
traefik.enable=truefor setups withexposedByDefault: false, andtraefik.docker.networkwith the right name, including the Compose project prefix for a network defined in the same file. - 🛡️ Middlewares: basic auth from a pasted htpasswd line, an IP allowlist, and a small set of security headers (HSTS, X-Frame-Options, nosniff, Referrer-Policy).
- 📄 Five outputs: labels in list syntax, labels in map syntax, a ready Compose service snippet, the equivalent file-provider YAML, and the static config the labels expect.
- 💬 Explanations and checks: one line per label on what it does, and warnings that name the value and the fix, with a link to the matching Traefik docs page.
How to Use It
Using the Traefik Docker labels generator takes five steps:
- Pick your Traefik version: v3 (the default), v2.11, or v2.10 and older.
- Enter the Compose service name, the domains, the container port and your entrypoint names.
- Set TLS and the certificate resolver name exactly as they appear in your static config, and choose how HTTP should redirect to HTTPS.
- Enter the Docker network you share with Traefik, then switch on the middlewares you need.
- Fix anything listed under Checks, then copy the labels, the service snippet or the file-provider YAML 📋.
The share button copies a link with all your settings in the URL, so you can bookmark a setup or send it to someone. The Traefik Docker labels generator never puts the htpasswd line in that link.
Three Gotchas the Traefik Docker Labels Generator Handles
A label that looks fine can still fail in three quiet ways. The generator handles each one and tells you why.
Every $ in a hash becomes $$
Compose interpolates $VAR in every value, labels included. An htpasswd hash such as $apr1$... or $2y$05$... contains dollar signs, so Compose would swap parts of it for empty variables and your password would never match. The Traefik Docker labels generator doubles every $ for Compose, and keeps single $ in the file-provider YAML, where nothing is interpolated:
- "traefik.http.middlewares.app-auth.basicauth.users=admin:$$2y$$05$$..."
It also checks the hash itself. Traefik’s BasicAuth accepts MD5 ($apr1$), SHA1 ({SHA}) and bcrypt ($2y$). A SHA-512 hash from openssl passwd -6 or a plain-text password is rejected with a clear message, because Traefik would refuse every login. Create the line with htpasswd -nB admin instead; this tool never creates hashes itself.
v3 and v2 write rules differently
In Traefik v3 each Host() matcher takes one domain, so several domains are joined with ||. In v2, Host() takes a list. The IP allowlist is ipAllowList on v3 and v2.11, and ipWhiteList on older v2 releases. Wildcards like *.example.com work in Host() from Traefik v3.7, and the Traefik Docker labels generator reminds you that a wildcard certificate needs the DNS-01 challenge.
The network label needs the real name
If a container sits on more than one network, Traefik picks one at random unless traefik.docker.network is set. That label wants the real Docker network name, which for a network defined in the same Compose file is project_network, not the short key. The Traefik Docker labels generator builds that name from your project name, or uses the name as typed for an external network.
Practical Use Cases
People reach for a Traefik Docker labels generator in a few recurring situations:
- 🌐 Exposing a new self-hosted app behind Traefik with HTTPS in one paste. If you are still choosing between a VPN and a reverse proxy, read secure remote access for a home server first.
- 🧱 Building a stack from scratch: add Traefik labels to each service as you follow creating a Docker Compose stack from scratch.
- 🔐 Locking down an admin UI with basic auth and an IP allowlist, part of a wider Docker security for self-hosting checklist.
- 📦 Adapting templates: drop the generated labels into self-hosted Docker Compose templates or a visual Docker Compose editor.
- 🔁 Moving routes to the file provider: take the same config as dynamic YAML when a service runs outside Docker.
Got a docker run command instead of a Compose file? Convert it first with the Docker Run to Compose Converter, then check the result in the Docker Compose Validator. For a full Content-Security-Policy and the other security headers, the CSP and HTTP Security Headers Builder writes Traefik labels too.
Privacy, Ads, and Data Policy
- ✅ 100% free: no registration, no limits, no premium tier
- ✅ No data storage: your domains, settings and htpasswd lines never leave your browser
- ✅ No ads in results: no watermarks, no tracking pixels
- ✅ Client-side only: all generation runs in JavaScript, with no external API calls
That matters more than usual here: a Traefik Docker labels generator that sent your password hashes to a server would be a strange way to secure a homelab 🔒.
Open Source and Self-Hosting
This Traefik Docker labels generator is open source, available on GitHub. It is a single-folder deploy of three files (index.html, style.css, script.js) with no external libraries, no build step and no server-side runtime. Every rule it applies comes from the Traefik v3.7 and v2.11 documentation and source, and the sources are listed under the tool.
Browse the other free homelab and Docker utilities on the Tools page, or fork the Traefik Docker labels generator to add the middlewares your stack uses.
Built by VahaC — 100% client-side, no data sent anywhere.
