Cannot access Web UI - Docker-Compose

Hey,
I want to install HA via docker-compose (already have some other containers running) on a Debian machine.
So I followed the official guide, took a video as help (Installing Docker and Home Assistant Container - YouTube) and so my docker-compose.yaml file looks like this:

  homeassistant:
    container_name: homeassistant
    image: "ghcr.io/home-assistant/home-assistant:stable"
    volumes:
      - /opt/homeassistant/config:/config
      - /etc/localtime:/etc/localtime:ro
    restart: unless-stopped
    privileged: true
    network_mode: host

In Portainer I can see that it’s running, but I can’t assess the localhost:8123
This is how it looks in Portainer, and I’m curious because it’s the only container without IP/Ports but I don’t know what to do.


I already tried to add ports: - 8123:8123 to the .yaml, similar to my other containers, but then errors appeared while composing.

Its running in host networking mode so will inherit the IP address of the host it is running on, and won’t show anything under IP or ports in Portainer. You won’t specify ports with host networking mode or it creates errors like what you saw.

Your compose is a little different from mine - I use an environment variable for the timezone and don’t mount the /etc/localtime as a volume. Here’s the compose I use- I don’t use :stable and spell out the version number to pull, but you can do either :stable or :2022.6. I know Home Assistant documentation recommends GHCR but I still just use the docker hub path. I also just add the below compose as a “stack” in portainer per these instructions

version: '3.3'
services:
    home-assistant:
        container_name: homeassistant
        volumes:
            - '/home/mwav3/homeassistant:/config'
        environment:
            - TZ=America/New_York
        restart: always
        network_mode: host
        image: 'homeassistant/home-assistant:2022.6'

If that still doesn’t work, check the logs in the container to see if Home Assistant is even coming up and loading. Try http://192.168.0.yourip:8123 to access the Home Assistant instance as well, although localhost:8123 should work if you’re using the browser on the same host it is installed on.

Privileged mode is also not necessary if you are not mapping USB sticks to the Home Assistant instance.

I think I kind of fixed it myself, but thanks for your hint that HA should be reachable without “:8123” behind the IP.
It occurred to me that Pihole is running on that native IP (back then I followed this tutorial GitHub - geerlingguy/internet-pi: Raspberry Pi config for all things Internet.) and by comparing with other containers, I understood that I had to delete the network_mode: host line and added ports: - 8123:8123. Now everything functions fine.
Thanks for all your tips, e.g. updating via the web UI isn’t possible with docker.

Some run it this way with the ports option specified for 8123, but there is a reason the documentation advises to use host networking mode. Many integrations rely on SSDP, a form of UPNP for discovery. This discovery will only work if you are using host networking mode. See the integrations that use it - none of these integrations will work properly without host networking mode. If you aren’t or don’t plan to use any of them, then you shouldn’t have a problem. If you do want to use them, you’ll need to use host networking mode and further trouble shoot why it isn’t working with your setup. Mine runs fine in host networking mode - You might be onto something about PiHole creating a conflict.

This will further explain different type of docker networking configurations

TIP for another OS users:

  • 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.

Networking using the host network | Docker Documentation

1 Like

Hi everyone.
I have the same issue as the original poster and cannot access the WebUI.
I am running under Ubuntu Server with docker-compose and I can see portainer running and can access portainer UI on IP_ADDRESS:9000 (where IP_ADDRESS is the address for the server / Ubuntu machine). Logs for HA seem fine and loading but just cannot access it.
Removing network_host and instead using the ports works fine.
Any clues / ideas?

Docker-compose

version: '3.7'
services:
  homeassistant:
    container_name: homeassistant
    restart: always
    image: homeassistant/home-assistant:stable
    network_mode: host
    volumes:
      - ${USERDIR}/docker/homeassistant:/config
      - /etc/localtime:/etc/localtime:ro
      - ${USERDIR}/docker/shared:/shared
    privileged: true
    environment:
      - PUID=${PUID}
      - PGID=${PGID}
      - TZ=${TZ}
  
  portainer:
    container_name: portainer
    image: portainer/portainer-ce:latest
    restart: unless-stopped
    security_opt:
      - no-new-privileges:true
    ports:
      - "9000:9000" 
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - $DOCKERDIR/portainer/data:/data
      - $DOCKERDIR/shared:/shared
    environment:
      - TZ=$TZ

HA logs

homeassistant    | s6-rc: info: service s6rc-oneshot-runner: starting
homeassistant    | s6-rc: info: service s6rc-oneshot-runner successfully started
homeassistant    | s6-rc: info: service fix-attrs: starting
homeassistant    | s6-rc: info: service fix-attrs successfully started
homeassistant    | s6-rc: info: service legacy-cont-init: starting
homeassistant    | s6-rc: info: service legacy-cont-init successfully started
homeassistant    | s6-rc: info: service legacy-services: starting
homeassistant    | services-up: info: copying legacy longrun home-assistant (no readiness notification)
homeassistant    | s6-rc: info: service legacy-services successfully started

Ok, noob error. Needed to open up the ports in the firewall on Ubuntu server which fixed the problem.

1 Like