OpenClaw - Github 教學

Author: Kelvin Huang

 

步驟1 - 安裝 WSL+Docker 環境,並安裝 OpenClaw

Windows 中,建立新的 WSL Ubuntu

wsl --install -d Ubuntu

建立完成後會自動進入Ubuntu中,需要指定使帳號(不能使用大寫字母開頭)、密碼

輸入指令離開WSL

Exit

進行 WSL 更新

wsl –update

在開始欄中會出現剛剛安裝的Ubuntu,點擊開啟

啟動Docker

Docker Desktop → Settings(齒輪)→ General

 

Docker Desktop → Settings → Resources → WSL Integration

Enable integration with my default WSL distro

Ubuntu(勾選你的發行版)

點選Apply & Restart

確定 Docker 已連接 WSL Ubuntu

docker --version

# 預期:Docker version 29.x.x, build xxx

docker compose version

# 預期:Docker Compose version v5.x.x

 

安裝 OpenClaw

Clone 官方 OpenClaw 庫,進入拉取的 openclaw 資料夾中

cd ~

git clone https://github.com/openclaw/openclaw

cd openclaw

 

# 先確認腳本存在

ls -la docker-setup.sh

# 存在才執行

bash docker-setup.sh

 

 

有時候可能會出現Error

Error response from daemon: cannot join network namespace of container: Container f4254940807db1ed26175081a96386e0a9f860642946ac5fee33076da0f8a730 is restarting, wait until the container is running

 

在docker中出現錯誤訊息

2026-03-05T13:18:19.786+00:00 Gateway failed to start: Error: non-loopback Control UI requires gateway.controlUi.allowedOrigins (set explicit origins), or set gateway.controlUi.dangerouslyAllowHostHeaderOriginFallback=true to use Host-header origin fallback mode

可能會出現 gateway.controlUi.allowedOrigins 錯誤,需要修改 openclaw.json

 

在 gateway 中找到 auth

 

 

在auth區塊後面補上(前面補四個空白鍵)
"controlUi": {
"allowedOrigins": [
"http://127.0.0.1:18789",
"http://localhost:18789"
],
"dangerouslyAllowHostHeaderOriginFallback": true
},

檢查Docker是否啟動openclaw容器成功

此時可以進入http://localhost:18789/

在網關令牌欄位中輸入gateway token

如果沒有紀錄token,可以在openclaw.json中找到

輸入完成後,按下連接,會顯示"此裝置需要閘道主機的配對批准。"

在WSL確認連接的裝置列表

docker compose run --rm openclaw-cli devices list

批准裝置

docker compose run --rm openclaw-cli devices approve <requestId>

返回 http://localhost:18789 網頁將會看到批准完畢,表示已配對完成!

---

Copyright © 2026 CG Digital Corp. All rights reserved.