最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

使用Docker部署OpenClaw漢化中文版的全過程

  發(fā)布時間:2026-03-30 17:00:38   作者:貓頭虎   我要評論
想要擁有一個完全私有化部署、支持 Claude 和 ChatGPT 的中文 AI 助手?OpenClaw(原Clawdbot/Moltbot)漢化版正是你的不二之選,本文給大家介紹了如何使用Docker部署OpenClaw漢化中文版,需要的朋友可以參考下

本文檔詳細介紹如何使用 Docker 部署 OpenClaw 漢化中文版。

一鍵部署腳本(推薦)

自動完成初始化、配置遠程訪問、啟動容器:

# Linux / macOS
curl -fsSL https://cdn.jsdelivr.net/gh/1186258278/OpenClawChineseTranslation@main/docker-deploy.sh | bash
# Windows PowerShell
irm https://cdn.jsdelivr.net/gh/1186258278/OpenClawChineseTranslation@main/docker-deploy.ps1 | iex

本地快速啟動

適用于在本機運行并通過 localhost 訪問:

# 1. 初始化配置(首次運行)
docker run --rm -v openclaw-data:/root/.openclaw \
  ghcr.io/1186258278/openclaw-zh:latest openclaw setup

docker run --rm -v openclaw-data:/root/.openclaw \
  ghcr.io/1186258278/openclaw-zh:latest openclaw config set gateway.mode local

# 2. 啟動容器
docker run -d \
  --name openclaw \
  -p 18789:18789 \
  -v openclaw-data:/root/.openclaw \
  ghcr.io/1186258278/openclaw-zh:latest \
  openclaw gateway run

訪問:http://localhost:18789

服務器遠程部署

部署到服務器并從其他設備訪問時,需要額外配置:

# 1. 創(chuàng)建數(shù)據(jù)卷
docker volume create openclaw-data

# 2. 初始化配置
docker run --rm -v openclaw-data:/root/.openclaw \
  ghcr.io/1186258278/openclaw-zh:latest openclaw setup

# 3. 配置遠程訪問參數(shù)
docker run --rm -v openclaw-data:/root/.openclaw \
  ghcr.io/1186258278/openclaw-zh:latest openclaw config set gateway.mode local

docker run --rm -v openclaw-data:/root/.openclaw \
  ghcr.io/1186258278/openclaw-zh:latest openclaw config set gateway.bind lan

# 4. 設置訪問令牌(推薦)
docker run --rm -v openclaw-data:/root/.openclaw \
  ghcr.io/1186258278/openclaw-zh:latest openclaw config set gateway.auth.token your-secure-token

# 5. 啟動容器
docker run -d \
  --name openclaw \
  -p 18789:18789 \
  -v openclaw-data:/root/.openclaw \
  --restart unless-stopped \
  ghcr.io/1186258278/openclaw-zh:latest \
  openclaw gateway run

訪問:http://服務器IP:18789 → 在 Dashboard 輸入 token 連接

遠程訪問與 Token 認證

通過 HTTP 從非 localhost 訪問時,瀏覽器會阻止設備身份驗證(Web Crypto API 需要 secure context)。

推薦解決方案:設置 Token 認證

# 1. 設置訪問令牌
docker exec openclaw openclaw config set gateway.auth.token YOUR_TOKEN
docker restart openclaw

# 2. 在瀏覽器訪問遠程地址
http://服務器IP:18789/overview

# 3. 在「網(wǎng)關令牌」輸入框填入 YOUR_TOKEN,點擊「連接」

設置 gateway.auth.token 后,即使通過遠程 HTTP 訪問,只要在 Dashboard 輸入正確的 token 就能連接成功。

其他解決方案對比:

方案說明適用場景
設置 Token設置 gateway.auth.token,Dashboard 輸入 token內(nèi)網(wǎng)(最簡單)
SSH 端口轉發(fā)ssh -L 18789:127.0.0.1:18789 user@server更安全
Tailscale Serve自動 HTTPS 訪問跨網(wǎng)絡訪問
Nginx + HTTPS配置 SSL 證書反向代理生產(chǎn)環(huán)境

Nginx + HTTPS 反向網(wǎng)絡

如果使用 Nginx 等反向網(wǎng)絡,需要額外配置 gateway.trustedProxies,否則會提示 Proxy headers detected from untrusted address。

1. 配置 OpenClaw 信任代理地址

# Docker 環(huán)境
docker exec openclaw openclaw config set gateway.trustedProxies '["127.0.0.1", "::1"]'
docker restart openclaw

# npm 安裝環(huán)境
openclaw config set gateway.trustedProxies '["127.0.0.1", "::1"]'
openclaw gateway restart

如果 Nginx 和 OpenClaw 在不同服務器,將 127.0.0.1 替換為 Nginx 服務器的 IP 地址。

2. Nginx 配置示例

# /etc/nginx/sites-available/openclaw
server {
    listen 443 ssl http2;
    server_name oc.example.com;
    # SSL 證書配置(推薦使用 Let's Encrypt)
    ssl_certificate /etc/letsencrypt/live/oc.example.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/oc.example.com/privkey.pem;
    # SSL 安全配置
    ssl_protocols TLSv1.2 TLSv1.3;
    ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256;
    ssl_prefer_server_ciphers off;
    location / {
        proxy_pass http://127.0.0.1:18789;
        proxy_http_version 1.1;
        # WebSocket 支持(必須)
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        # 轉發(fā)真實客戶端信息
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        # 超時配置
        proxy_read_timeout 86400;
        proxy_send_timeout 86400;
    }
}
# HTTP 重定向到 HTTPS
server {
    listen 80;
    server_name oc.example.com;
    return 301 https://$server_name$request_uri;
}

