Server Deployment: Running 7×24 with Docker/VPS
When to Use This
You have already gotten OpenClaw running on your local machine and now want to move it to a VPS running 7×24 around the clock: message channels are reachable at any time, and tasks keep executing in the background. Or your server has no Node environment installed and you need an isolated, disposable containerized Gateway.
First, be clear about the official positioning: Docker is an optional approach. If you just use it daily on your own computer, continuing with the regular installation process is simpler; Docker targets two kinds of needs: "hosts without a local installation" and "one-off isolated environments".
Preparation
Confirm four things before starting:
- Container environment: Docker Desktop or Docker Engine, plus Docker Compose v2.
- Memory: building the image locally from source requires at least 6 GB of RAM; switching to the pre-built image bypasses this threshold.
- Disk: leave enough space for the image and logs.
- Security baseline: for a VPS or public-facing host, be sure to read the official network security hardening documentation first; the key point is the Docker built-in
DOCKER-USERfirewall chain — regular iptables/ufw rules may not cover container traffic.
Prerequisite reading: Alternative Installation Methods: Desktop App, Docker, and npm.
Follow Along
Step 1: Get the Official Image
Run in the repository root:
./scripts/docker/setup.shThis builds openclaw:local locally. A more resource-efficient approach is to use the pre-built image directly:
export OPENCLAW_IMAGE="ghcr.io/openclaw/openclaw:latest"
./scripts/docker/setup.shGHCR is the official primary registry, handling release automation, pinned-version deployment, and provenance verification; the same release is also synced to the Docker Hub image openclaw/openclaw. Trust only these two sources and avoid third-party mirrors — their release cadence and retention policies differ from the official ones.
For production environments, pinning a version tag (e.g., 2026.9.3) is recommended instead of blindly chasing latest: stable release builds move latest and main, and only the maintenance release in the closing month moves extended-stable. Variants such as slim, main-slim, and latest-browser are also available.
Step 2: Start the Gateway Container
setup.sh automatically completes onboarding: it prompts for the model API key, generates a Gateway token written into .env, and finally starts the Gateway via Docker Compose.
The onboarding process is identical to a local installation: a single Gateway process is one trust boundary, where models and channels are configured.
Step 3: Public Network Hardening and Persistence
- Firewall: tighten ports according to the official network exposure rules and confirm that the
DOCKER-USERchain covers container traffic. - Auto-restart: configure a restart policy for the container so the Gateway recovers automatically after a VPS reboot.
- Multi-user isolation: when serving multiple mutually untrusted users, do not share a single Gateway — run an independent Gateway for each trust boundary, ideally under different OS users or on different hosts.
- Sandbox: the default Docker sandbox backend only uses the
dockerCLI; to switch to native Podman, set the backend to"podman"; the sandbox is off by default and does not require the Gateway itself to run in a container.
Checkpoints
- The Gateway container shows as running in
docker psand comes back automatically after a VPS reboot. - The image comes from
ghcr.io/openclaw/openclaworopenclaw/openclaw, with the version tag pinned. - The
DOCKER-USERchain rules are configured according to the public exposure documentation. - Mutually untrusted user groups each have their own independent Gateway, rather than one container serving everyone.
Boundaries
- Pull acceleration in mainland China: the officials provide no mirror acceleration documentation for ghcr.io / Docker Hub, and this page does not guess mirror addresses @@I18N_KEEP_000029@@; if pulling fails, first check the server's outbound network and DNS.
- Configuration unchanged: Docker only changes the runtime carrier; models, channels, and Skills are configured the same way as in a local deployment.
- Version pitfalls: the officials once recorded a version number error —
2026.9.1-beta.1published on npm actually corresponded to2026.8.1-beta.4; when pinning a pre-release tag, go by the release notes.
Next Steps
- Go to Advanced Handbook: Skills and Security Hardening, and read Security Hardening (Part 3): Prompt Injection Defense and Security Auditing first — the next line of defense after public exposure.
- When you need to compare installation paths, review Alternative Installation Methods: Desktop App, Docker, and npm.