Installation Guide

OpenClaw on GCP

Deploy OpenClaw on GCP (Google Cloud Platform) and run your AI agent in the cloud. This guide shows how to set up a GCP VM and launch OpenClaw step-by-step.

12 min read
Mar 28, 2026
Ampere Team

Run OpenClaw on Google Cloud Platform (GCP) to keep your AI agent running 24/7 without relying on your local machine.

This setup is ideal if you want a reliable production deployment with low monthly cost and high uptime.

Minimum PC Requirements

ComponentMinimum RequirementRecommended
CPUDual-Core ProcessorQuad-Core (Intel i5 / Ryzen 5)
RAM4GB8GB+
Storage10GB Free20GB+
Internet10 Mbps25 Mbps+
Operating SystemWindows 10 / Linux / macOSWindows 11 / Linux
Terminal AccessCommand Prompt / PowerShell / TerminalWindows Terminal
BrowserChrome / Edge / FirefoxLatest version

Recommended GCP VM Specs

Machine TypeCPURAMRecommendation
e2-microShared1GBNot recommended
e2-small2 vCPU2GBMinimum
e2-medium2 vCPU4GBRecommended

How to Run OpenClaw on GCP?

Step 1: Install the gcloud CLI

Install the Google Cloud CLI on your local machine:

https://cloud.google.com/sdk/docs/install

Once installed, initialize and authenticate:

gcloud init gcloud auth login

Alternatively, every step in this guide can also be done through the Google Cloud Console at https://console.cloud.google.com/

Step 2: Create a GCP Project

Create a new project for your OpenClaw deployment:

gcloud projects create my-openclaw-project --name="OpenClaw Gateway" gcloud config set project my-openclaw-project

Enable billing for the project at https://console.cloud.google.com/billing (required for Compute Engine). Then enable the Compute Engine API:

gcloud services enable compute.googleapis.com

Step 3: Create the Compute Engine VM

Create a VM with Debian 12 and a 20GB boot disk:

gcloud compute instances create openclaw-gateway \ --zone=us-central1-a \ --machine-type=e2-small \ --boot-disk-size=20GB \ --image-family=debian-12 \ --image-project=debian-cloud
gcloud CLI — project setup, enable APIs, and create Compute Engine VM

Step 4: SSH Into the VM

gcloud compute ssh openclaw-gateway --zone=us-central1-a

If the connection is refused, wait 1–2 minutes after VM creation for SSH key propagation, then retry.

Step 5: Install Docker

Inside the VM, run:

sudo apt-get update sudo apt-get install -y git curl ca-certificates curl -fsSL https://get.docker.com | sudo sh sudo usermod -aG docker $USER

Log out for the group change to take effect:

exit

SSH back in:

gcloud compute ssh openclaw-gateway --zone=us-central1-a

Verify Docker is working:

docker --version docker compose version
Installing Docker on GCP VM and verifying the installation

Step 6: Clone the OpenClaw Repository

git clone https://github.com/openclaw/openclaw.git cd openclaw

Then create directories:

mkdir -p ~/.openclaw mkdir -p ~/.openclaw/workspace

This ensures your config and workspace survive container rebuilds and VM restarts.

Step 7: Configure Environment Variables

Create a .env file in the repository root:

OPENCLAW_IMAGE=openclaw:latest OPENCLAW_GATEWAY_TOKEN=change-me-now OPENCLAW_GATEWAY_BIND=lan OPENCLAW_GATEWAY_PORT=18789 OPENCLAW_CONFIG_DIR=/home/$USER/.openclaw OPENCLAW_WORKSPACE_DIR=/home/$USER/.openclaw/workspace GOG_KEYRING_PASSWORD=change-me-now XDG_CONFIG_HOME=/home/node/.openclaw

Generate strong secrets for OPENCLAW_GATEWAY_TOKEN and GOG_KEYRING_PASSWORD:

openssl rand -hex 32

Do not commit this file to version control.

Step 8: Configure Docker Compose

Create docker-compose.yml in the repository root:

