Cloudflare tunnel not using local DNS for resolution

I recently setup a cloudflare tunnel. However, I’m getting a 502 error when I access it from public DNS name. When I check the cloudflared container logs it shows that it can’t resolve the internal DNS name I’ve given the service.

Error:
ERR 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 test.example.com on 127.0.0.11:53: no such host"

How does DNS inside cloudflare container work? Is it trying to leverage docker host DNS via localhost as shown in the error? I need it to leverage my local DNS so it can actually resolve this name internally which resides at a differernt IP. On the Docker host I can resolve the internal name so not sure why the container can’t.

From all the guides out there it seems like you don’t need to set anything up for DNS it should just work…however, that is not the experience I’m having at the moment.

cloudflared will use the docker DNS server which checks if other containers have the same name then forwards to the DNS server configured for the host Docker Docs. Are other docker containers able to resolve the internal DNS name?

1 Like

So this was helpful appears for some reason I didn’t have my resolv.conf setup. It’s wierd that the host could still resolve without this being set. It wouldn’t let me write to resolv.conf until I broke the symbolic link after that I restarted the containers it all works now! Thanks!!

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.