Homeassistant in a container.
Variables in /etc/homeassistant.conf (on the host server) allow these settings to be customised:
- homeassistant version
- directory to mount from the host
- timezone setting
- extra configuration for Z-Wave... etc
The version of the homeassistant image to pull down and then build the container with. Example:
ha_version=2021.10.0
It is normally fine to leave the default setting as-is.
The homeassistant image name. Example:
ha_image=ghcr.io/home-assistant/home-assistant
An alternative location at docker hub would be homeassistant/home-assistant
The default setting should not be changed.
The hostname given to the container, so that when you docker exec in its obvious which container you are on. Example:
ha_hostname=homeassistant
The location of the homeassistant configuration on the HOST system. Example:
ha_config=/homeassistant/config
The timezone to set inside in the container. Example:
ha_tz=Europe/Dublin
It should be something like: Australia/Melbourne...etc
See: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
A way to pass in extra configuration to homeassistant; e.g. "--device /dev/ttyUSB0:/dev/ttyUSB0", "--device /dev/ttyACM0:/dev/ttyACM0", "-v /etc/letsencrypt:/etc/letsencrypt:ro"...etc Example:
ha_extra_config="-v /etc/letsencrypt:/etc/letsencrypt:ro"
$ homeassistant-docker settings
...
$ homeassistant-docker pull
$ homeassistant-docker create
...
$ homeassistant-docker start
$ homeassistant-docker logs
...
$ homeassistant-docker stop
...
$ homeassistant-docker delete
The pull and create should only be done once per version bump. After that the container can be started and stopped as required.
After installing or updating homeassistant-docker:
- homeassistant-docker stop
- homeassistant-docker pull
- docker rename homeassistant homeassistant-2021.9.7 # renames the old container
- homeassistant-docker create
- homeassistant-docker start
Optional - to remove an old container and/or image:
- docker rm homeassistant-2021.9.7
- docker rmi ghcr.io/home-assistant/home-assistant:2021.9
To have the container start automatically:
rc-config add homeassistant
The default docker "json-file" logging driver does not do log rotation.
To select the "local" driver, with a max file size of 10MB and four files, add this to /etc/docker/daemon.json:
{
"log-driver": "local",
"log-opts": {
"max-size": "10m",
"max-file": "4"
}
}- https://wiki.gentoo.org/wiki/Docker
- https://www.home-assistant.io/installation/linux#install-home-assistant-container
- https://github.com/home-assistant/core/pkgs/container/home-assistant/versions
- https://hub.docker.com/r/homeassistant/home-assistant
- https://community.home-assistant.io/t/gentoo-homeassistant-0-59-2-ebuild/35577