How to run inside Docker and connect from outside the host? #174
Unanswered
spietras
asked this question in
Help / Questions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
If I understand correctly, WebRTC data connection is based on UDP and therefore the server needs to be directly reachable from the client. So all following scenarios should work out of the box:
But consider this scenario:
Let's say our (server host) address on LAN is
192.168.1.2
, client is on192.168.1.3
and server is inside Docker container with address172.17.0.2
. So our machine is visible to the client as192.168.1.2
, but the server address172.17.0.2
is only understandable by our host, client doesn't know anything about it. But if we run the server inside Docker container (in bridge mode), expose its ports (for simplicity let's say it's the default3000/tcp
and20000-20100/udp
), connect from the client to the host at192.168.1.2:3000
, we will get172.17.0.1
(Docker gateway) as ICE candidate sent to the client! But the client has no clue what this is, so it can't connect to it.I might be wrong somewhere as I have trouble understanding all the networking stuff, but I stumbled upon this problem when testing
geckos
inside Docker on LAN. If we switch to host network mode then it's all fine as the server is directly on host, but I think this is not a satisfying long-term solution.Do you know any way of achieving connectivity while using bridge network with Docker? Maybe some local STUN server is needed?
Beta Was this translation helpful? Give feedback.
All reactions