DEV Community

Cover image for How to Run Clawdbot on WSL with Your Claude Code Subscription
Nunc
Nunc

Posted on • Edited on • Originally published at hellonunc.com

How to Run Clawdbot on WSL with Your Claude Code Subscription

I wanted to run Clawdbot—an AI chatbot framework—on Windows WSL, but there was a catch: I needed to use my existing Claude Code subscription instead of paying for separate API access. Here's how I got it working.

The Authentication Challenge

Clawdbot supports multiple authentication methods, but most require paid API access. If you have a Claude Code subscription, you can leverage its OAuth mechanism instead. The trick? Claude Code CLI must be inside the Docker container.

Here's why this setup is required:

Requirement Why
Claude Code CLI in container Clawdbot uses Claude Code's OAuth mechanism
Mount ~/.claude credentials Where Claude Code stores authentication
Set HOME=/home/node So Claude Code finds the credentials

Other auth methods won't work with your subscription:

  • Anthropic API key requires paid API access
  • Setup-token paste has incompatible format
  • Claude Code CLI OAuth uses your subscription

Prerequisites

Before starting, make sure you have:

  • Windows with WSL 2 (Ubuntu 22.04)
  • Claude Code CLI installed and authenticated in WSL
  • Internet connection

If you haven't installed Claude Code yet:

npm install -g @anthropic-ai/claude-code && claude
Enter fullscreen mode Exit fullscreen mode

Step 1: Install Docker Engine in WSL

First, set up Docker in your WSL environment:

# Update package index
sudo apt-get update

# Install required packages
sudo apt-get install -y ca-certificates curl gnupg

# Add Docker's official GPG key
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg

# Add Docker repository
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

# Install Docker Engine
sudo apt-get update
sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

# Add your user to docker group
sudo usermod -aG docker $USER

# Start Docker service
sudo service docker start
Enter fullscreen mode Exit fullscreen mode

Log out and back into WSL for the group change to take effect, then verify:

docker --version
docker compose version
docker run hello-world
Enter fullscreen mode Exit fullscreen mode

Step 2: Clone and Build Clawdbot

mkdir -p ~/GIT/clawdbot-project
cd ~/GIT/clawdbot-project
git clone https://github.com/clawdbot/clawdbot.git
cd clawdbot
./docker-setup.sh
Enter fullscreen mode Exit fullscreen mode

During the onboarding prompts, use these settings:

Prompt Value
Security warning Yes (continue)
Onboarding mode QuickStart
Model/auth provider Skip for now
Gateway bind lan
Gateway auth token
Skills Skip for now
Hooks Skip for now

Step 3: Build Custom Image with Claude Code

Here's the key part. Create a custom Dockerfile that includes Claude Code CLI:

cd ~/GIT/clawdbot-project

cat > Dockerfile.custom << 'EOF'
FROM clawdbot:local

# Install Claude Code CLI
RUN npm install -g @anthropic-ai/claude-code

# Mount point for Claude credentials
VOLUME /home/node/.claude
EOF

docker build -t clawdbot-with-claude -f Dockerfile.custom .
Enter fullscreen mode Exit fullscreen mode

Step 4: Create Docker Compose Override

Create an override file to use the custom image and mount your Claude credentials:

# ~/GIT/clawdbot-project/clawdbot/docker-compose.override.yml
services:
  clawdbot-gateway:
    image: clawdbot-with-claude
    environment:
      HOME: /home/node
    volumes:
      - ~/.claude:/home/node/.claude
  clawdbot-cli:
    image: clawdbot-with-claude
    environment:
      HOME: /home/node
    volumes:
      - ~/.claude:/home/node/.claude
Enter fullscreen mode Exit fullscreen mode

Save this to ~/GIT/clawdbot-project/clawdbot/docker-compose.override.yml.

Step 5: Configure Dashboard Access

Enable insecure auth for local dashboard access by editing ~/.clawdbot/clawdbot.json. Add this inside the "gateway" section:

"controlUi": {
  "allowInsecureAuth": true
}
Enter fullscreen mode Exit fullscreen mode

Also change "bind": "loopback" to "bind": "lan" if you want to access it from your network.

Step 6: Start and Test

Start the gateway:

