sudo docker run -d --name cloudflared --restart=always cloudflared --network host \
--add-host=host.docker.internal:host-gateway \
cloudflare/cloudflared:latest tunnel --no-autoupdate run
Note: Copy the command from Cloudflare and modify the options to allow connection from container to host
This command helped because Docker containers cannot see services running on the host by default. After troubleshooting, I learned it was a network visibility issue.
Logs showed the host IP being called with no response, and messages like:
lookup host.docker.internal: no such host
Cloudflared was not reaching my local HTTP server because it could not resolve
host.docker.internal. Adding the host gateway mapping fixed the issue.