Guide

Self-Hosting OpenClaw with Docker: The Complete Guide

February 15, 202612 min readReviewed March 8, 2026

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:

  1. Build the OpenClaw Docker image
  2. Launch the interactive onboarding wizard
  3. Create required host directories
  4. Start the OpenClaw gateway via Docker Compose
Note: The setup creates ~/.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]

  1. Limit volume mounts — Only mount directories OpenClaw actually needs. Never expose your entire home directory.
  2. Run as non-root — Add user: "1000:1000" to your Docker Compose file.
  3. Restrict network access — Use Docker's network isolation to limit outbound connections.
  4. Rotate API keys regularly — Don't let API keys sit indefinitely.
  5. Keep images updated — Pull the latest image regularly for security patches.
  6. Never store secrets in the workspace — SSH keys, production credentials, and tokens should stay outside OpenClaw's reach.
⚠️ Security Warning: OpenClaw can execute shell commands and access files within its mounted volumes. If your instance is compromised, an attacker gains these same capabilities. Always sandbox appropriately.[5]

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
Tip: It's recommended to deploy OpenClaw on a dedicated server or VPS rather than your personal computer, because you're granting an AI agent high-level system access.[6]

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:


References

  1. OpenClaw GitHub Repository — Docker setup and README — Accessed February 2026
  2. Contabo — OpenClaw 1-Click Add-On — Deployment guide — Accessed February 2026
  3. OpenClaw Official Documentation — Configuration reference — Accessed February 2026
  4. OpenClaw Integrations Guide — Platform connections — Accessed February 2026
  5. DigitalOcean — Self-Hosting OpenClaw — Security best practices — Accessed February 2026
  6. DigitalOcean 1-Click OpenClaw — Cloud deployment — Accessed February 2026

Ready to deploy?

Get OpenClaw running in Docker in under 5 minutes.

View on GitHub

Reference Trail

External sources surfaced from the underlying article content

  1. docs.docker.comdocs.docker.com
  2. OpenClaw GitHub Repositorygithub.com
  3. Contabo — OpenClaw 1-Click Add-Oncontabo.com
  4. OpenClaw Official Documentationdocs.openclaw.ai
  5. OpenClaw Integrations Guidedocs.openclaw.ai
Back to ArchiveMore: GuidesNext: OpenClaw vs Cursor vs Windsurf: Which AI Coding Tool Is Right for You?