OpenClaw Docker & VPS Deployment: Run Your AI Agent in the Cloud
OpenClaw Docker & VPS Deployment: Run Your AI Agent in the Cloud
By Marcus Johnson | February 7, 2026
OpenClaw Docker & VPS Deployment: Run Your AI Agent in the Cloud
Running OpenClaw on your local machine is great for development, but cloud deployment offers 24/7 availability, better security isolation, and remote access from anywhere.
---
Why Deploy to the Cloud?
Benefits of Cloud Deployment
| Feature | Local | Cloud/VPS |
|---|---|---|
| Uptime | Depends on your computer | 24/7 |
| Internet access | Must be on same network | From anywhere |
| Security | Your machine at risk | Isolated container |
| Performance | Limited by hardware | Scalable resources |
When to Use Cloud Deployment
---
Docker Deployment
Prerequisites
Quick Start with Docker
# Clone the repository git clone https://github.com/openclaw/openclaw.git cd openclawRun Docker setup
./docker-setup.sh Docker Compose Configuration
Create docker-compose.yml:
version: '3.8'services: openclaw: image: openclaw/openclaw:latest container_name: openclaw restart: unless-stopped ports: - "18789:18789" # Gateway port volumes: - ./data:/home/openclaw/.openclaw - ./workspace:/home/openclaw/workspace environment: - TZ=America/New_York stdin_open: true tty: true
# Optional: Nginx reverse proxy nginx: image: nginx:alpine ports: - "80:80" - "443:443" volumes: - ./nginx.conf:/etc/nginx/nginx.conf depends_on: - openclaw
Run Docker
# Start OpenClaw docker-compose up -dView logs
docker-compose logs -f openclawStop OpenClaw
docker-compose down Accessing the Gateway
By default, Docker exposes the gateway to your local network:
# Find your container's IP docker inspect openclaw | grep IPAddressOr use localhost forwarding
docker port openclaw 18789 ---
VPS Deployment
Choosing a VPS Provider
| Provider | Starting Price | Recommended For |
|---|---|---|
| DigitalOcean | $4/mo | Easy setup, good docs |
| Linode | $5/mo | Reliable, straightforward |
| Hostinger | $4/mo | One-click Docker templates |
| Hetzner | €3/mo | Best value, EU-based |
Recommended VPS Specs
| Workload | CPU | RAM | Storage |
|---|---|---|---|
| Basic | 1 core | 1GB | 20GB SSD |
| Moderate | 2 cores | 2GB | 40GB SSD |
| Heavy use | 4 cores | 4GB | 60GB SSD |
Step-by-Step VPS Setup
#### 1. Connect to Your VPS
ssh root@your_vps_ip #### 2. Install Docker
# Update system apt-get update && apt-get upgrade -yInstall Docker
curl -fsSL https://get.docker.com | shInstall Docker Compose
curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose chmod +x /usr/local/bin/docker-compose #### 3. Deploy OpenClaw
# Create directory mkdir -p /opt/openclaw cd /opt/openclawClone and deploy
git clone https://github.com/openclaw/openclaw.git . ./docker-setup.sh #### 4. Configure Firewall
# Allow SSH ufw allow 22Allow HTTP/HTTPS (if using nginx)
ufw allow 80 ufw allow 443Enable firewall
ufw enable ---
Remote Access Security
The Problem
By default, Docker/VPS deployments expose your gateway to the public internet. This is dangerous.
Secure Solutions
#### Option 1: VPN Access (Recommended)
Use Tailscale or WireGuard to access your VPS privately:
# Install Tailscale on VPS curl -fsSL https://tailscale.com/install.sh | shConnect to your tailnet
tailscale up --auth-key YOUR_AUTH_KEY Access via your Tailscale IP: http://100.x.x.x:18789
#### Option 2: SSH Tunnel
Create an SSH tunnel from your local machine:
ssh -L 18789:localhost:18789 root@vps_ip Then access OpenClaw at http://localhost:18789
#### Option 3: Cloudflare Tunnel (Advanced)
# Install cloudflared curl -L https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64 -o /usr/local/bin/cloudflared chmod +x /usr/local/bin/cloudflaredCreate tunnel
cloudflared tunnel --url http://localhost:18789 ---
Production Checklist
Before going live, verify:
Auto-Start Docker
# Enable Docker auto-start systemctl enable docker systemctl enable openclaw Backups
Create a backup script:
#!/bin/bash backup-openclaw.sh
Stop container
docker-compose downBackup data directory
tar -czf /backups/openclaw-$(date +%Y%m%d).tar.gz /opt/openclaw/dataRestart container
docker-compose up -dKeep only last 7 backups
ls -t /backups/openclaw-*.tar.gz | tail -n +8 | xargs rm Add to cron:
# Daily backup at 3 AM 0 3 * /opt/openclaw/backup-openclaw.sh ---
Troubleshooting Cloud Deployment
Common Issues
| Issue | Solution |
|---|---|
| Container won't start | Check logs: docker-compose logs |
| Can't access gateway | Verify firewall: ufw status |
| Out of memory | Add swap space or upgrade VPS |
| Slow responses | Check CPU usage: htop |
Check Gateway Status
# SSH into VPS ssh root@vps_ipCheck container
docker ps | grep openclawView logs
docker logs openclaw --tail 100Check resource usage
docker stats ---
Further Reading
---
Related Articles:
Tags: OpenClaw, AI, Tutorial
Comments
Post a Comment