I’m having some issues bringing up the docker version of Home Assistant on my Raspberry Pi (4B). I have copied the sample docker compose file from the documentation and changed the config location. The container loads up when I issue the command but I can’t seem to access it. Does anyone know why?
The container comes up when I use docker-compose up:
pi@maverick:~/Containers/homeassistant $ docker-compose up
Starting homeassistant ... done
Attaching to homeassistant
homeassistant | [s6-init] making user provided files available at /var/run/s6/etc...exited 0.
homeassistant | [s6-init] ensuring user provided files have correct perms...exited 0.
homeassistant | [fix-attrs.d] applying ownership & permissions fixes...
homeassistant | [fix-attrs.d] done.
homeassistant | [cont-init.d] executing container initialization scripts...
homeassistant | [cont-init.d] done.
homeassistant | [services.d] starting services
homeassistant | [services.d] done.
but when I try to visit the IP address of my pi in my web browser I get nothing. I can’t even curl it from the pi itself.
pi@maverick:~/Containers/homeassistant $ docker-compose up -d
Starting homeassistant ... done
pi@maverick:~/Containers/homeassistant $ docker-compose ps
Name Command State Ports
---------------------------------------
homeassistant /init Up
pi@maverick:~/Containers/homeassistant $ curl localhost:8123
curl: (7) Failed to connect to localhost port 8123: Connection refused
However I can open a shell inside the container and curl it from there:
pi@maverick:~/Containers/homeassistant $ docker-compose exec homeassistant sh
/config # curl localhost:8123 -v
* Trying 127.0.0.1:8123...
* Connected to localhost (127.0.0.1) port 8123 (#0)
> GET / HTTP/1.1
> Host: localhost:8123
> User-Agent: curl/7.78.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 302 Found
< location: /onboarding.html
< Content-Length: 0
< Content-Type: application/octet-stream
< Date: Tue, 14 Dec 2021 18:15:43 GMT
< Server: Python/3.9 aiohttp/3.8.1
<
* Connection #0 to host localhost left intact
Just to make sure I’m using the right port I have also added a http section to my ./config/configuration.yaml
http:
server_port: 8123
Unsuprisingly that doesn’t seem to change anything and now I’m at a complete loss. The log file remains completely empty so I’ve run out of ideas. Any help would be appreciated!
That’s interesting, I didn’t realise there was a seperate raspberry pi image. Unfortunately I’m seeing the same issue with it. The container comes up but I can’t access the web UI at all.
I posted about this on Reddit and I’ve managed to come up with a work around. It appears to be working if I run the container as root (with sudo) - obviously not a great work around but I’m happy with it for now as I’m planning on migrating it off the pi in the next couple of months anyway. Still odd how it doesn’t work rootless. I have other containers running rootless just fine. Thanks for the help anyway!
I just wanted to drop a line here because I’ve managed to fix this for me. My path was as follows:
Install fresh Raspbian on RPI 4
Install Docker
Execute docker run ... from the official quick start guide
Then I could see a container running but not exposing port 8123. The networking mode is host.
I’ve launched bash from the inside of container and tried to spin up one more HomeAssistant instance from there with hass --config /config --safe-mode and surprisingly it worked, the port was open.
Then, by trial and error I’ve came to a conclusion that host directory permissions were to blame.
My config path was ~/homeassistant, I’ve created it under built-it pi user home directory.
The fix for me was to remove everything from config directory and do something like sudo chmod 777 ./homeassistant (I’m not so experienced in linux permissions, 777 is dirty fix). Then docker restart home assistant and it works!
What hinted to me that it could be permissions issue is that configuration.yaml and log files were created but had size of 0 bytes no matter how many times I’ve restarted the container.
BTW. I’m a noob in linux stuff, maybe someone could suggest where is the most appropriate directory for configuration in Docker scenario? Is it /etc/ or something?