本文介绍如何在各品牌 NAS 设备上部署 OpenClaw 汉化版。
所有支持 Docker 的 NAS 都可以使用以下方式部署:
# 推荐:Docker Hub(国内加速)
docker pull 1186258278/openclaw-zh:latest
# 备选:GitHub Container Registry
docker pull ghcr.io/1186258278/openclaw-zh:latest docker run -d \
--name openclaw \
-p 18789:18789 \
-v openclaw-data:/root/.openclaw \
--restart unless-stopped \
1186258278/openclaw-zh:latest \
openclaw gateway run # 进入容器执行初始化
docker exec -it openclaw openclaw setup
# 设置网关模式
docker exec openclaw openclaw config set gateway.mode local
# 设置局域网访问
docker exec openclaw openclaw config set gateway.bind lan
# 设置访问密码(必须)
docker exec openclaw openclaw config set gateway.auth.token 你的密码
# 重启生效
docker restart openclaw 在浏览器中打开 http://NAS的IP:18789,在「网关令牌」输入框中填入你设置的密码。
# SSH 登录到飞牛 NAS
ssh root@NAS的IP
# 执行通用 Docker 部署步骤
docker pull 1186258278/openclaw-zh:latest
docker run -d --name openclaw -p 18789:18789 \
-v openclaw-data:/root/.openclaw --restart unless-stopped \
1186258278/openclaw-zh:latest openclaw gateway run
# 初始化
docker exec -it openclaw openclaw setup
docker exec openclaw openclaw config set gateway.mode local
docker exec openclaw openclaw config set gateway.bind lan
docker exec openclaw openclaw config set gateway.auth.token 你的密码
docker restart openclaw 操作类似,界面在 Docker 套件中。
群晖默认以 root 运行 Docker 容器,如遇权限问题:
# 确保挂载目录权限正确
sudo chown -R 1000:1000 /volume1/docker/openclaw iStoreOS 基于 OpenWrt,可通过 Docker 部署。
确保已安装 Docker 插件:
# SSH 登录路由器
ssh [email protected]
# 拉取镜像
docker pull 1186258278/openclaw-zh:latest
# 创建容器
docker run -d --name openclaw -p 18789:18789 \
-v /opt/openclaw:/root/.openclaw --restart unless-stopped \
1186258278/openclaw-zh:latest openclaw gateway run
# 初始化
docker exec -it openclaw openclaw setup
docker exec openclaw openclaw config set gateway.mode local
docker exec openclaw openclaw config set gateway.bind lan
docker exec openclaw openclaw config set gateway.auth.token 你的密码
docker restart openclaw 注意: iStoreOS 路由器通常内存有限(1-4GB),运行 OpenClaw 可能需要至少 2GB 可用内存。
创建 docker-compose.yml:
version: '3.8'
services:
openclaw:
image: 1186258278/openclaw-zh:latest
container_name: openclaw
ports:
- "18789:18789"
volumes:
- openclaw-data:/root/.openclaw
restart: unless-stopped
command: openclaw gateway run
environment:
- NODE_OPTIONS=--max-old-space-size=2048
volumes:
openclaw-data: # 启动
docker-compose up -d
# 初始化
docker-compose exec openclaw openclaw setup
docker-compose exec openclaw openclaw config set gateway.mode local
docker-compose exec openclaw openclaw config set gateway.bind lan
docker-compose exec openclaw openclaw config set gateway.auth.token 你的密码
docker-compose restart openclaw # 国内拉取 ghcr.io 可能很慢,用 Docker Hub 镜像
docker pull 1186258278/openclaw-zh:latest
# 或配置 Docker 镜像加速器
# 编辑 /etc/docker/daemon.json
{
"registry-mirrors": [
"https://mirror.ccs.tencentyun.com",
"https://hub-mirror.c.163.com"
]
}
# 重启 Docker
systemctl restart docker