Developing in devcontainer: How to access local network of host

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:

  1. Edit .devcontainer/devcontainer.json and add "--network=host" to the runArgs array
  2. Rebuild your dev container (command palette → Remote Containers: Rebuild Container)
  3. (re)Start Home Assistant (command palette → Tasks: Run Task → Run Home Assistant Core)

Your dev container should then be connected to your host network.

6 Likes