{
  "title": "OpenClaw on GCP Compute Engine (Docker, Production VPS Guide)",
  "content": "Run a persistent OpenClaw Gateway on a GCP Compute Engine VM using Docker, with durable state, baked-in binaries, and safe restart behavior.\n\nIf you want \"OpenClaw 24/7 for \\~\\$5-12/mo\", this is a reliable setup on Google Cloud.\nPricing varies by machine type and region; pick the smallest VM that fits your workload and scale up if you hit OOMs.\n\n## What are we doing (simple terms)?\n\n* Create a GCP project and enable billing\n* Create a Compute Engine VM\n* Install Docker (isolated app runtime)\n* Start the OpenClaw Gateway in Docker\n* Persist `~/.openclaw` + `~/.openclaw/workspace` on the host (survives restarts/rebuilds)\n* Access the Control UI from your laptop via an SSH tunnel\n\nThe Gateway can be accessed via:\n\n* SSH port forwarding from your laptop\n* Direct port exposure if you manage firewalling and tokens yourself\n\nThis guide uses Debian on GCP Compute Engine.\nUbuntu also works; map packages accordingly.\nFor the generic Docker flow, see [Docker](/install/docker).\n\n## Quick path (experienced operators)\n\n1. Create GCP project + enable Compute Engine API\n2. Create Compute Engine VM (e2-small, Debian 12, 20GB)\n3. SSH into the VM\n4. Install Docker\n5. Clone OpenClaw repository\n6. Create persistent host directories\n7. Configure `.env` and `docker-compose.yml`\n8. Bake required binaries, build, and launch\n\n* GCP account (free tier eligible for e2-micro)\n* gcloud CLI installed (or use Cloud Console)\n* SSH access from your laptop\n* Basic comfort with SSH + copy/paste\n* \\~20-30 minutes\n* Docker and Docker Compose\n* Model auth credentials\n* Optional provider credentials\n  * WhatsApp QR\n  * Telegram bot token\n  * Gmail OAuth\n\n## 1) Install gcloud CLI (or use Console)\n\n**Option A: gcloud CLI** (recommended for automation)\n\nInstall from [https://cloud.google.com/sdk/docs/install](https://cloud.google.com/sdk/docs/install)\n\nInitialize and authenticate:\n\n**Option B: Cloud Console**\n\nAll steps can be done via the web UI at [https://console.cloud.google.com](https://console.cloud.google.com)\n\n## 2) Create a GCP project\n\nEnable billing at [https://console.cloud.google.com/billing](https://console.cloud.google.com/billing) (required for Compute Engine).\n\nEnable the Compute Engine API:\n\n1. Go to IAM & Admin > Create Project\n2. Name it and create\n3. Enable billing for the project\n4. Navigate to APIs & Services > Enable APIs > search \"Compute Engine API\" > Enable\n\n| Type     | Specs                    | Cost               | Notes              |\n| -------- | ------------------------ | ------------------ | ------------------ |\n| e2-small | 2 vCPU, 2GB RAM          | \\~\\$12/mo          | Recommended        |\n| e2-micro | 2 vCPU (shared), 1GB RAM | Free tier eligible | May OOM under load |\n\n1. Go to Compute Engine > VM instances > Create instance\n2. Name: `openclaw-gateway`\n3. Region: `us-central1`, Zone: `us-central1-a`\n4. Machine type: `e2-small`\n5. Boot disk: Debian 12, 20GB\n6. Create\n\n## 4) SSH into the VM\n\nClick the \"SSH\" button next to your VM in the Compute Engine dashboard.\n\nNote: SSH key propagation can take 1-2 minutes after VM creation. If connection is refused, wait and retry.\n\n## 5) Install Docker (on the VM)\n\nLog out and back in for the group change to take effect:\n\n## 6) Clone the OpenClaw repository\n\nThis guide assumes you will build a custom image to guarantee binary persistence.\n\n## 7) Create persistent host directories\n\nDocker containers are ephemeral.\nAll long-lived state must live on the host.\n\n## 8) Configure environment variables\n\nCreate `.env` in the repository root.\n\nGenerate strong secrets:\n\n**Do not commit this file.**\n\n## 9) Docker Compose configuration\n\nCreate or update `docker-compose.yml`.\n\n## 10) Bake required binaries into the image (critical)\n\nInstalling binaries inside a running container is a trap.\nAnything installed at runtime will be lost on restart.\n\nAll external binaries required by skills must be installed at image build time.\n\nThe examples below show three common binaries only:\n\n* `gog` for Gmail access\n* `goplaces` for Google Places\n* `wacli` for WhatsApp\n\nThese are examples, not a complete list.\nYou may install as many binaries as needed using the same pattern.\n\nIf you add new skills later that depend on additional binaries, you must:\n\n1. Update the Dockerfile\n2. Rebuild the image\n3. Restart the containers\n\n**Example Dockerfile**\n\n```dockerfile theme={null}\nFROM node:22-bookworm\n\nRUN apt-get update && apt-get install -y socat && rm -rf /var/lib/apt/lists/*",
  "code_samples": [
    {
      "code": "**Option B: Cloud Console**\n\nAll steps can be done via the web UI at [https://console.cloud.google.com](https://console.cloud.google.com)\n\n***\n\n## 2) Create a GCP project\n\n**CLI:**",
      "language": "unknown"
    },
    {
      "code": "Enable billing at [https://console.cloud.google.com/billing](https://console.cloud.google.com/billing) (required for Compute Engine).\n\nEnable the Compute Engine API:",
      "language": "unknown"
    },
    {
      "code": "**Console:**\n\n1. Go to IAM & Admin > Create Project\n2. Name it and create\n3. Enable billing for the project\n4. Navigate to APIs & Services > Enable APIs > search \"Compute Engine API\" > Enable\n\n***\n\n## 3) Create the VM\n\n**Machine types:**\n\n| Type     | Specs                    | Cost               | Notes              |\n| -------- | ------------------------ | ------------------ | ------------------ |\n| e2-small | 2 vCPU, 2GB RAM          | \\~\\$12/mo          | Recommended        |\n| e2-micro | 2 vCPU (shared), 1GB RAM | Free tier eligible | May OOM under load |\n\n**CLI:**",
      "language": "unknown"
    },
    {
      "code": "**Console:**\n\n1. Go to Compute Engine > VM instances > Create instance\n2. Name: `openclaw-gateway`\n3. Region: `us-central1`, Zone: `us-central1-a`\n4. Machine type: `e2-small`\n5. Boot disk: Debian 12, 20GB\n6. Create\n\n***\n\n## 4) SSH into the VM\n\n**CLI:**",
      "language": "unknown"
    },
    {
      "code": "**Console:**\n\nClick the \"SSH\" button next to your VM in the Compute Engine dashboard.\n\nNote: SSH key propagation can take 1-2 minutes after VM creation. If connection is refused, wait and retry.\n\n***\n\n## 5) Install Docker (on the VM)",
      "language": "unknown"
    },
    {
      "code": "Log out and back in for the group change to take effect:",
      "language": "unknown"
    },
    {
      "code": "Then SSH back in:",
      "language": "unknown"
    },
    {
      "code": "Verify:",
      "language": "unknown"
    },
    {
      "code": "***\n\n## 6) Clone the OpenClaw repository",
      "language": "unknown"
    },
    {
      "code": "This guide assumes you will build a custom image to guarantee binary persistence.\n\n***\n\n## 7) Create persistent host directories\n\nDocker containers are ephemeral.\nAll long-lived state must live on the host.",
      "language": "unknown"
    },
    {
      "code": "***\n\n## 8) Configure environment variables\n\nCreate `.env` in the repository root.",
      "language": "unknown"
    },
    {
      "code": "Generate strong secrets:",
      "language": "unknown"
    },
    {
      "code": "**Do not commit this file.**\n\n***\n\n## 9) Docker Compose configuration\n\nCreate or update `docker-compose.yml`.",
      "language": "unknown"
    },
    {
      "code": "***\n\n## 10) Bake required binaries into the image (critical)\n\nInstalling binaries inside a running container is a trap.\nAnything installed at runtime will be lost on restart.\n\nAll external binaries required by skills must be installed at image build time.\n\nThe examples below show three common binaries only:\n\n* `gog` for Gmail access\n* `goplaces` for Google Places\n* `wacli` for WhatsApp\n\nThese are examples, not a complete list.\nYou may install as many binaries as needed using the same pattern.\n\nIf you add new skills later that depend on additional binaries, you must:\n\n1. Update the Dockerfile\n2. Rebuild the image\n3. Restart the containers\n\n**Example Dockerfile**",
      "language": "unknown"
    }
  ],
  "headings": [
    {
      "level": "h2",
      "text": "Goal",
      "id": "goal"
    },
    {
      "level": "h2",
      "text": "What are we doing (simple terms)?",
      "id": "what-are-we-doing-(simple-terms)?"
    },
    {
      "level": "h2",
      "text": "Quick path (experienced operators)",
      "id": "quick-path-(experienced-operators)"
    },
    {
      "level": "h2",
      "text": "What you need",
      "id": "what-you-need"
    },
    {
      "level": "h2",
      "text": "1) Install gcloud CLI (or use Console)",
      "id": "1)-install-gcloud-cli-(or-use-console)"
    },
    {
      "level": "h2",
      "text": "2) Create a GCP project",
      "id": "2)-create-a-gcp-project"
    },
    {
      "level": "h2",
      "text": "3) Create the VM",
      "id": "3)-create-the-vm"
    },
    {
      "level": "h2",
      "text": "4) SSH into the VM",
      "id": "4)-ssh-into-the-vm"
    },
    {
      "level": "h2",
      "text": "5) Install Docker (on the VM)",
      "id": "5)-install-docker-(on-the-vm)"
    },
    {
      "level": "h2",
      "text": "6) Clone the OpenClaw repository",
      "id": "6)-clone-the-openclaw-repository"
    },
    {
      "level": "h2",
      "text": "7) Create persistent host directories",
      "id": "7)-create-persistent-host-directories"
    },
    {
      "level": "h2",
      "text": "8) Configure environment variables",
      "id": "8)-configure-environment-variables"
    },
    {
      "level": "h2",
      "text": "9) Docker Compose configuration",
      "id": "9)-docker-compose-configuration"
    },
    {
      "level": "h2",
      "text": "10) Bake required binaries into the image (critical)",
      "id": "10)-bake-required-binaries-into-the-image-(critical)"
    }
  ],
  "url": "llms-txt#openclaw-on-gcp-compute-engine-(docker,-production-vps-guide)",
  "links": []
}