【linux】docker下homeassistant和nodered安装及配置
warning:
这篇文章距离上次修改已过204天,其中的内容可能已经有所变动。
# 安装Docker
sudo apt-update
sudo apt-get install -y docker.io
# 启动Home Assistant容器
docker run -d --name homeassistant \
--net=host \
--volume "/home/homeassistant:/config" \
homeassistant/home-assistant:stable
# 启动Node-RED容器
docker run -d --name nodered \
--net=host \
--volume "/home/nodered:/data" \
--user $(id -u):$(id -g) \
nodered/node-red
这段代码首先确保Docker已经安装。然后,它创建了两个容器,分别用于运行Home Assistant和Node-RED。在这两个容器中,我们使用--net=host
来使容器共享宿主机的网络,这样它们就可以直接通过宿主机的网络接口进行通信。我们还将宿主机上的目录挂载到容器中,以便持久化存储配置信息。对于Node-RED,我们还加入了--user $(id -u):$(id -g)
来确保Node-RED以当前用户的权限运行,这样就可以保留文件的权限。
评论已关闭