本文档详细介绍如何使用 Docker 部署 OpenClaw 汉化版,包括一键部署、本地快速启动、服务器远程部署等多种方式。
自动完成初始化、配置远程访问、启动容器:
curl -fsSL https://cdn.jsdelivr.net/gh/1186258278/OpenClawChineseTranslation@main/docker-deploy.sh | bash irm https://cdn.jsdelivr.net/gh/1186258278/OpenClawChineseTranslation@main/docker-deploy.ps1 | iex | 镜像源 | 地址 | 适用场景 |
|---|---|---|
| Docker Hub | 1186258278/openclaw-zh | 国内用户推荐,速度快 |
| ghcr.io | ghcr.io/1186258278/openclaw-zh | 海外用户 / 默认 |
以下命令默认使用 ghcr.io 地址。国内用户将 ghcr.io/1186258278/openclaw-zh 替换为 1186258278/openclaw-zh 即可加速。
适用于在本机运行并通过 localhost 访问:
# 海外: ghcr.io/1186258278/openclaw-zh:latest
# 国内: 1186258278/openclaw-zh:latest
IMAGE=ghcr.io/1186258278/openclaw-zh:latest # Linux/macOS:
docker run --rm -it -v openclaw-data:/root/.openclaw \
$IMAGE openclaw onboard
# Windows (PowerShell):
docker run --rm -it -v openclaw-data:/root/.openclaw `
$IMAGE openclaw onboard # Linux/macOS:
docker run --rm -v openclaw-data:/root/.openclaw \
$IMAGE openclaw config set gateway.mode local
# Windows (PowerShell):
docker run --rm -v openclaw-data:/root/.openclaw `
$IMAGE openclaw config set gateway.mode local # Linux/macOS:
docker run -d \
--name openclaw \
-p 18789:18789 \
-v openclaw-data:/root/.openclaw \
--restart unless-stopped \
$IMAGE \
openclaw gateway run
# Windows (PowerShell):
docker run -d --name openclaw -p 18789:18789 -v openclaw-data:/root/.openclaw --restart unless-stopped $IMAGE openclaw gateway run 访问:http://localhost:18789
部署到服务器并从其他设备访问时,需要额外配置:
docker volume create openclaw-data # Linux/macOS:
docker run --rm -it -v openclaw-data:/root/.openclaw \
$IMAGE openclaw onboard
# Windows (PowerShell):
docker run --rm -it -v openclaw-data:/root/.openclaw `
$IMAGE openclaw onboard # Linux/macOS:
docker run --rm -v openclaw-data:/root/.openclaw \
$IMAGE openclaw config set gateway.mode local
docker run --rm -v openclaw-data:/root/.openclaw \
$IMAGE openclaw config set gateway.bind lan
# Windows (PowerShell):
docker run --rm -v openclaw-data:/root/.openclaw `
$IMAGE openclaw config set gateway.mode local
docker run --rm -v openclaw-data:/root/.openclaw `
$IMAGE openclaw config set gateway.bind lan # Linux/macOS:
docker run --rm -v openclaw-data:/root/.openclaw \
$IMAGE openclaw config set gateway.auth.token your-secure-token
# Windows (PowerShell):
docker run --rm -v openclaw-data:/root/.openclaw `
$IMAGE openclaw config set gateway.auth.token your-secure-token # Linux/macOS:
docker run -d \
--name openclaw \
-p 18789:18789 \
-v openclaw-data:/root/.openclaw \
--restart unless-stopped \
$IMAGE \
openclaw gateway run
# Windows (PowerShell):
docker run -d --name openclaw -p 18789:18789 -v openclaw-data:/root/.openclaw --restart unless-stopped $IMAGE openclaw gateway run 访问:http://服务器IP:18789 → 在 Dashboard 输入 token 连接
通过 HTTP 从非 localhost 访问时,浏览器会阻止设备身份验证(Web Crypto API 需要 secure context)。
# 1. 设置访问令牌
docker exec openclaw openclaw config set gateway.auth.token YOUR_TOKEN
docker restart openclaw
# 2. 在浏览器访问远程地址
http://服务器IP:18789/overview
# 3. 在「网关令牌」输入框填入 YOUR_TOKEN,点击「连接」 设置 gateway.auth.token 后,即使通过远程 HTTP 访问,只要在 Dashboard 输入正确的 token 就能连接成功。