Setup
Adjust the following command so that /PATH_TO_YOUR_CONFIG
points at the folder where you want to store your configuration and run it.
$ docker run --init -d \
--name homeassistant \
--restart=unless-stopped \
-v /etc/localtime:/etc/localtime:ro \
-v /PATH_TO_YOUR_CONFIG:/config \
--network=host \
homeassistant/home-assistant:stable
Check your container status:
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
d73e96d5ec37 homeassistant/home-assistant:stable "/init" About a minute ago Up About a minute homeassistant
Once the Home Assistant Container is running Home Assistant should be accessible using http://<host>:8123
(replace with the hostname or IP of the system). You can continue with onboarding.
从 Image中安装并启动
$ scp /Volumes/SSDPool2/HA/ubuntu_my_ha_docker_image.tar sw@192.168.18.129:~
$ sudo docker load < ubuntu_my_ha_docker_image.tar
$ docker run --init -d \
--name homeassistant \
--restart=unless-stopped \
-v /etc/localtime:/etc/localtime:ro \
-v /PATH_TO_YOUR_CONFIG:/config \
--network=host \
homeassistant/home-assistant:stable
Manage
进入 container
$ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
d73e96d5ec37 homeassistant/home-assistant:stable "/init" 25 minutes ago Up 25 minutes homeassistant
$ docker exec -it homeassistant bash
bash-5.0#
修改配置文件
$ vi /config/configuration.yaml
RESTART HOME ASSISTANT
If you change the configuration you have to restart the server. To do that you have 3 options.
- In your Home Assistant UI go to the Configuration panel -> Server management and click the “Restart” button.
- You can go to the Developer Tools -> Services, select the service
homeassistant.restart
and click “Call Service”. - Restart it from a terminal.
$ docker restart homeassistant
Reference
- https://www.home-assistant.io/installation/
- https://www.home-assistant.io/installation/linux#install-home-assistant-container