Skip to content

ContainerLabels.md

Chris edited this page Apr 22, 2025 · 9 revisions

Container Labels

Docker labels are the primary mechanism used to tell DockFlare which containers to expose and how to configure their public access via the Cloudflare Tunnel.

DockFlare monitors Docker events and inspects container labels. If a container has the required labels, DockFlare will automatically configure the necessary DNS records and Cloudflare Tunnel ingress rules.

Label Prefix

DockFlare looks for labels starting with a specific prefix.

  • Default Prefix: cloudflare.tunnel
  • Custom Prefix: You can change this using the LABEL_PREFIX environment variable.

In the examples below, we will use the default prefix cloudflare.tunnel. If you set a custom prefix (e.g., LABEL_PREFIX=cf.ingress), replace cloudflare.tunnel with cf.ingress in your labels.

Core Labels

These labels are essential for exposing a service:

Label Description Required Example
{prefix}.enable Must be set to "true" for DockFlare to manage this container. Yes cloudflare.tunnel.enable="true"
{prefix}.hostname The public hostname (subdomain) you want to use to access the service. Must be within a zone managed by your Cloudflare account. Yes cloudflare.tunnel.hostname="app.example.com"
{prefix}.service The internal network address of the service within Docker that the tunnel should forward traffic to. Format: protocol://hostname:port. Yes cloudflare.tunnel.service="http://my-app-container:80"

Optional Labels

These labels allow for more specific configuration:

Label Description Required Example
{prefix}.zonename Specifies the Cloudflare zone (domain name, e.g., example.com) that the hostname belongs to. Overrides the default CF_ZONE_ID env var for this rule. No cloudflare.tunnel.zonename="mydomain.org"
{prefix}.no_tls_verify If set to "true", Cloudflare Tunnel will not verify the TLS certificate of the internal service (useful for self-signed certs or HTTP services). No cloudflare.tunnel.no_tls_verify="true"

Labeling Approaches

DockFlare supports two ways to apply these labels:

  1. Basic Usage (Single Domain): Use simple labels ({prefix}.hostname, {prefix}.service, etc.) to expose one hostname per container.
  2. Using Multiple Domains (Indexed Labels): Use indexed labels ({prefix}.0.hostname, {prefix}.1.hostname, etc.) to expose multiple hostnames, potentially with different configurations, from a single container.

See the linked pages for detailed examples of how to apply these labels in your docker-compose.yml or docker run commands.

Clone this wiki locally