How to Install OpenClaw on a Server with Docker
Running OpenClaw on a server gives you 24/7 availability without tying up your local machine. Docker makes this straightforward. Here's the complete guide.
What You Need
- A Linux server (Ubuntu 20.04+ recommended)
- Docker and Docker Compose installed
- A domain or subdomain pointing to your server (optional but recommended)
- At least 4 GB RAM on the server
Step 1 — Install Docker
SSH into your server and install Docker:
curl -fsSL https://get.docker.com | sh
sudo usermod -aG docker ubuntu
newgrp docker
Verify Docker is installed:
docker --version
docker compose version
Step 2 — Create the OpenClaw Directory
Create a directory to store OpenClaw data:
mkdir -p ~/openclaw
cd ~/openclaw
Step 3 — Create the Docker Compose File
Create a file named docker-compose.yml:
version: '3.8'
services:
openclaw:
image: ghcr.io/openclaw/openclaw:latest
container_name: openclaw
restart: unless-stopped
ports:
- "18789:18789" # Gateway
- "18792:18792" # Web UI
volumes:
- ./data:/app/data
- ./config:/app/config
environment:
- NODE_ENV=production
- GATEWAY_PORT=18789
- UI_PORT=18792
Step 4 — Start OpenClaw
docker compose up -d
Check if it's running:
docker compose logs -f
Step 5 — Access Remotely
To access the UI from outside the server, you need a reverse proxy. Install Nginx:
sudo apt install nginx -y
Create an Nginx config for OpenClaw:
sudo nano /etc/nginx/sites-available/openclaw
Paste this config (replace your-domain.com with your actual domain):
server {
listen 80;
location / { proxy_pass http://localhost:18792; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; } } ```
Enable the site:
sudo ln -s /etc/nginx/sites-available/openclaw /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl reload nginx
Step 6 — Secure with SSL (Let's Encrypt)
sudo apt install certbot python3-certbot-nginx -y
sudo certbot --nginx -d your-domain.com
Follow the prompts. Certbot will automatically configure HTTPS.
Step 7 — Update OpenClaw
To update to the latest version:
cd ~/openclaw
docker compose pull
docker compose up -d
Data Location
Your OpenClaw data is stored in the ./data directory on the host. Back it up regularly:
tar -czf openclaw-backup-$(date +%Y%m%d).tar.gz ~/openclaw/data
Troubleshooting
Container won't start
Check logs:
docker compose logs
Out of memory
Edit docker-compose.yml and add memory limit:
services:
openclaw:
mem_limit: 4g
Then restart:
docker compose up -d
What's Next?
Once OpenClaw is running on your server, connect channels like Telegram or Discord for 24/7 availability. Set up the Tailscale integration for secure remote access without exposing ports.
Full documentation at https://docs.openclaw.ai