Starting and debugging works fine.
But now the container cannot access my network devices which I need to implement the integration.
My host PC is Windows 10 on network 192.168.1.x. My network device which I need to access is on 192.168.1.32:3671. How do I need to configure the devcontainer to allow it to connect to the specified address?
Hopefully you managed to figure this out some time in the past several months - but I’ve just had to figure this out as I was in a similar situation. In case anyone else finds this thread while hunting for an answer, here’s what I’ve figured out:
Edit .devcontainer/devcontainer.json and add "--network=host" to the runArgs array
Rebuild your dev container (command palette → Remote Containers: Rebuild Container)
(re)Start Home Assistant (command palette → Tasks: Run Task → Run Home Assistant Core)
Your dev container should then be connected to your host network.
For me, network devices are visible if they’re on the same network (devcontainer running on Windows 11 with WSL).
One complication was, that I run my IoT devices on a separate closed-off VLAN and Windows 11 doesn’t seem to be able to easily deal with VLANs. I solved that by hooking up the machine on my home LAN but connecting WiFi to the IoT LAN so that the machine ends up in both networks.
I didn’t have to adjust anything in the default devcontainer docker setup. It just worked out of the box.
What doesn’t work is zeroconf autodiscovery or DHCP autodiscovery. I have no idea why and reading other posts I don’t seem to be the only one with that problem.
Update: I did a fresh setup on my Windows 10 PC, and now it is also working! Strange, but I think I was confused at the very beginning with autodiscovery not working. As I did not see any devices auto discovered, I started to change everything…
I just came across a new challenge. While I could ping the devices from inside the devcontainer, I could not broadcast to them, which I need for device discovery.
I’ve now followed the advice from above and included --network=host with the runArgs and rebuilt the container. But that doesn’t bring the container onto the same 192.168.0.x network as the host, so the broadcast doesn’t work.
from reading all sorts of docs, it seem that docker can bridge into the host network on Windows, but that’s different from “being” on the host network, so broadcasts don’t work. I’ve not been able to find any solution. --network=host does not work on Windows.