Tunnel works with local service as ip:port, but not fqdn


New to Cloudflare. Successfully configured cloudflare ZT running in docker in homelab with following docker-compose:

version: '3.8'

    image: cloudflare/cloudflared:latest
    container_name: cloudflared
    command: tunnel --no-autoupdate run --token xxxxxx
    network_mode: host
    restart: unless-stopped

Configured a tunnel that maps public domain photos.mydomain to local servtce ip:port. This works, can access self hosted photoprism.

However, I also have self-hosted pi-hole and nginx proxy manager. I can access the same service locally with the FQDN myphotos.myserver.mydomain, but when I use this FQDN in the tunnel local service setup, I cannot access the service, only the ip:port works. The error I get is bad gateway, and looking at the ZT container error logs:

Request failed error="Unable to reach the origin service. The service may be down or it may not be responding to traffic from cloudflared: dial tcp: lookup myphotos.myserver.mydomain on no such host" connIndex=1 dest=https://myphotos.myserver.mydomain/sw.js event=0 ip= type=http

Grateful for any hints on how to resolve, thanks.

This means the DNS failed to resolve. I would make sure that the docker network is using your internal DNS server for lookups.