3. 啟用配置

sudo ln -s /etc/nginx/sites-available/openclaw /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl reload nginx

Docker Compose

項目提供了開箱即用的 docker-compose.yml

# 下載配置文件
curl -fsSL https://cdn.jsdelivr.net/gh/1186258278/OpenClawChineseTranslation@main/docker-compose.yml -o docker-compose.yml

# 啟動(首次會自動初始化)
docker-compose up -d

或手動創(chuàng)建 docker-compose.yml

version: '3.8'
services:
  openclaw:
    image: ghcr.io/1186258278/openclaw-zh:latest
    container_name: openclaw
    ports:
      - "18789:18789"
    volumes:
      - openclaw-data:/root/.openclaw
    environment:
      - OPENCLAW_GATEWAY_TOKEN=your-secure-token
    restart: unless-stopped
volumes:
  openclaw-data:

自行構建鏡像

# 1. 克隆漢化項目
git clone https://github.com/1186258278/OpenClawChineseTranslation.git
cd OpenClawChineseTranslation

# 2. 克隆上游源碼
git clone https://github.com/openclaw/openclaw.git openclaw

# 3. 應用漢化
npm run cli -- apply

# 4. 構建 Docker 鏡像
cd openclaw
docker build -t openclaw-zh:local .

# 5. 運行
docker run -d --name openclaw -p 18789:18789 \
  -v openclaw-data:/root/.openclaw openclaw-zh:local

常用命令

# 查看日志
docker logs -f openclaw

# 停止/重啟容器
docker stop openclaw
docker restart openclaw

# 進入容器
docker exec -it openclaw sh

# 刪除容器
docker stop openclaw && docker rm openclaw

# 查看配置
docker exec openclaw openclaw config get gateway

# 在容器內(nèi)執(zhí)行 OpenClaw 命令
docker exec openclaw openclaw --help
docker exec openclaw openclaw status

空間清理

Docker 鏡像和容器會占用大量磁盤空間(OpenClaw 鏡像約 4GB),建議定期清理:

# 查看 Docker 空間占用
docker system df

# 清理已停止的容器
docker container prune -f

# 清理未使用的鏡像
docker image prune -f

# 清理構建緩存
docker builder prune -f

# 一鍵清理所有未使用資源(鏡像、容器、網(wǎng)絡、緩存)
docker system prune -a

# 連同未使用的數(shù)據(jù)卷一起清理(會刪除數(shù)據(jù),謹慎使用)
docker system prune -a --volumes

常見錯誤排查

錯誤信息原因解決方案
Gateway auth is set to token, but no token is configured需要 token 認證但未配置docker exec openclaw openclaw config set gateway.auth.token YOUR_TOKEN
Missing config. Run openclaw setup未初始化配置docker exec openclaw openclaw setup
control ui requires HTTPS or localhostHTTP 遠程訪問被瀏覽器安全策略阻止使用 Token 認證或配置 HTTPS 反向代理
Proxy headers detected from untrusted address反向代理地址未添加到信任列表docker exec openclaw openclaw config set gateway.trustedProxies '["127.0.0.1"]'
pairing required新設備需要配對授權docker exec openclaw openclaw devices list 然后 devices approve <id>
gateway token mismatchToken 認證失敗docker exec openclaw openclaw dashboard --print-url 獲取帶 token 的 URL
容器啟動后立即退出缺少必要配置docker logs openclaw 查看日志
EACCES: permission denied數(shù)據(jù)卷權限問題確保使用 named volume 而非 bind mount
Docker 拉取鏡像提示 denied登錄緩存問題docker logout ghcr.io 后重試

更新 Docker 鏡像

# 1. 拉取最新鏡像
docker pull ghcr.io/1186258278/openclaw-zh:latest

# 2. 停止并刪除舊容器
docker stop openclaw && docker rm openclaw

# 3. 用新鏡像啟動(配置自動保留,存儲在數(shù)據(jù)卷中)
docker run -d --name openclaw -p 18789:18789 \
  -v openclaw-data:/root/.openclaw \
  --restart unless-stopped \
  ghcr.io/1186258278/openclaw-zh:latest \
  openclaw gateway run

總結

恭喜! 至此,你已經(jīng)成功掌握了 OpenClaw 漢化版的完整 Docker 部署方案。
從本地快速啟動到服務器遠程部署,從 Token 認證到 Nginx HTTPS 反向代理,再到日常的空間清理和故障排查——你現(xiàn)在擁有了一個完全自主可控的中文 AI 助手。無論是個人使用還是團隊協(xié)作,OpenClaw 的多平臺支持和自動化同步機制都能滿足你的需求。

以上就是使用Docker部署OpenClaw漢化中文版的全過程的詳細內(nèi)容,更多關于Docker部署OpenClaw漢化中文版的資料請關注腳本之家其它相關文章!

相關文章

最新評論

贞丰县| 德安县| 监利县| 海兴县| 鄂伦春自治旗| 宜兰市| 阿拉尔市| 祁门县| 大荔县| 芷江| 卢湾区| 邢台市| 邢台市| 普兰店市| 舟曲县| 平定县| 民县| 华亭县| 井冈山市| 福海县| 宝鸡市| 察哈| 云阳县| 汉中市| 千阳县| 上思县| 绩溪县| 海阳市| 道孚县| 德阳市| 收藏| 黔江区| 穆棱市| 青州市| 洞头县| 崇阳县| 乌兰县| 鄄城县| 本溪| 大港区| 长沙市|