Free Traefik Docker Labels Generator for Compose and File YAML

Traefik Docker Labels Generator

Describe your service and get the Traefik labels for docker-compose.yml in list and map syntax, a ready service snippet, and the same routers, middlewares and service as file-provider YAML. Each label comes with a one-line explanation, and every warning names the value to fix. Built from the Traefik v3.7 and v2.11 documentation and source.

Traefik and service

Traefik version

Optional. Also names the service and middlewares.

The port the app listens on inside the container, not a published host port.

Routing

One or more host names, separated by commas, spaces or new lines. *.example.com works on Traefik v3.7 and newer.

Names from Traefik’s static config, comma-separated.

HTTPS

The name under certificatesResolvers. Leave empty to use certificates you load yourself.

Port 80 entrypoint, used by the redirect and the ACME HTTP challenge.

Docker provider and network

Defaults to the folder name of the Compose file.

Middlewares

For a Content-Security-Policy, Permissions-Policy and the other headers, use the CSP and HTTP Security Headers Builder: it writes Traefik labels and file config too.

Paste the output of htpasswd -nB admin (package apache2-utils) as it is. This tool does not create hashes. The line stays in this page: it is not sent anywhere and not saved in the share link.

Checks

    Output

    
            

    What each label does

      Sources and limits

      • Traefik Docker routing labels Traefik v3.7.16 docs Label names, traefik.enable, traefik.docker.network, service port, no @ in names.
      • Router rules v3.7.16 docs, v2.11.60 routers page Host and PathPrefix, one value per matcher in v3, lists in v2, wildcard Host since v3.7.0.
      • v2 to v3 migration details v3.7.16 docs Rule syntax changes, IPWhiteList renamed to IPAllowList (deprecated in v2.11).
      • BasicAuth middleware v3.7.16 docs and source Accepted hashes (MD5 apr1 and $1$, SHA1, bcrypt) checked in Traefik’s go-http-auth fork; $$ in Compose.
      • Entrypoints and redirections v3.7.16 docs Entrypoint-wide HTTP to HTTPS redirect, router TLS replacing entrypoint TLS.
      • Compose interpolation Compose Specification, 2026-10-23 Why every $ in a label becomes $$, list and map label syntax, network names.

      Not covered: TCP and UDP routers, Docker Swarm (labels go under deploy.labels and v3.2.2+ reads traefik.swarm.network), Kubernetes, and middlewares other than the ones above. The generator cannot see your Traefik static config, so entrypoint and resolver names are taken as you type them.

      Built by VahaC — 100% client-side, no data sent anywhere.

      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=true for setups with exposedByDefault: false, and traefik.docker.network with 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:

      1. Pick your Traefik version: v3 (the default), v2.11, or v2.10 and older.
      2. Enter the Compose service name, the domains, the container port and your entrypoint names.
      3. Set TLS and the certificate resolver name exactly as they appear in your static config, and choose how HTTP should redirect to HTTPS.
      4. Enter the Docker network you share with Traefik, then switch on the middlewares you need.
      5. 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:

      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.