Is it possible to send UDP broadcast inside docker container to scan devices IP connected to my Windows host network?

I have a python program which would send UDP broadcast to scan IP of any devices connected to my windows host. I tested it on my localhost without docker, and it works perfectly fine. But when I dockerized(Linux container) it , it cannot scan any of them.

I know the default network mode for docker is bridge, so any container we created would connect to a virtual ethernet, which is not the case I’m looking for. So I changed to host mode and trying to use the same host network environment to scan devices IP, but it seems it’s not supported on Windows Host.

I wonder if there’s any workaround for my use case? Thanks

Architecture

Environment:

OS: Windows 10 Professional 20H2 19042.1110
Docker Version: Docker Engine - Community V20.10.7 (WSL 2 backend)

I have the same issue, any solution other that host network?

Since Docker 4.34 Docker Desktop`s host networking might help with this scenario.
It mirrors packages on layer 4 (tcp/udp)

  • to the host’s network interface to the utility vm’s network interface
  • from the utility vm network interface to the host’s network interface

Not sure if it works with broadcast messages as well. It might be worth trying.

If this is not working then there is no way to make it work with Docker Desktop.

Note: Host networking was not available when the original post was made in August 2021.