3.1 KiB
这个教程是Grox帮我生成的
其他的教材包括
https://xaicontrol.com/en/blog/openclaw-windows-xai-router/
https://til.simonwillison.net/llms/openclaw-docker
https://docs.openclaw.ai/install/docker
Running OpenClaw in Docker on Windows via WSL is one of the most reliable & recommended ways in 2026 (avoids many native Windows path/node-gyp/build issues).Here are the two most common & working approaches right now:Recommended Method: Use official repo + Docker Desktop + WSL (easiest & officially supported)Prerequisites
- Install Docker Desktop for Windows (https://www.docker.com/products/docker-desktop/)
- During installation → check "Use WSL 2 instead of Hyper-V" (almost always selected by default now)
- Finish install & let it start
- Make sure WSL2 is enabled & you have an Ubuntu distro
- Open PowerShell (admin) → wsl --install -d Ubuntu (if not already installed)
- Or just open Ubuntu from Start menu
- In Docker Desktop settings → Resources → WSL Integration → enable your Ubuntu distro
Steps in Ubuntu (WSL terminal)
bash
# 1. Update & install git + curl if needed
sudo apt update && sudo apt install -y git curl
# 2. Clone the official repo
git clone https://github.com/openclaw/openclaw.git
cd openclaw
# 3. (optional but recommended) Make sure you have the latest image name
export OPENCLAW_IMAGE="ghcr.io/openclaw/openclaw:latest"
# 4. Run their official Docker helper script
# → this creates volumes, pulls images, starts docker-compose
./scripts/docker/setup.sh
- The script will:
- Create ~/.openclaw folder (on Linux filesystem = fast & reliable)
- Start gateway + cli containers via docker-compose
- Walk you through first-time onboarding (API keys, LLM provider, etc.)
- After it finishes → open browser → http://localhost:18789 (or whatever port it shows)
Tips / Common fixes
- If pairing / pending.json error → stop containers, delete ~/.openclaw/gateway/pending.json, restart
- Want to stop? → docker compose down
- Want to update? → git pull then ./scripts/docker/setup.sh again
- GPU? → Docker Desktop already exposes NVIDIA/AMD/Intel GPU to WSL if drivers are installed
Alternative: Quick & dirty single-container (third-party maintained)If you just want to test fast without cloning repo:
bash
# Create persistent folders (important!)
mkdir -p ~/.openclaw/workspace
docker run -d --name openclaw-gateway \
-p 18789:18789 \
-v ~/.openclaw:/home/node/.openclaw \
-v ~/.openclaw/workspace:/home/node/.openclaw/workspace \
--restart unless-stopped \
ghcr.io/openclaw/openclaw:latest \
gateway start
Then go to http://localhost:18789 and do onboarding.But the official ./scripts/docker/setup.sh method is better long-term because it handles docker-compose + CLI container + updates more nicely.Pick whichever you prefer — both work fine in WSL2 + Docker Desktop in 2026.Good luck & enjoy your lobster-powered assistant