Skip to content

EnvironmentVariables.md

Chris edited this page Apr 22, 2025 · 1 revision

Environment Variables

DockFlare is configured primarily through environment variables. These can be set directly in your docker run command or, more commonly, using an .env file with Docker Compose.

Variable Description Default Required?
Cloudflare Credentials
CF_API_TOKEN Your Cloudflare API token with Zone:DNS:Edit and Account:Cloudflare Tunnel:Edit permissions. (None) Yes
CF_ACCOUNT_ID Your Cloudflare account ID. Found in the Cloudflare dashboard overview. (None) Yes
CF_ZONE_ID The Zone ID of your default domain on Cloudflare. Used if a container label doesn't specify a zonename. (None) Yes (unless all containers use zonename)
Tunnel Configuration
TUNNEL_NAME The desired name for the Cloudflare Tunnel that DockFlare will create and manage (Internal Mode only). dockflared-tunnel Yes (unless USE_EXTERNAL_CLOUDFLARED=true)
Behavior Configuration
GRACE_PERIOD_SECONDS Time (in seconds) to wait before removing ingress rules after a labeled container stops. 28800 (8 hours) No
CLEANUP_INTERVAL_SECONDS How often (in seconds) DockFlare checks for stopped containers whose grace period has expired. 300 (5 minutes) No
LABEL_PREFIX The prefix used for Docker labels that DockFlare monitors. cloudflare.tunnel No
SCAN_ALL_NETWORKS If true, DockFlare scans containers across all Docker networks, not just its own. Useful if target containers are on different networks and not attached to cloudflare-net. false No
CLOUDFLARED_NETWORK_NAME The name of the Docker network used for the internally managed cloudflared agent. cloudflare-net No
STATE_FILE_PATH The path inside the container where the state.json file is stored. /app/data/state.json No
External Mode (Only relevant if using an existing cloudflared instance)
USE_EXTERNAL_CLOUDFLARED Set to true to enable External Mode. DockFlare will manage rules for an existing tunnel instead of creating one. false No
EXTERNAL_TUNNEL_ID The UUID of the existing Cloudflare Tunnel to manage when USE_EXTERNAL_CLOUDFLARED is true. (None) Yes (if USE_EXTERNAL_CLOUDFLARED=true)
Performance Tuning
MAX_CONCURRENT_DNS_OPS Maximum number of simultaneous DNS operations (create/delete) allowed. Helps prevent API rate limits. 3 No
RECONCILIATION_BATCH_SIZE Number of DNS records to process in each batch during startup reconciliation. 3 No

Example .env File:

# Required
CF_API_TOKEN=your_cloudflare_api_token_here
CF_ACCOUNT_ID=your_cloudflare_account_id_here
CF_ZONE_ID=your_cloudflare_zone_id_here

# Required for Internal Mode (Default)
TUNNEL_NAME=my-dockflare-tunnel

# Optional
GRACE_PERIOD_SECONDS=3600 # 1 hour grace period
LABEL_PREFIX=cf.ingress   # Use a different label prefix

# Example for External Mode (Mutually exclusive with TUNNEL_NAME)
# USE_EXTERNAL_CLOUDFLARED=true
# EXTERNAL_TUNNEL_ID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Clone this wiki locally