Using host IP in Docker Windows HA install

Hi all, I’ve installed HA in Docker on my Windows 10 server using Kitematic which seems to be working as it should and I can communicate with my RM Pro.

What I can’t do is access the web interface from anywhere but the host PC. From what I’ve read I "just"need to add a “–net=host switch” to get this working. Unfortunately I have no experience of Python, Linux or anything else involved here so am relying on finding instructions I can just copy and can’t find anything more consise than what I said above.

Apologies for what is probably a stupid question.

Usually you do something like

Docker run -p 9999:8123 -v /windows_folder:/home/pi/.homeassistant --name=HAServer homeassistant/homeassistant:0.37.0

The -p is call to map host port to docker port
9999 in this case is the host port mapped to 8123
So if servers at 192.168.0.1, HA would be available at 192.168.0.1:9999

Many thanks for the reply, don’t think that’s the problem though. The port mapping to the host is working fine, I can access it at locahost:8123 and also map it to other ports without problem, it’s getting to the outside world that isn’t.

This page… https://home-assistant.io/components/discovery/ …states “If running Home Assistant in a Docker container use switch --net=host to put it on the host’s network.” I assume mine must be set to ‘bridge’ somewhere?

Hope that makes sense!

If you can access it from the computer running the docker instance, I guess your docker container is already configured properly.
I would look for a problem of firewall/network config more than a problem with the docker container itself.

what command did you use to run docker?

I run it as follow:
docker run -d --name="home-assistant" --restart=unless-stopped -v /config:/config --net=host hass/hass

Think you’re right, it’s docker itself rather than the container.

I don’t use a command, just double click Docker for Windows.exe although I now have it set to start at login in the Docker settings panel. There is a daemon panel in the settings… https://docs.docker.com/docker-for-windows/images/docker-daemon_advanced.png …is there something I should add there?

Many thanks for helping.

Cracked it, after all that it was my firewall and nothing to do with either Home Assistant or Docker. All the discussions I could find on the web relating to my problem were pre the current version of Docker for Windows which handled the networking differently. A simple port forward and job done …after uninstalling and reinstalling everything several times, doh!

Many thanks for all your help.

I still cannot get discovery to work. I’m kind of a noob on HA, docker and most of the things related, so any tip or tricks is appreciated.
My setup:
Windows 10 with Docker for windows running homeassistant in linux container.
I use the DockerNAT virtual switch, so my Windows 10 got IP 192.168.0.200, and homeassistant get 172.17.56.49. This would mean that HA cannot get into the 192.168.0.0 net to discover any devices connected to it? If I switch to external (to use the host IP, HA will mess up).