Installation on Docker Windows instructions don't work with --net=host

I installed Hass.io on Windows 10 with Docker Desktop using Linux containers. The installation instructions on https://www.home-assistant.io/docs/installation/docker/ state you should run this command:

docker run --init -d --name="home-assistant" -e "TZ=America/Los_Angeles" -v //c/Users/<your login name>/homeassistant:/config --net=host homeassistant/home-assistant:stable

And then further:
" When running Home Assistant in Docker on Windows, you may have some difficulty getting ports to map for routing (since the --net=host switch actually applies to the hypervisor’s network interface). To get around this, you will need to add port proxy ipv4 rules to your local Windows machine, like so (Replacing ‘192.168.1.10’ with whatever your Windows IP is, and ‘10.0.50.2’ with whatever your Docker container’s IP is):"

The problem is when you use --net=host your hass.io container won’t have an IP since it’s using the host IP. But you do need to do the port mapping in order to access your hass.io interface. To get this to work you need to remove the --net=host command from the “docker run”. Then you can get the IP address of the container by doing docker inspect . You also need to add -p 8123:8123 for the port mapping to work so the docker run command that works is:

docker run --init -d -e "TZ=America/Denver" -v //c/Users/<your login name>/homeassistant:/config -p 8123:8123 <home assistant container id**
2 Likes

@mleaming I just got it to work on Docker for Windows using
-p 8123:8123
instead of
–net=host
so the command can be used like this:

docker run --init -d --name="home-assistant" -e "TZ=America/Los_Angeles" -v d:/hassio:/config -p 8123:8123 homeassistant/home-assistant:stable

Apparently ‘–net=host’ doesn’t work on Docker for Windows.

The host networking driver only works on Linux hosts, and is not supported on Docker Desktop for Mac, Docker Desktop for Windows, or Docker EE for Windows Server.

4 Likes

This must be update to manual. I struggling with the install guide because of this wrong guide in manual