services: openclaw-gateway: image: ${OPENCLAW_IMAGE} build: . restart: unless-stopped env_file: - .env environment: - HOME=/home/node - NODE_ENV=production - TERM=xterm-256color - OPENCLAW_GATEWAY_BIND=${OPENCLAW_GATEWAY_BIND} - OPENCLAW_GATEWAY_PORT=${OPENCLAW_GATEWAY_PORT} - OPENCLAW_GATEWAY_TOKEN=${OPENCLAW_GATEWAY_TOKEN} - GOG_KEYRING_PASSWORD=${GOG_KEYRING_PASSWORD} - XDG_CONFIG_HOME=${XDG_CONFIG_HOME} - PATH=/home/linuxbrew/.linuxbrew/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin volumes: - ${OPENCLAW_CONFIG_DIR}:/home/node/.openclaw - ${OPENCLAW_WORKSPACE_DIR}:/home/node/.openclaw/workspace ports: - "127.0.0.1:${OPENCLAW_GATEWAY_PORT}:18789" command: [ "node", "dist/index.js", "gateway", "--bind", "${OPENCLAW_GATEWAY_BIND}", "--port", "${OPENCLAW_GATEWAY_PORT}", "--allow-unconfigured", ]

The port binding 127.0.0.1:18789 keeps the gateway loopback-only on the VM. You access it securely through an SSH tunnel.

Step 9: Build and Launch OpenClaw

Build the Docker image and start the container:

docker compose build docker compose up -d

Check the container is running:

docker compose ps docker compose logs -f
Building and launching OpenClaw with Docker Compose on GCP

Step 10: Configure Allowed Origins

When binding to LAN, set the trusted browser origin:

docker compose run --rm openclaw-cli config set gateway.controlUi.allowedOrigins '["http://127.0.0.1:18789"]' --strict-json

Step 11: Access the Dashboard from Your Local Machine

From your local machine (not the VM), open an SSH tunnel:

gcloud compute ssh openclaw-gateway --zone=us-central1-a -- -L 18789:127.0.0.1:18789

Open in your browser:

http://127.0.0.1:18789

Get a tokenized dashboard link:

docker compose run --rm openclaw-cli dashboard --no-open

If the dashboard shows unauthorized or disconnected (1008): pairing required, approve your browser:

docker compose run --rm openclaw-cli devices list docker compose run --rm openclaw-cli devices approve <requestId>

After setup, connect a messaging channel — Telegram, WhatsApp, Discord, Slack, Microsoft Teams, or any other supported app — to start chatting with your agent.

Common Issues and Fix

IssueFix
SSH connection refusedWait 1–2 min after VM creation for SSH key propagation
Docker build fails (exit 137 / OOM)gcloud compute instances set-machine-type openclaw-gateway --zone=us-central1-a --machine-type=e2-small
docker: command not foundLog out and back in after sudo usermod -aG docker $USER
docker compose not foundsudo apt-get install -y docker-compose-plugin
Gateway container not startingdocker compose logs -f to check error output
Dashboard shows unauthorizeddocker compose run --rm openclaw-cli devices approve <requestId>
OS Login permission errorgcloud compute os-login describe-profile — check IAM permissions
Container stops after rebootConfirm restart: unless-stopped is set in docker-compose.yml

If you prefer to skip these setup steps entirely, you can deploy OpenClaw on Ampere.sh in 60 seconds. No Docker, no config files, no infrastructure management required.

Frequently Asked Questions

What is OpenClaw on GCP?
OpenClaw on GCP means running your OpenClaw AI agent on a Google Cloud virtual machine instead of your local computer. This allows your agent to run 24/7 with better reliability and performance.
Can I use GCP free tier for OpenClaw?
Yes, but it's not recommended. The free-tier e2-micro (1GB RAM) often fails during Docker builds or OpenClaw startup.
Do I need Docker to run OpenClaw on GCP?
Yes. OpenClaw is typically deployed using Docker to ensure stable and persistent setup.
Does OpenClaw continue running if I close my PC?
Yes. Once deployed, OpenClaw runs 24/7 on GCP even if your PC is turned off.
Can I upgrade my VM later?
Yes. You can easily upgrade RAM, CPU, and Storage without reinstalling OpenClaw.
What happens if my VM stops?
OpenClaw stops temporarily. Once you restart the VM, OpenClaw resumes automatically if Docker restart is enabled.
Do I need technical knowledge?
Basic knowledge helps, but most steps are copy-paste friendly.
Can I connect OpenClaw to Telegram or WhatsApp?
Yes. After deployment, you can connect Telegram, Discord, WhatsApp, Slack, and more.

Avoid Cloud Configuration

Setting up OpenClaw on GCP requires VM creation, Docker setup, and networking configuration. Run OpenClaw on Ampere.sh and start your AI agent in 60 seconds.

Deploy on Ampere.sh →