Now Docker is up and running lets try and get Home Assistant going.
https://www.google.com/search?q=docker+home+assistant
The first result is Home Assistants official instructions
“Adjust the following command so that /path/to/your/config/
points at the folder where you want to store your configuration”
So my first task is to work out where is a good place to save these files. The files _could_ be saved anywhere, but i need to chose a location that will not come back to bite me in the ass in the future and that is accessible,sensible, etc.
https://www.google.com/search?q=docker+home+assistant+config+file+location
The 2nd link looks like it is what i am looking for
https://community.home-assistant.io/t/location-of-components-folder-in-docker/54767
The article doesnt directly address my question but this guy saves his config files in
/srv/docker/hass-config
Hold on a minute, what exactly are all these standard Linux folders all intended to be used for. If i know that i might be able to make a better decision.
DETOUR!
What are the intended purposes of the standard linux folders
Well after that has been resolved, looks like i will copy this guy, except i dont like hyphens. I’m going with
/srv/docker/hassconfig
So lets create that folder
[root@homeserver homeserver]# cd /srv [root@homeserver srv]# ls [root@homeserver srv]# mkdir docker [root@homeserver srv]# cd docker/ [root@homeserver docker]# mkdir hassconfig [root@homeserver docker]# cd hassconfig/ [root@homeserver hassconfig]# pwd /srv/docker/hassconfig
OK now im ready to build my docker run command
Find out what these parameters mean in my guide to docker run http://homeserverworld.com/guide-to-docker-run/.
docker run -d --name="home-assistant" -v /srv/docker/hassconfig:/config -v /etc/localtime:/etc/localtime:ro --net=host homeassistant/home-assistant
As usual ill use Notepad to make saving, editing and changing my run easier
[root@homeserver hassconfig]# docker run -d --name="home-assistant" -v /srv/docker/hassconfig:/config -v /etc/localtime:/etc/localtime:ro --net=host homeassistant/home-assistant Unable to find image 'homeassistant/home-assistant:latest' locally latest: Pulling from homeassistant/home-assistant 55cbf04beb70: Pull complete 1607093a898c: Pull complete 9a8ea045c926: Pull complete d4eee24d4dac: Pull complete b59856e9f0ab: Pull complete b023afffd10b: Pull complete 4d4eb448d315: Pull complete c4eb58602129: Pull complete 598629fb90fc: Pull complete d864b050552d: Pull complete 0c898f5f2475: Pull complete 38e48c298eb5: Pull complete 7fa02ad78b8b: Pull complete dc311abb0297: Pull complete 99fe97f432a6: Pull complete Digest: sha256:45a19ffe5ab45c2e69d81f6f40e28349fe381d26e11d5268029b0c100cdfd7bc Status: Downloaded newer image for homeassistant/home-assistant:latest 6a65544657339fdd62b2b0ee8068bf0b0667a3ed167e5410186f8170c4318bb4 [root@homeserver hassconfig]#
This took about 5 mins to run.
Lets try this puppy out
Oh no. Whats going on. My Docker container is running but i cant get to the Home Assistant web portal. I tried various URL variations incase i was missing something but nothing loaded.
Troubleshooting Home Assistant Docker unreachable on CentOS
Step 1. confirm the Docker container is actually running and listening on the right port
https://www.google.com/search?q=show+docker+ports
Takes me to
https://docs.docker.com/engine/reference/commandline/ps/
[root@homeserver hassconfig]# docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 6a6554465733 homeassistant/home-assistant "python -m homeassis…" 7 minutes ago Up 7 minutes home-assistant ada565dd0a56 plexinc/pms-docker "/init" 7 weeks ago Up 2 weeks (healthy) 0.0.0.0:3005->3005/tcp, 0.0.0.0:8324->8324/tcp, 0.0.0.0:1900->1900/udp, 0.0.0.0:32410->32410/udp, 0.0.0.0:32400->32400/tcp, 0.0.0.0:32412-32414->32412-32414/udp, 0.0.0.0:32469->32469/tcp plex
Hmmm, no ports but its running. OK.
Step 2. Is there network connectivity for my docker container?
[root@homeserver hassconfig]# netstat -a -bash: netstat: command not found
Hold up no netstat
DETOUR
Now we know that lets try again
[root@homeserver hassconfig]# ss -4 state listening Netid Recv-Q Send-Q Local Address:Port Peer Address:Port tcp 0 128 *:8123 *:* tcp 0 50 *:microsoft-ds *:* tcp 0 50 *:netbios-ssn *:* tcp 0 128 *:ssh *:* tcp 0 100 127.0.0.1:smtp *:*
ok i see 8123 is open, but i still cant browse there.
Step 3. Is SELinux blocking my docker container?
https://www.google.com/search?q=centos+home+assistant+docker+selinux
gives me
https://community.home-assistant.io/t/hass-io-docker-image-on-rhel7-permission-denied/34329
where this guy
https://community.home-assistant.io/t/hass-io-docker-image-on-rhel7-permission-denied/34329/3
gives me the command for selinux
setenforce permissive
[root@homeserver hassconfig]# setenforce permissive
Tried browsing and still no joy.
Step 4. What is going on with my Home Assistant Docker Container ports?
Lets go back to our findings in step 1. No port assigned.
https://www.google.com/search?q=home+assistant+docker+no+ports
First link
https://community.home-assistant.io/t/docker-not-activating-ports/63039
This guy is using Portainer but the output shows exactly the same thing as mine, no listed ports.
His solution was to specify the container port.
There is some conversation about why that is necessary but it also seems the common thing to do:
This guy does it
https://community.home-assistant.io/t/avoid-network-mode-host-for-docker/47250/6
and this one
It looks like 8123 is the only standard port needed by Home Assistant, so i shouldn’t be endangering any functionality by specifying the port.
Lets stop the running version
[root@homeserver hassconfig]# docker stop 6a6554465733 6a6554465733
Make sure its gone
[root@homeserver hassconfig]# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES ada565dd0a56 plexinc/pms-docker "/init" 7 weeks ago Up 2 weeks (healthy) 0.0.0.0:3005->3005/tcp, 0.0.0.0:8324->8324/tcp, 0.0.0.0:1900->1900/udp, 0.0.0.0:32410->32410/udp, 0.0.0.0:32400->32400/tcp, 0.0.0.0:32412-32414->32412-32414/udp, 0.0.0.0:32469->32469/tcp plex
And run the revised docker run
[root@homeserver hassconfig]# docker run -d --name="home-assistant" -v /srv/docker/hassconfig:/config -v /etc/localtime:/etc/localtime:ro -p 8123:8123 homeassistant/home-assistant docker: Error response from daemon: Conflict. The container name "/home-assistant" is already in use by container "6a65544657339fdd62b2b0ee8068bf0b0667a3ed167e5410186f8170c4318bb4". You have to remove (or rename) that container to be able to reuse that name. See 'docker run --help'.
.
.
.
Lets try again
[root@homeserver hassconfig]# docker run -d --name="home-assistant" -v /srv/docker/hassconfig:/config -v /etc/localtime:/etc/localtime:ro -p 8123:8123 homeassistant/home-assistant 11c1662f6a910b3a3d1fa7c40914f2fd0e8b298932da8259686b0f53f7b51895
BINGO
I hope you found this post useful.
All in all this took me from Airbag to Fitter Happier on OK Computer (about 35 mins).
[root@homeserver ~]# [root@homeserver ~]# [root@homeserver ~]# [root@homeserver ~]# cd / [root@homeserver /]# ls bin boot data dev etc home lib lib64 media mnt opt proc root run sbin srv sys tmp usr var [root@homeserver /]# cd home/ [root@homeserver home]# ks -bash: ks: command not found [root@homeserver home]# ls homeserver [root@homeserver home]# cd homeserver/ [root@homeserver homeserver]# ls firmware-smartarray-f7c07bdbbd-1.34-2.1.x86_64.rpm media HPE_ProLiant_Gen10_Smart_Array_Controller_(64-bit)_Driver_for_Red_Hat_Enterprise_Linux_7_(64-bit) System_BIOS_v_ZA10A350_for_MicroServer_Gen10_Linux HPE_ProLiant_Gen10_Smart_Array_Controller_(64-bit)_Driver_for_Red_Hat_Enterprise_Linux_7_(64-bit).zip [root@homeserver homeserver]# cd /srv [root@homeserver srv]# ls [root@homeserver srv]# mkdir docker [root@homeserver srv]# cd docker/ [root@homeserver docker]# mkdir hassconfig [root@homeserver docker]# cd hassconfig/ [root@homeserver hassconfig]# pwd /srv/docker/hassconfig [root@homeserver hassconfig]# docker run -d --name="home-assistant" -v /srv/docker/hassconfig:/config -v /etc/localtime:/etc/localtime:ro --net=host homeassistant/home-assistant Unable to find image 'homeassistant/home-assistant:latest' locally latest: Pulling from homeassistant/home-assistant 55cbf04beb70: Pull complete 1607093a898c: Pull complete 9a8ea045c926: Pull complete d4eee24d4dac: Pull complete b59856e9f0ab: Pull complete b023afffd10b: Pull complete 4d4eb448d315: Pull complete c4eb58602129: Pull complete 598629fb90fc: Pull complete d864b050552d: Pull complete 0c898f5f2475: Pull complete 38e48c298eb5: Pull complete 7fa02ad78b8b: Pull complete dc311abb0297: Pull complete 99fe97f432a6: Pull complete Digest: sha256:45a19ffe5ab45c2e69d81f6f40e28349fe381d26e11d5268029b0c100cdfd7bc Status: Downloaded newer image for homeassistant/home-assistant:latest 6a65544657339fdd62b2b0ee8068bf0b0667a3ed167e5410186f8170c4318bb4 [root@homeserver hassconfig]# [root@homeserver hassconfig]# docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 6a6554465733 homeassistant/home-assistant "python -m homeassis…" 7 minutes ago Up 7 minutes home-assistant ada565dd0a56 plexinc/pms-docker "/init" 7 weeks ago Up 2 weeks (healthy) 0.0.0.0:3005->3005/tcp, 0.0.0.0:8324->8324/tcp, 0.0.0.0:1900->1900/udp, 0.0.0.0:32410->32410/udp, 0.0.0.0:32400->32400/tcp, 0.0.0.0:32412-32414->32412-32414/udp, 0.0.0.0:32469->32469/tcp plex [root@homeserver hassconfig]# netstat -a -bash: netstat: command not found [root@homeserver hassconfig]# ss Netid State Recv-Q Send-Q Local Address:Port Peer Address:Port u_str ESTAB 0 0 * 28517 * 28516 u_str ESTAB 0 0 * 28544 * 28543 u_str ESTAB 0 0 * 28501 * 28502 u_str ESTAB 0 0 /run/dbus/system_bus_socket 23600 * 23584 u_str ESTAB 0 0 * 28547 * 28546 u_str ESTAB 0 0 * 2740219 * 2740220 u_str ESTAB 0 0 * 28519 * 28520 u_str ESTAB 0 0 * 23584 * 23600 u_str ESTAB 0 0 * 28546 * 28547 u_str ESTAB 0 0 * 29399 * 29398 u_str ESTAB 0 0 * 28520 * 28519 u_str ESTAB 0 0 * 28498 * 28499 u_str ESTAB 0 0 * 29502 * 26540 u_str ESTAB 0 0 * 28513 * 28514 u_str ESTAB 0 0 * 23509 * 20301 u_str ESTAB 0 0 * 28514 * 28513 u_str ESTAB 0 0 /run/systemd/journal/stdout 20301 * 23509 u_str ESTAB 0 0 * 28516 * 28517 u_str ESTAB 0 0 * 28502 * 28501 u_str ESTAB 0 0 /run/dbus/system_bus_socket 26544 * 29503 u_str ESTAB 0 0 * 28496 * 28495 u_str ESTAB 0 0 /var/run/docker/containerd/docker-containerd.sock 27291 * 29498 u_str ESTAB 0 0 * 28525 * 28526 u_str ESTAB 0 0 /run/systemd/journal/stdout 23444 * 23439 u_str ESTAB 0 0 * 29503 * 26544 u_str ESTAB 0 0 * 28526 * 28525 u_str ESTAB 0 0 * 23439 * 23444 u_str ESTAB 0 0 * 29401 * 29402 u_str ESTAB 0 0 /run/dbus/system_bus_socket 25010 * 20478 u_str ESTAB 0 0 /run/systemd/journal/stdout 26033 * 28211 u_str ESTAB 0 0 * 29402 * 29401 u_str ESTAB 0 0 * 29498 * 27291 u_str ESTAB 0 0 * 29398 * 29399 u_str ESTAB 0 0 * 28522 * 28523 u_str ESTAB 0 0 /run/systemd/journal/stdout 16549 * 17862 u_str ESTAB 0 0 * 23598 * 23597 u_str ESTAB 0 0 /var/run/docker/containerd/docker-containerd.sock 26540 * 29502 u_str ESTAB 0 0 * 163541 * 163542 u_str ESTAB 0 0 * 28523 * 28522 u_str ESTAB 0 0 * 28262 * 26035 u_str ESTAB 0 0 * 20478 * 25010 u_str ESTAB 0 0 * 17862 * 16549 u_str ESTAB 0 0 * 23597 * 23598 u_str ESTAB 0 0 @/containerd-shim/moby/ada565dd0a5679457d32ed0c92a203bc61ceb6fd16f9cf79f3e2aa5dd2bd80de/shim.sock@ 163542 * 163541 u_str ESTAB 0 0 * 28495 * 28496 u_str ESTAB 0 0 * 28499 * 28498 u_str ESTAB 0 0 /var/run/docker/containerd/docker-containerd.sock 27289 * 28583 u_str ESTAB 0 0 /run/dbus/system_bus_socket 23599 * 21097 u_str ESTAB 0 0 * 27200 * 26414 u_str ESTAB 0 0 * 28211 * 26033 u_str ESTAB 0 0 * 29413 * 29412 u_str ESTAB 0 0 * 20296 * 23459 u_str ESTAB 0 0 * 26032 * 28110 u_str ESTAB 0 0 * 29406 * 29405 u_str ESTAB 0 0 /run/dbus/system_bus_socket 23459 * 20296 u_str ESTAB 0 0 /run/systemd/journal/stdout 28110 * 26032 u_str ESTAB 0 0 /run/systemd/journal/stdout 23266 * 21086 u_str ESTAB 0 0 * 29412 * 29413 u_str ESTAB 0 0 * 29405 * 29406 u_str ESTAB 0 0 /run/systemd/journal/stdout 26035 * 28262 u_str ESTAB 0 0 * 21097 * 23599 u_str ESTAB 0 0 * 28583 * 27289 u_str ESTAB 0 0 /run/dbus/system_bus_socket 26414 * 27200 u_str ESTAB 0 0 * 2740220 * 2740219 u_str ESTAB 0 0 * 24509 * 23551 u_str ESTAB 0 0 /run/dbus/system_bus_socket 23551 * 24509 u_str ESTAB 0 0 /run/dbus/system_bus_socket 27213 * 28457 u_str ESTAB 0 0 * 13673 * 16294 u_str ESTAB 0 0 * 29408 * 29409 u_str ESTAB 0 0 * 28532 * 28531 u_str ESTAB 0 0 * 28457 * 27213 u_str ESTAB 0 0 * 21086 * 23266 u_str ESTAB 0 0 * 28534 * 28535 u_str ESTAB 0 0 /run/systemd/journal/stdout 20194 * 21188 u_str ESTAB 0 0 /run/systemd/journal/stdout 16294 * 13673 u_str ESTAB 0 0 * 28535 * 28534 u_str ESTAB 0 0 * 28528 * 28529 u_str ESTAB 0 0 * 28529 * 28528 u_str ESTAB 0 0 * 21188 * 20194 u_str ESTAB 0 0 * 28531 * 28532 u_str ESTAB 0 0 * 28540 * 28541 u_str ESTAB 0 0 * 28541 * 28540 u_str ESTAB 0 0 * 29409 * 29408 u_str ESTAB 0 0 * 28543 * 28544 u_str ESTAB 0 0 * 28537 * 28538 u_str ESTAB 0 0 * 28538 * 28537 u_str ESTAB 0 0 * 28507 * 28508 u_str ESTAB 0 0 * 2739312 * 2738852 u_str ESTAB 0 0 * 28504 * 28505 u_str ESTAB 0 0 * 23317 * 23318 u_str ESTAB 0 0 * 28508 * 28507 u_str ESTAB 0 0 * 28511 * 28510 u_str ESTAB 0 0 * 28505 * 28504 u_str ESTAB 0 0 * 29415 * 29416 u_str ESTAB 0 0 /run/systemd/journal/stdout 23318 * 23317 u_str ESTAB 0 0 * 28510 * 28511 u_str ESTAB 0 0 * 23326 * 23601 u_str ESTAB 0 0 * 23140 * 23141 u_str ESTAB 0 0 * 29416 * 29415 u_str ESTAB 0 0 /run/dbus/system_bus_socket 23601 * 23326 u_str ESTAB 0 0 @/containerd-shim/moby/6a65544657339fdd62b2b0ee8068bf0b0667a3ed167e5410186f8170c4318bb4/shim.sock@ 2738852 * 2739312 u_str ESTAB 0 0 * 23141 * 23140 tcp ESTAB 0 0 192.168.1.29:ssh 192.168.1.22:63648 tcp ESTAB 0 0 192.168.1.29:microsoft-ds 192.168.1.22:63517 [root@homeserver hassconfig]# ss -4 state listening Netid Recv-Q Send-Q Local Address:Port Peer Address:Port tcp 0 128 *:8123 *:* tcp 0 50 *:microsoft-ds *:* tcp 0 50 *:netbios-ssn *:* tcp 0 128 *:ssh *:* tcp 0 100 127.0.0.1:smtp *:* [root@homeserver hassconfig]# setenforce permissive [root@homeserver hassconfig]# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 6a6554465733 homeassistant/home-assistant "python -m homeassis…" 18 minutes ago Up 18 minutes home-assistant ada565dd0a56 plexinc/pms-docker "/init" 7 weeks ago Up 2 weeks (healthy) 0.0.0.0:3005->3005/tcp, 0.0.0.0:8324->8324/tcp, 0.0.0.0:1900->1900/udp, 0.0.0.0:32410->32410/udp, 0.0.0.0:32400->32400/tcp, 0.0.0.0:32412-32414->32412-32414/udp, 0.0.0.0:32469->32469/tcp plex [root@homeserver hassconfig]# docker stop 6a6554465733 6a6554465733 [root@homeserver hassconfig]# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES ada565dd0a56 plexinc/pms-docker "/init" 7 weeks ago Up 2 weeks (healthy) 0.0.0.0:3005->3005/tcp, 0.0.0.0:8324->8324/tcp, 0.0.0.0:1900->1900/udp, 0.0.0.0:32410->32410/udp, 0.0.0.0:32400->32400/tcp, 0.0.0.0:32412-32414->32412-32414/udp, 0.0.0.0:32469->32469/tcp plex [root@homeserver hassconfig]# docker run -d --name="home-assistant" -v /srv/docker/hassconfig:/config -v /etc/localtime:/etc/localtime:ro -p 8123:8123 homeassistant/home-assistant docker: Error response from daemon: Conflict. The container name "/home-assistant" is already in use by container "6a65544657339fdd62b2b0ee8068bf0b0667a3ed167e5410186f8170c4318bb4". You have to remove (or rename) that container to be able to reuse that name. See 'docker run --help'. [root@homeserver hassconfig]# docker ps -aq -f status=exited 6a6554465733 [root@homeserver hassconfig]# docker rm 6a6554465733 6a6554465733 [root@homeserver hassconfig]# docker ps -aq -f status=exited [root@homeserver hassconfig]# docker run -d --name="home-assistant" -v /srv/docker/hassconfig:/config -v /etc/localtime:/etc/localtime:ro -p 8123:8123 homeassistant/home-assistant 11c1662f6a910b3a3d1fa7c40914f2fd0e8b298932da8259686b0f53f7b51895 [root@homeserver hassconfig]#