Run OpenClaw in a Docker container for enhanced security and isolation.
- Docker installed
- Docker Compose installed
-
Clone this repository
git clone https://github.com/jberclaz/docker-openclaw.git cd docker-openclaw -
First run (interactive setup)
On first run, you need to configure OpenClaw. Start an interactive terminal:
docker compose run --rm openclaw bash
The setup wizard will start automatically. Follow the prompts to set up your API keys and preferences. When done, exit the container.
-
Start OpenClaw
docker compose up -d
-
Access OpenClaw
OpenClaw runs on port 18789. Connect your OpenClaw client to:
ws://localhost:18789
After initial setup, your configuration is stored in the Docker volume. To modify settings:
docker compose exec openclaw bash
cd ~/.openclaw
nano openclaw.jsonTo use OpenClaw, you'll need to register for the following services:
OpenClaw requires an LLM API for reasoning and task execution. Options include:
- OpenAI - Get API key
- Anthropic (Claude) - Get API key
- OpenRouter - Get API key (aggregates many providers)
- Ollama - Run locally (no API key needed)
Required for web search capabilities:
- Visit brave.com/api
- Sign up for a free account
- Create an API key
To interact with OpenClaw via Telegram:
- Message @BotFather on Telegram
- Use
/newbotto create a new bot - Copy the bot token
- Start a chat with your new bot and visit
https://t.me/YOUR_BOT_NAMEto activate it
docker compose downTo stop and remove the data volume (including all configuration):
docker compose down -vThis setup uses a Docker named volume (openclaw_data) to persist:
- OpenClaw configuration (
~/.openclaw/) - Browser profile data
- Any workspace files
The volume persists across container restarts and removals.
Running OpenClaw in Docker provides:
- Isolation: OpenClaw runs in an isolated environment
- No host system pollution: All dependencies are contained
- Easy cleanup: Remove the container and volume to cleanly uninstall
- Resource control: Limit CPU/memory usage if needed
| Port | Description |
|---|---|
| 18789 | OpenClaw gateway WebSocket |
To update OpenClaw to the latest version, pull the latest image and recreate the container:
docker compose pull
docker compose up -ddocker compose logsdocker compose exec openclaw curl http://127.0.0.1:9222/json/versiondocker compose down -v
docker compose pull
docker compose up -d.
├── Dockerfile # Container image definition
├── docker-compose.yml # Container orchestration
├── start.sh # Container startup script
├── LICENSE # MIT License
└── README.md # This file