How to UDP broadcast to external network without host mode?

Having read multiple topics that relate to UDP traffic, I have not found a solutions for my (Wake-on-LAN) broadcast issue.

Inside a container I want to send WoL magic packets (UDP broadcasts) to devices on an external network (the network subnet that the Docker host is also part of). Obviously, when using network_mode: host it works, but using either the default Docker bridge or creating a bridge of my own, the broadcast doesn’t get forwarded from the Docker network to to host network.
From a network perspective that makes sense, since it is a different subnet after all.

So, basically my question is: how can I forward UDP broadcast messages from a Docker bridge network to the host local network?

I have the same question. I’ve setup Home Assistant docker on my Openmediavault server. When I run it in host mode I can send WOL command to my LG WebOS tv with no issues. However I’m struggling to get this to work on my custom docker bridge network (I need the Home Assistant docker on this bridge, host mode isn’t an option)

Jan 2021 and there is still now answer to this?

I am running Linux containers on a Windows host.

Is it not possible to send a UDP Broadcast signal to the host network?

Also hoping there is a solution to this. I have apps that need to discover network devices using UDP broadcast but the app containers are in their own Docker network, so using hostmode is not possible.

Did you see UDP Port Mapping - Sending data from Container to Host - #5 by ivor50?

And note that the host system may be accessed from a container using host.docker.internal (for Linux also set --add-host=host.docker.internal:host-gateway to enable this). See also Can you proxy all network trafic outgoing from docker to a proxy running on the host? - #7 by meyay.

Broadcast/Multicasts can not leave the boundaries of a bridge network.

You will either need to use --network=host or MACVLAN (hint: the forum search should provide plenty working examples on how it’s used and what limitations apply)

1 Like