In setups where your containerized environment is behind:
- OPNsense as the network firewall/router
- cloudflared as a DNS forwarder (e.g., for DoH/DoT)
You may encounter repeated tunnel crashes with errors like:
lookup region1.v2.argotunnel.com on 127.0.0.11:53: server misbehaving
This is due to Docker’s internal DNS hitting a local resolver that cannot correctly resolve SRV records for Cloudflare services.
Use this Compose setup to:
- Attach the tunnel container to an existing Docker network (
CloudFlare
) - Override its DNS resolution with public resolvers (1.1.1.1 / 8.8.8.8)
- Mount a
config.yml
to/etc/cloudflared/config.yml
for more control - Set
TZ
and logging options if needed
Replace with your CF token as provided in the tunnel config.
This snippet is for deploying into a docker network with an existing network for Cloudflare
services:
cloudflared:
image: cloudflare/cloudflared:latest
command: >
tunnel --no-autoupdate run --token <REDACTED_CLOUDFLARE_TOKEN>
restart: unless-stopped
networks:
- CloudFlare
dns:
- 1.1.1.1 # Cloudflare DNS
- 8.8.8.8 # Google DNS
networks:
CloudFlare:
external: true