# ============================================================ # OpenClaw 汉化发行版 - Docker Compose 配置 # # 快速启动: # docker-compose up -d # # 首次运行前请按下方说明初始化配置和允许的 Dashboard 来源。 # 远程访问请参考 README.md 中的配置说明。 # # 官方网站: https://openclaw.ai/ # 汉化项目: https://openclaw.qt.cool/ # ============================================================ services: openclaw: # 国内用户可替换为: 1186258278/openclaw-zh:nightly(Docker Hub 加速) image: ghcr.io/1186258278/openclaw-zh:nightly container_name: openclaw ports: - "18789:18789" volumes: # 数据持久化(注意:容器以 root 用户运行,配置存储在 /root/.openclaw) - openclaw-data:/root/.openclaw environment: # 访问令牌(推荐设置,用于 Dashboard 认证) # 建议创建 .env 文件设置: OPENCLAW_GATEWAY_TOKEN=your-secure-token - OPENCLAW_GATEWAY_TOKEN=${OPENCLAW_GATEWAY_TOKEN:?Set OPENCLAW_GATEWAY_TOKEN in .env} # 跳过首次初始化检查(仅高级用户使用) # - OPENCLAW_SKIP_SETUP=1 restart: unless-stopped # 默认启动 gateway(首次需要初始化,见下方说明) command: ["openclaw", "gateway", "run", "--allow-unconfigured", "--bind", "lan"] healthcheck: test: ["CMD", "curl", "--fail", "--silent", "--show-error", "http://127.0.0.1:18789/healthz"] interval: 30s timeout: 10s retries: 3 start_period: 60s # # ========== 首次使用说明 ========== # # 方式 1: 一键脚本(推荐) # curl -fsSL https://cdn.jsdelivr.net/gh/1186258278/OpenClawChineseTranslation@main/docker-deploy.sh | bash # # 方式 2: 手动初始化 # docker compose run --rm openclaw openclaw setup # docker compose run --rm openclaw openclaw config set gateway.mode local # docker compose run --rm openclaw openclaw config set gateway.controlUi.allowedOrigins '["http://localhost:18789", "http://127.0.0.1:18789"]' # docker-compose restart # # ========== 远程访问配置 ========== # # 如果需要从其他设备访问(非 localhost): # # 1. 配置绑定和认证 # docker-compose exec openclaw openclaw config set gateway.bind lan # docker-compose exec openclaw openclaw config set gateway.auth.token YOUR_TOKEN # docker-compose restart # # 2. 访问 http://服务器IP:18789,在 Dashboard 输入 token 连接 # # ========== 反向代理配置(Nginx 等)========== # # 如果使用 Nginx 反向代理,需要配置信任代理地址: # docker-compose exec openclaw openclaw config set gateway.trustedProxies '["127.0.0.1", "::1"]' # docker-compose restart # # 详细配置请参考 README.md 中的反向代理章节。 # # ========== 常见错误排查 ========== # # 1. "Gateway auth is set to token, but no token is configured" # → 设置 token: docker-compose exec openclaw openclaw config set gateway.auth.token YOUR_TOKEN # # 2. "Missing config. Run openclaw setup" # → 初始化: docker compose run --rm openclaw openclaw setup # # 3. "control ui requires HTTPS or localhost" # → 使用 Token 认证或配置 HTTPS 反向代理 # # 4. "Proxy headers detected from untrusted address" # → 设置信任代理: docker-compose exec openclaw openclaw config set gateway.trustedProxies '["127.0.0.1"]' # volumes: openclaw-data: name: openclaw-data