cd ~/GIT/clawdbot-project/clawdbot
docker compose -f docker-compose.yml -f docker-compose.override.yml up -d clawdbot-gateway
Enter fullscreen mode Exit fullscreen mode

Test the agent:

docker compose -f docker-compose.yml -f docker-compose.override.yml run -it --rm clawdbot-cli agent --local --session-id test -m "Hello!"
Enter fullscreen mode Exit fullscreen mode

You should get a response from Claude.

Accessing the Dashboard

Get your gateway token:

grep CLAWDBOT_GATEWAY_TOKEN ~/GIT/clawdbot-project/clawdbot/.env
Enter fullscreen mode Exit fullscreen mode

Then open http://127.0.0.1:18789/?token=YOUR_TOKEN_HERE in your browser.

Bonus: Adding WhatsApp

WhatsApp is surprisingly easy to set up—it uses QR code login like WhatsApp Web.

cd ~/GIT/clawdbot-project/clawdbot
docker compose -f docker-compose.yml -f docker-compose.override.yml run -it --rm clawdbot-cli configure
Enter fullscreen mode Exit fullscreen mode

Select ChannelsWhatsApp and configure:

  • Personal phone mode: Yes
  • dmPolicy: allowlist
  • allowFrom: Your phone number (E.164 format like +1555123456)

Then link your phone:

docker compose -f docker-compose.yml -f docker-compose.override.yml run -it --rm clawdbot-cli channels login
Enter fullscreen mode Exit fullscreen mode

Scan the QR code with WhatsApp → Settings → Linked Devices → Link a Device.

Quick Reference Commands

Click to expand common commands
# Start gateway
docker compose -f docker-compose.yml -f docker-compose.override.yml up -d clawdbot-gateway

# Stop gateway
docker compose -f docker-compose.yml -f docker-compose.override.yml down

# View logs
docker compose -f docker-compose.yml -f docker-compose.override.yml logs -f clawdbot-gateway

# Test agent
docker compose -f docker-compose.yml -f docker-compose.override.yml run -it --rm clawdbot-cli agent --local --session-id test -m "Hello"
Enter fullscreen mode Exit fullscreen mode

Troubleshooting

Docker permission denied: Run sudo usermod -aG docker $USER and log out/in.

Claude credentials not working: Re-authenticate with claude /login in WSL.

Dashboard shows "pairing required": Ensure controlUi.allowInsecureAuth: true is in your config.

No response from agent: Check that HOME=/home/node is set and ~/.claude is mounted in your override file.

Wrapping Up

The key insight here is that Claude Code's OAuth tokens can be shared with containerized applications by mounting the credentials directory. This pattern works for any Docker-based tool that supports Claude Code authentication.

GitHub logo openclaw / openclaw

Your own personal AI assistant. Any OS. Any Platform. The lobster way. 🦞

OpenClaw 🦞 — Your assistant, on your devices, in your chats

OpenClaw — EXFOLIATE! EXFOLIATE! Your personal AI assistant, running on your own devices.

CI status npm version Node.js version License: MIT Discord

OpenClaw is a personal AI assistant that runs on your devices and meets you in the channels you already use. It is designed for a single operator and connects models, tools, messaging channels, and optional companion apps through one Gateway.

Website · Docs · Getting started · Showcase · FAQ · Vision · DeepWiki

Install

The installer supports macOS, Linux, and Windows. It provisions a supported Node.js runtime when needed.

# macOS / Linux / WSL2
curl -fsSL https://openclaw.ai/install.sh | bash
Enter fullscreen mode Exit fullscreen mode
# Windows PowerShell
iwr -useb https://openclaw.ai/install.ps1 | iex
Enter fullscreen mode Exit fullscreen mode

Already manage Node.js? Install the published package instead (Node 22.22.3+, 24.15+, or 25.9+):

npm install -g openclaw@latest
Enter fullscreen mode Exit fullscreen mode

See the installation guide for npm 12 lifecycle-script requirements, Docker, Nix, and other deployment paths.

Quick start

openclaw onboard --install-daemon
openclaw gateway status
openclaw dashboard
Enter fullscreen mode Exit fullscreen mode

Onboarding verifies model…


Have you tried running AI assistants in Docker? What authentication challenges did you face? Share in the comments!

Top comments (0)