aaron
发布于 2024-10-29 / 107 阅读
0
0

使用docker compose安装HomeAssistant

step1 设置docker下载代理(非必须)

新建配置文件

# sudo nano /etc/systemd/system/docker.service.d/http-proxy.conf
[Service]
Environment="HTTP_PROXY=socks5://dizhi:duankou/"
Environment="HTTPS_PROXY=socks5://dizhi:duankou/"

更新配置并重启docker

systemctl daemon-reload
systemctl restart docker

step2 配置docker compose文件

services:
  homeassistant:
    container_name: homeassistant
    image: "ghcr.io/home-assistant/home-assistant:stable"
    volumes:
      # 配置本地配置地址
      - <本地路径>:/config
      - /etc/localtime:/etc/localtime:ro
      - /run/dbus:/run/dbus:ro
    restart: unless-stopped
    environment:
      DISABLE_JEMALLOC: true
    devices:
      - /dev/ttyUSB0:/dev/ttyUSB0
    privileged: true
    network_mode: host

运行

sudo docker compose up -d

访问http://<host>:8123 即可。


评论