Cannot connect to HA Container in Docker on W10

Hi there guys,

I decided to try installing HA Container in Docker on my Windows machine, in order to play a bit with it while I get my hands on a rPI, but it doesn’t seem to work, for some reason.

I installed it using docker-compose using the following docker-compose.yaml (from these instructions):

    container_name: homeassistant
    image: ""
      - F:/HA:/config
      - /etc/localtime:/etc/localtime:ro
    restart: unless-stopped
    privileged: true
    network_mode: host

The installation went really fast and seemed to be successful, but when I try to access HA from browser, I am not able to do so.

Trying from the same machine as the one with docker gives me the following error (same error when I use the machine’s IP instead of localhost)

Do you have any idea what the issue might be and how to fix it?

Docker on Windows doesn’t support host mode networking - you have to explicitly map ports. This is why that’s not a supported installation method.

1 Like

Can you let me know how I could do that?

I tried adding this to the docker-compose.yaml but it didn’t change anything:

    - 8123:8123

That looks broadly right, what does docker ps show?

It doesn’t show any ports configured, for some reason

Did you rebuild the container after you updated the compose file?

Yes, of course.

I assume the container is running, your screenshot shows it to be up a few seconds but I am not sure if it dies shortly after?
Then did you examine the logs inside the container , e.g. /config/home-assistant.log?

Yes, the container is running correctly. It didn’t fail/die, and the logs are empty.

so you mean no logs at all in the container? what did you add to configuration.yaml wrt to logging?
What are the processes in the container that are running?

I didn’t add anything to the configuration.yaml, I left it default.
I have 3 .log files, home-assistant.log, home-assistant.log.1, home-assistant.log.fault and all 3 are empty.
The processes inside the container are these ones:

Edit: Contents of configuration.yaml:

# Configure a default setup of Home Assistant (frontend, api, etc)

# Text to speech
  - platform: google_translate

automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml

odd… I have the same so I guess the port mapping is not working
I just installed docker on windows for the 1st time ever(!) and ran this one:
docker run -d --name="homeassistant" -p 8123:8123
This runs fine for me…

Running that command works fine for me as well, so I guess it has something to do with the local files then? Because this one doesn’t copy the files on the local drive

So this is a screw up from my side, haha.
When @Tinkerer was saying host mode is not supported and to explicitly map ports, I just added the port mapping to docker-compose.yaml, without removing the network_mode: host line.

I removed it right now, in order to make it look as closer to your command as possible, and it works.

1 Like

Great… although docker/windows…not sure ( I am not that much of a windows fan :slight_smile: )