Docker Setup
This guide covers running OpenClaw in Docker containers using the official Dockerfile and docker-compose configurations.Overview
Docker deployment benefits:- Isolated runtime environment
- Reproducible builds
- Easy version management
- Simplified updates
- Cross-platform consistency
Prerequisites
- Docker Engine 20.10+
- Docker Compose 2.0+ (optional, for multi-container setup)
- 2GB available disk space
- Basic Docker knowledge
Quick Start
Build from Source
Using Docker Compose
The repository includes a production-readydocker-compose.yml:
Dockerfile Reference
The officialDockerfile includes:
Build Arguments
Build with browser pre-installed:
Docker Compose Configuration
Fromdocker-compose.yml in the repository:
Service Breakdown
openclaw-gateway — Main gateway service:
- Exposes ports 18789 (gateway) and 18790 (bridge)
- Mounts config and workspace directories
- Auto-restarts on failure
- Uses
--bind lanfor container networking
openclaw-cli — Interactive CLI service:
- Shares same volumes as gateway
- For running interactive commands
- Requires TTY allocation
Volume Mounting
Critical Directories
Volume Examples
Bind mounts (development):Environment Variables
Required Variables
Optional Variables
Networking
Port Exposure
Gateway Bind Modes
For containerized deployments:Default Dockerfile CMD binds to loopback for security. Override with
--bind lan for container networking.Running on Different Platforms
Synology NAS
OpenClaw works on Synology Docker:-
Build with ARM support if needed:
-
Use Synology Docker UI:
- Import image or build from Git
- Create container with environment variables
- Map volumes to NAS storage
- Enable auto-restart
-
Environment variable notes:
- Force pnpm:
OPENCLAW_PREFER_PNPM=1 - Disable browser: Don’t set
OPENCLAW_INSTALL_BROWSER
- Force pnpm:
Raspberry Pi
For ARM devices:Kubernetes
Example deployment:Troubleshooting
Container Won’t Start
Permission Issues
The container runs asnode user (UID 1000):
Network Issues
Browser Automation Fails
Rebuild with Chromium pre-installed:Production Best Practices
1
Use named volumes
Avoid bind mounts in production for better portability
2
Set resource limits
3
Enable auto-restart
4
Use secrets for credentials
5
Monitor logs
Updating
Rebuild and Restart
With Docker Compose
Next Steps
Security Guide
Secure your Docker deployment
Deployment Options
Deploy to cloud platforms
Troubleshooting
Common Docker issues
Multi-Agent Setup
Run multiple isolated agents

