dockerudpgenicam

broadcast UDP from docker (on Windows host) does not make it to the LAN


I am running code talking to GigE Vision / gen<i>cam cameras inside a docker container. The real deployment will run on Windows host (unfortunately). The cameras respond to broadcasted UDP discovery packets to port 3965 (wireshark dissects those as GVCP protocol, DISCOVER_CMD):

wireshark screenshot

Obviously, UDP packets can't cross network bridges, though --network=host helped on Linux: the camera was discovered.

On Windows host, the --network=host had no effect and the discover packet (sent from within the container) never makes it to the LAN. The Windows Defender firewall is off and there is no other firewall/antivirus/whatever active.

I can also run camera discovery program in Windows (not in the hosted container) and it works.

Any idea what could be wrong? I was googling for things like "docker egress UDP windows" with no useful result.


Solution

  • This question is quite old but I'm answering to report how I solved the same problem with GigE Vision cameras a few months ago and how perhaps it can be solved today or generally how it can solve host network mode problem in Windows.

    First of all, Docker from 4.29.0 support host networks (in beta version) so you can give it a try.

    Previous to this release, I solved the problem with this workaround:

    1. uninstall Docker Desktop on Windows with the normal uninstall procedure
    2. install Docker inside the wsl 2.0
    3. set the WSL network to mirrored mode
    4. run docker from within the wsl with --network host option The program in the container should now communicate correctly with the camera.

    Clearly this approach is a workaround that I do not recommend now that Docker Desktop supports host network mode. I hope this can help as it would have helped me when I faced the problem.