Skip to content
gohacks.dev
DevOps

Traefik Docker Labels Generator

Generate Traefik v3 Docker Compose labels for a router with a host rule, TLS through a certificate resolver, an HTTPS redirect, security headers, prefix stripping and basic auth.

Free · No sign-up · Your inputs stay in your browser

Input

Generate Traefik Docker labels

Output

compose.yaml labels

1,043 characters

Assumes Traefik v3 runs with entrypoints named web (:80) and websecure (:443), a certificate resolver of the same name, and a shared external network called proxy. The loadbalancer port label is what lets Traefik reach a container that exposes several ports, or none.

Runs in this browser. Nothing you paste is sent to a server.

How Traefik finds the container

Traefik's Docker provider watches the Docker API and builds routes from container labels, so adding a service is a label change rather than a proxy config change. The container and Traefik must share a network, and loadbalancer.server.port tells Traefik which port to use when the container exposes several. See the Docker provider routing reference.

Dollar signs in Compose

Basic auth hashes from htpasswd contain $ characters, and Compose treats $ as the start of a variable. Each one has to be doubled to $$ in the YAML, which the generator does.

Share

Frequently asked questions

Does Traefik get Let's Encrypt certificates automatically?
Yes, once a certificate resolver is configured in Traefik's static configuration with an ACME email and storage. Routers that name the resolver get certificates for their Host rules.
Why does my router return 404?
Traefik matched no router: check the Host rule matches the request, the container has traefik.enable=true when exposedByDefault is off, and Traefik and the container share a network.
Is what I paste sent anywhere?
No. The tool runs entirely in your browser with JavaScript. Nothing you type or paste is sent to our server or stored.

Keep planning

Similar tools