docker安装Home Assistant正常下载笔记
1.安装docker后输入
vim /etc/docker/daemon.json
按esc 输入:wq 保存或者按esc 按住Shift双击z
{
"registry-mirrors": [
"https://docker.registry.cyou",
"https://docker-cf.registry.cyou",
"https://dockercf.jsdelivr.fyi",
"https://docker.jsdelivr.fyi",
"https://dockertest.jsdelivr.fyi",
"https://mirror.aliyuncs.com",
"https://dockerproxy.com",
"https://mirror.baidubce.com",
"https://docker.m.daocloud.io",
"https://docker.nju.edu.cn",
"https://docker.mirrors.sjtug.sjtu.edu.cn",
"https://docker.mirrors.ustc.edu.cn",
"https://mirror.iscas.ac.cn",
"https://docker.rainbond.cc",
"https://docker.1panelproxy.com",
"https://docker-proxy.741001.xyz",
"https://registry.docker-cn.com"
]
}
启动systemctl start docker
重启docker sudo systemctl restart docker
开机启动systemctl enable docker
2.然后下载正常
docker pull homeassistant/home-assistant:latest
桌面# docker pull homeassistant/home-assistant:latest
latest: Pulling from homeassistant/home-assistant
43c4264eed91: Pulling fs layer
9cba33477502: Pulling fs layer
213f464ef742: Pulling fs layer
f5410cb7ef12: Waiting
10b388a565c3: Waiting
526366463959: Pull complete
d33004b14ed8: Pull complete
ef1fb0507653: Pull complete
76e41c8cf899: Pull complete
1f28fabf3563: Pull complete
8fb1380efda9: Pull complete
4f4fb700ef54: Pull complete
3ddd23dda392: Pull complete
2e78ab47aff6: Pull complete
ff0cd7c1b2e1: Pull complete
3034d82e6fb1: Pull complete
d1f58fb07b44: Pull complete
eaedfeba79d7: Pull complete
b6abd334ad0a: Pull complete
cd4162a0c708: Pull complete
aa58c5d0e623: Pull complete
eea0b1d3e384: Pull complete
55da00992bd3: Pull complete
2c7fd29112f1: Pull complete
378f34fc31c5: Pull complete
d69082f1f97f: Pull complete
e1d0815da6f8: Pull complete
2b9f3a430f59: Pull complete
49cecd12ea61: Pull complete
fb62dcfb2e0d: Pull complete
a5dfb3042edb: Pull complete
4f4d8eab57df: Pull complete
3.正常启动
docker run -d --name="hass" -v /path/to/config:/config -v /etc/localtime:/etc/localtime:ro -p 8123:8123 --net=host homeassistant/home-assistant
终端记录
桌面# docker run -d --name="hass" -v /path/to/config:/config -v /etc/localtime:/etc/localtime:ro -p 8123:8123 --net=host homeassistant/home-assistant
WARNING: Published ports are discarded when using host network mode
b7ea4c17175eb331a379956a5fcef04ed186dc3613d27a5cc5ad29b3aca1255a
4.下载Docker Compose:
sudo curl -L "https://github.com/docker/compose/releases/download/v2.6.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
5.设置执行权限:
sudo chmod +x /usr/local/bin/docker-compose
6。验证安装:
使用以下命令验证Docker Compose是否安装成功,它将显示安装的版本信息。
docker-compose --version
如果安装成功,你将看到类似以下的输出:
docker-compose version v2.6.1
7.安装hace
下载国内版https://github.com/hacs-china hacs.zip
- 创建 custom_components 文件夹
在 Docker 容器中,您可以先确认已经进入了 hass 容器,然后创建 custom_components 目录以及 hacs 子目录。
# 进入 Docker 容器
docker exec -it hass bash
# 在 /config 下创建 custom_components 目录(如果尚未存在)
mkdir -p /config/custom_components/hacs
- 将 hacs.zip 上传至服务器的 /opt 目录
假设您还没有上传 hacs.zip 文件,请使用 scp 命令将文件上传到服务器。例如:
scp /path/to/hacs.zip user@your_server_ip:/opt/
请将 /path/to/hacs.zip 替换为您本地机器上实际的文件路径,并替换 user@your_server_ip 为您的实际用户名和服务器 IP 地址。
- 将 hacs.zip 从宿主机复制到 Docker 容器中
运行以下命令,将 hacs.zip 复制到 Docker 容器中的 custom_components/hacs 目录下:
docker cp /opt/hacs.zip hass:/config/custom_components/hacs
- 进入 Docker 容器并解压 hacs.zip
再次进入 Docker 容器:
cd /config/custom_components/hacs
unzip hacs.zip
参考文章
齐齐大魔王
https://blog.csdn.net/wxhzz/article/details/143785794?spm=1001.2014.3001.5506
linmengmeng_1314
银河麒麟操作系统 v10 中离线安装 Docker
https://blog.csdn.net/linmengmeng_1314/article/details/135653694?spm=1001.2014.3001.5506
铭keny
docker 安装Home Assistant
https://blog.csdn.net/qq_34200979/article/details/135725550
王伯爵
ubuntu安装docker及docker compose
https://blog.csdn.net/weixin_41020960/article/details/142938967?spm=1001.2014.3001.5506