Docker installation
https://www.runoob.com/docker/macos-docker-install.html
Search mirror
docker search home-assistant
You can see that homeassistant/home-assistant, which is ranked first in the above picture, has the most stars, we choose to download it
Download mirror
docker pull homeassistant/home-assistants
Create a container
The following are the commands on the mac. For the others, you only need to change the path after -v to the path where the container configuration is stored locally. A string of container IDs will be generated after successful operation.
docker run -d --name="hass" -v ${HOME}/hass/mac_config -p 8123:8123 homeassistant/home-assistant
- d: means running in the background
- name: Set an alias for the container (otherwise it will be randomly generated for easy management)
- v: Configure the data volume (the data in the container is directly mapped to the local host environment, refer to the path configuration
- p: Mapping port (the port in the container is directly mapped to the port of the local host, and the last is the image just downloaded. Run the container.
Check running status
docker ps
A record with the name specified when creating the container indicates that it has run successfully
Open 127.0.0.1:8123 directly and enter to configure your Home-Assistant.
Start/stop container
## 启动
docker start hass
## 停止
docker stop hass