#docker cloudflared container

1 messages · Page 1 of 1 (latest)

fringe seal
#

Your setup seems to be trying to expose a voice chat application via a Cloudflare tunnel in Docker. If you're seeing a "Bad Gateway" error when accessing your Cloudflare tunnel, it generally indicates that the tunnel isn't able to communicate with your application backend.

To make this work, you'll need to set up a Docker network and have both containers on the same network. This way, the Cloudflared container can access the voice chat container by its container name as the hostname. Here's a step-by-step approach:

  1. Create a Docker Network:
docker network create mynetwork
  1. Run Both Containers on the Same Network:

Start your voice chat container and the cloudflared container on the mynetwork network. For example:

docker run --network=mynetwork --name voicechat your_voice_chat_image
docker run --network=mynetwork --name cloudflared your_cloudflared_image
  1. Configure Cloudflared to Point to the Voice Chat Container:

In your cloudflared configuration, instead of pointing it to a localhost IP, point it to the hostname voicechat (or whatever name you assigned to the voice chat container). This works because Docker's internal DNS resolves container names to their internal IP addresses.

For example, if previously your configuration looked like:

url: http://127.0.0.1:8080

Change it to:

url: http://voicechat:8080

Assuming 8080 is the port your voice chat application is listening on.

  1. Other Considerations:
  • Ensure that your voice chat container is actually listening and serving requests.
  • Ensure that there are no firewall or iptables rules preventing inter-container communication.
  • Ensure that Cloudflared has the necessary permissions and routes set up in Cloudflare.

This should allow your cloudflared container to act as a tunnel and pass traffic to the voice chat container.