Switch --net=host not forwarding port

Hi

I’m trying to run HomeAssistant within Docker on Windows 2016 Server

I can run fine using the following command:

docker run -d --restart always --name=“home-assistant” -p 8123:8123 -v V:/Docker/HomeAssistant:/config homeassistant/home-assistant

With the above, the application web admin page is available on port 8123 from the host network

However, discovery for Sonos/uPNP won’t work here as it’s not on the same network as the devices

Advice is to ruin --net=host (I’m fine with the security implications of that on my home network):

docker run -d --restart always --name=“home-assistant” --net=host -v V:/Docker/HomeAssistant:/config homeassistant/home-assistant

However, when I run like this the web page is unavailable. I tried telnet to that port and it isn’t open. Is there something I’m missing here?

Many thanks

Ok - my search skills have improved slightly - it seems that a while ago --net=host doesn’t work on Docker for Windows. Does anyone know if this is still the case?

I know it’s 2022 but yes that is still true. --net=host won’t work on Win Desktop. I use -p 8123:8123 but not all Integrations work with HA as HA doesn’t see all the devices on my network.

As Docker ins running in a WSL distribution, there is no way --net=host will ever work. It will never be possible to hook into the host’s network interface, as it relies on Linux kernel feature called namespaces, which simply does not exist on the Windows host. Though, it should be possible to run --net=host from inside a WSL distribution. If you had something like an udp broadcast relay solution on your Windows host to relay the Sonos discovery udp messages to the WSL distribution, it might work if the container is started inside the WS distribution using --net=host. Note: I have no idea if a udp broadcast relay exists for Windows.

It is possible to relay udp broadcast requests from one network to another. At home, I am using clients in a DMZ that need to send udp broadcast messages to a server to register themselves, but the server runs in a different network and as such would never receive the udp broadcast messages, if i wouldn’t use a udp broadcast releay to forward the udp broadcast messages from one network to the other.