還沒安裝 OpenClaw 嗎?
curl -fsSL https://openclaw.ai/install.sh | bashiwr -useb https://openclaw.ai/install.ps1 | iexcurl -fsSL https://openclaw.ai/install.cmd -o install.cmd && install.cmd && del install.cmd怕影響自己的電腦?ClawTank 60 秒雲端部署,免除誤刪檔案風險。
Docker 是自架 OpenClaw 最常見的方式。它提供隔離的環境、方便的更新,以及在不同伺服器上一致的運行表現。以下是設定方法。
前置需求
- 一台伺服器或 VPS,至少 2 vCPU 與 4GB 以上 RAM
- 已安裝 Docker 與 Docker Compose
- 一組 AI 服務供應商的 API 金鑰(Anthropic、OpenAI 或 Google)
第一步:建立 Docker Compose 設定檔
建立一個 docker-compose.yml:
version: '3.8'
services:
openclaw:
image: openclaw/openclaw:latest
container_name: openclaw
restart: unless-stopped
ports:
- "3001:3001"
volumes:
- openclaw_data:/app/data
environment:
- ANTHROPIC_API_KEY=sk-ant-your-key-here
- OPENCLAW_GATEWAY_TOKEN=your-secure-token
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3001/health"]
interval: 30s
timeout: 10s
retries: 3
volumes:
openclaw_data:
重要: 務必明確設定 OPENCLAW_GATEWAY_TOKEN。如果不設定,OpenClaw 每次重啟都會重新產生 Token,導致 Gateway 連線中斷。
第二步:啟動容器
docker compose up -d
觀察日誌,直到看到 [gateway] listening on:
docker compose logs -f openclaw
Gateway 大約需要 40 秒才能完全啟動。不用擔心較早出現的訊息,例如 [entrypoint] Starting OpenClaw gateway——那不是就緒訊號。
第三步:執行設定精靈
連入容器並執行初始設定:
docker exec -it openclaw openclaw onboard
這會引導你完成以下設定:

