Complete step-by-step tutorial for deploying OpenClaw using Docker containers and production setup
Reference Documentation: For comprehensive Docker configuration, advanced settings, troubleshooting, and all deployment options, see the Docker Deployment Reference Guide. This tutorial provides a hands-on, step-by-step workflow to get you deployed quickly. The reference guide contains all the detailed configuration options.
OpenClaw can be deployed in several ways:
This tutorial focuses on Docker deployment, which is the most common production deployment method. For other options, see the links above.
Before starting, ensure you have:
First, install Docker on your server. The method depends on your operating system:
# Update package index
sudo apt-get update
# Install Docker
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
# Add your user to docker group
sudo usermod -aG docker $USER
# Install Docker Compose
sudo apt-get install docker-compose-plugin
# Verify installation
docker --version
docker compose version
# Download and install Docker Desktop for Mac
# Visit: https://www.docker.com/products/docker-desktop
# Or use Homebrew
brew install --cask docker
# Start Docker Desktop
open -a Docker
# Test Docker installation
docker run hello-world
# Check Docker Compose
docker compose version
Create a docker-compose.yml file in your project directory:
version: '3.8'
services:
openclaw:
image: openclaw/openclaw:latest
container_name: openclaw
restart: unless-stopped
ports:
- "18789:18789" # Gateway WebSocket
- "18793:18793" # Canvas host
volumes:
- ~/.clawdbot:/root/.clawdbot # Configuration
- ~/clawd:/root/clawd # Workspace
environment:
- NODE_ENV=production
command: openclaw gateway
Key Configuration Points:
For advanced configuration options (network settings, resource limits, environment variables, sandboxing), see the Docker Deployment Reference Guide.
Ensure the volume paths exist on your host system:
# Create configuration directory
mkdir -p ~/.clawdbot
# Create workspace directory
mkdir -p ~/clawd
# Set proper permissions
chmod 755 ~/.clawdbot
chmod 755 ~/clawd
Important: If you already have OpenClaw configured locally, these directories should already exist with your configuration and workspace data.
Start OpenClaw using Docker Compose:
# Start in detached mode
docker compose up -d
# View logs
docker compose logs -f
# Check container status
docker compose ps
Expected Output: You should see the Gateway starting and listening on port 18789.
Verify that OpenClaw is running correctly:
# Check if container is running
docker ps | grep openclaw
# Check container logs
docker compose logs openclaw
# Execute commands inside container
docker compose exec openclaw openclaw status
Open your browser and navigate to:
http://localhost:18789
If you're deploying on a remote server, replace localhost with your server's IP address or domain name.
For production deployments, you'll want to add resource limits and security configurations. Here's a production-ready example:
version: '3.8'
services:
openclaw:
image: openclaw/openclaw:latest
container_name: openclaw
restart: unless-stopped
ports:
- "18789:18789"
- "18793:18793"
volumes:
- ~/.clawdbot:/root/.clawdbot
- ~/clawd:/root/clawd
environment:
- NODE_ENV=production
deploy:
resources:
limits:
cpus: '2'
memory: 2G
reservations:
cpus: '1'
memory: 1G
command: openclaw gateway
Production Checklist:
Additional Production Considerations:
~/.clawdbot and ~/clawd directoriesFor comprehensive production configuration, advanced network settings, sandboxing options, and detailed security practices, see the Docker Deployment Reference Guide and our Security Guide.
Here are the essential commands for managing your OpenClaw container:
# Start container
docker compose up -d
# Stop container
docker compose stop
# Restart container
docker compose restart
# View logs
docker compose logs -f
# Update to latest version
docker compose pull
docker compose up -d
For complete container management commands, including executing commands inside the container, troubleshooting, and advanced operations, see the Docker Deployment Reference Guide.
If you encounter issues, here are quick fixes for common problems:
docker compose logs openclawnetstat -tuln | grep 18789ls -la ~/.clawdbotdocker psdocker ps | grep openclawdocker compose pscurl http://localhost:18789For comprehensive troubleshooting, including permission issues, port conflicts, data persistence problems, and Docker-specific solutions, see the Docker Deployment Reference Guide and our Troubleshooting Guide.
Now that you've deployed OpenClaw with Docker:
This tutorial covered the essential workflow to get you deployed. For comprehensive Docker configuration details, advanced settings, network configuration, environment variables, sandboxing, resource limits, and complete troubleshooting, see the Docker Deployment Reference Guide.