Labelgate

Labels

How Labelgate labels are written, and what happens when one is wrong.

Add labels to a container and Labelgate creates the matching Cloudflare DNS records, Tunnel routes and Access policies. Remove the container and they are cleaned up.

services:
  whoami:
    image: traefik/whoami
    labels:
      # Publish http://whoami:80 at https://app.example.com through your tunnel
      labelgate.tunnel.web.hostname: "app.example.com"
      labelgate.tunnel.web.service: "http://whoami:80"

Only running containers are read. If docker.filter_label is set, only containers that carry that label are read.

Label format

labelgate.<type>.<name>.<property>: "<value>"
PartWhat it isExample
labelgateThe prefix. Change it with label_prefix (LABELGATE_LABEL_PREFIX).labelgate
<type>What to create: dns, tunnel or access.tunnel
<name>A name you choose. Labels with the same name belong together.web
<property>The setting. Each type has its own list.hostname

The name part

The name groups labels into one record or route. Pick any name. It only shows up in the dashboard and in logs.

Use a different name for each record or route on the same container:

labels:
  labelgate.tunnel.web.hostname: "www.example.com"
  labelgate.tunnel.web.service: "http://app:80"
  labelgate.tunnel.api.hostname: "api.example.com"
  labelgate.tunnel.api.service: "http://app:3000"

Rules for names:

  • Use lowercase letters, digits and -. Do not start or end with -.
  • Do not use a property name: hostname, service, type, target, proxied, ttl, cleanup, credential, tunnel, path, origin, access, priority, weight, port, flags, tag, comment.
  • default is special. labelgate.dns.default.* and labelgate.tunnel.default.* set defaults for the other names in the same container. See DNS and Tunnel.

Hostnames

  • Case and a trailing dot are ignored: App.Example.com. is app.example.com.
  • A leading wildcard is allowed: *.example.com.

One hostname, one owner

  • A tunnel route creates its own DNS record. Do not add a dns label for the same hostname. The second one gets a conflict error.
  • If two names claim the same hostname and record type (in one container or several), the one that had it first keeps it. The other gets a conflict error.
  • Several MX, TXT, SRV or CAA records on one hostname are fine.
  • Labelgate never changes records it did not create. If Cloudflare already has a record for the hostname, you get conflict: existing record not owned by labelgate. Delete that record in Cloudflare or use another hostname. See Ownership & Conflicts.

When a label is wrong

Labelgate checks every label. Problems appear in the log and in the dashboard, with the container name and the label key.

MistakeWhat happens
Invalid value, e.g. proxied: "maybe"That name is skipped. Records it already created stay as they are until you fix the label.
Unknown property, e.g. labelgate.dns.web.proxyedError reported. The rest of that name still works.
Unknown type or too few parts, e.g. labelgate.dnss.web.hostnameError reported. The label is ignored.
Invalid default labelEvery name of that type in the container is skipped.
Label without the prefixIgnored silently.

Booleans accept true/false, yes/no, on/off and 1/0.

Label types

On this page