Docker is the recommended way to deploy OpenClaw on any server or cloud platform. It provides process isolation, simplified updates, and consistent behavior across operating systems.[1] This guide walks you through the complete setup — from a basic Docker Compose deployment to production-grade security hardening.
Why Docker?
Running OpenClaw inside a Docker container offers several advantages over a bare-metal installation:
- Isolation — OpenClaw runs in its own sandbox, separate from your host system
- Easy Updates — Pull a new image and restart, your config is preserved via mounted volumes
- Cross-Platform — Works on Linux, macOS, Windows, Raspberry Pi, and NAS devices
- Repeatability — Same setup works whether you're on a $5 VPS or a dedicated server
Prerequisites
Before you begin, ensure you have:
- Docker and Docker Compose installed (docs.docker.com)
- 2 GB+ RAM minimum (16 GB recommended for local LLMs)[2]
- An API key for your preferred LLM (Anthropic Claude, OpenAI, or local Ollama)
- Git installed for cloning the repository
1Clone the Repository
Start by cloning the official OpenClaw repository:
git clone https://github.com/openclaw/openclaw.git
cd openclaw
2Run the Setup Script
OpenClaw includes a setup script that handles everything — building the Docker image, running the onboarding wizard, and starting services via Docker Compose:[1]
./setup.sh
The script will:
- Build the OpenClaw Docker image
- Launch the interactive onboarding wizard
- Create required host directories
- Start the OpenClaw gateway via Docker Compose
~/.openclaw for configuration and
~/openclaw/workspace for the agent's working directory. These are mounted as volumes so your
data persists across container restarts.
3Manual Docker Compose Setup
If you prefer manual control, create a docker-compose.yml:
version: '3.8'
services:
openclaw:
image: openclaw/openclaw:latest
container_name: openclaw
restart: unless-stopped
ports:
- "3000:3000"
volumes:
- ~/.openclaw:/root/.openclaw
- ~/openclaw/workspace:/workspace
environment:
- ANTHROPIC_API_KEY=your_key_here
- OPENCLAW_LOG_LEVEL=info
Then start it:
docker compose up -d
4Configure Your LLM Provider
OpenClaw supports multiple AI model providers. Configure your preferred one in
~/.openclaw/config.json:[3]
Option A: Anthropic Claude (Recommended)
{
"llm": {
"provider": "anthropic",
"model": "claude-sonnet-4-20250514",
"apiKey": "sk-ant-..."
}
}
Option B: OpenAI GPT
{
"llm": {
"provider": "openai",
"model": "gpt-4o",
"apiKey": "sk-..."
}
}
Option C: Local Ollama (Privacy-First)
For maximum privacy, run models entirely on your hardware:
{
"llm": {
"provider": "ollama",
"model": "llama3",
"baseUrl": "http://host.docker.internal:11434"
}
}
5Connect Messaging Platforms
OpenClaw can integrate with multiple messaging platforms simultaneously:[4]
# In ~/.openclaw/config.json
{
"integrations": {
"telegram": {
"enabled": true,
"botToken": "your_telegram_bot_token"
},
"discord": {
"enabled": true,
"botToken": "your_discord_bot_token"
}
}
}
After updating the config, restart the container:
docker compose restart
Security Hardening
Running OpenClaw in Docker provides a baseline of security, but you should take additional steps for production deployments:[5]
- Limit volume mounts — Only mount directories OpenClaw actually needs. Never expose your entire home directory.
- Run as non-root — Add
user: "1000:1000"to your Docker Compose file. - Restrict network access — Use Docker's network isolation to limit outbound connections.
- Rotate API keys regularly — Don't let API keys sit indefinitely.
- Keep images updated — Pull the latest image regularly for security patches.
- Never store secrets in the workspace — SSH keys, production credentials, and tokens should stay outside OpenClaw's reach.
Updating OpenClaw
Updating is straightforward with Docker:
# Pull latest image
docker compose pull
# Restart with new image
docker compose up -d
Your configuration and agent memory are preserved because they live in mounted volumes, not inside the container.
Cloud Deployment Options
Several cloud providers offer one-click OpenClaw deployments:
- DigitalOcean — 1-Click App with built-in security hardening (authenticated communication, hardened firewall, non-root execution)[6]
- Contabo — Free 1-click OpenClaw Add-On for VPS and VDS[2]
- Hostinger — Pre-configured Docker template for production-ready deployment
Troubleshooting
Container Won't Start
# Check logs
docker compose logs openclaw
# Verify Docker is running
docker info
Permission Denied Errors
Ensure the mounted directories have correct ownership:
sudo chown -R 1000:1000 ~/.openclaw ~/openclaw/workspace
Can't Connect to Ollama
When running Ollama on the host and OpenClaw in Docker, use the special Docker DNS name:
# Instead of localhost, use:
http://host.docker.internal:11434
What's Next?
Now that OpenClaw is running in Docker, explore these resources:
- Configuration Guide — Fine-tune your setup
- Security Guide — Comprehensive security overview
- Creating Custom Skills — Extend OpenClaw's capabilities
References
- OpenClaw GitHub Repository — Docker setup and README — Accessed February 2026
- Contabo — OpenClaw 1-Click Add-On — Deployment guide — Accessed February 2026
- OpenClaw Official Documentation — Configuration reference — Accessed February 2026
- OpenClaw Integrations Guide — Platform connections — Accessed February 2026
- DigitalOcean — Self-Hosting OpenClaw — Security best practices — Accessed February 2026
- DigitalOcean 1-Click OpenClaw — Cloud deployment — Accessed February 2026
Reference Trail
External sources surfaced from the underlying article content
- docs.docker.comdocs.docker.com
- OpenClaw GitHub Repositorygithub.com
- Contabo — OpenClaw 1-Click Add-Oncontabo.com
- OpenClaw Official Documentationdocs.openclaw.ai
- OpenClaw Integrations Guidedocs.openclaw.ai