Chuyển đến nội dung chính

Documentation Index

Fetch the complete documentation index at: https://docs.openclaw.ai/llms.txt

Use this file to discover all available pages before exploring further.

Các bước runtime dùng chung cho các bản cài đặt Docker dựa trên VM như GCP, Hetzner và các nhà cung cấp VPS tương tự.

Đưa các binary bắt buộc vào image

Cài đặt binary bên trong một container đang chạy là một cái bẫy. Mọi thứ được cài đặt lúc runtime sẽ bị mất khi khởi động lại. Tất cả binary bên ngoài mà Skills yêu cầu phải được cài đặt tại thời điểm build image. Các ví dụ bên dưới chỉ minh họa ba binary phổ biến:
  • gog (từ gogcli) để truy cập Gmail
  • goplaces cho Google Places
  • wacli cho WhatsApp
Đây là ví dụ, không phải danh sách đầy đủ. Bạn có thể cài đặt bao nhiêu binary tùy cần bằng cùng một mẫu. Nếu sau này bạn thêm Skills mới phụ thuộc vào các binary bổ sung, bạn phải:
  1. Cập nhật Dockerfile
  2. Build lại image
  3. Khởi động lại các container
Dockerfile ví dụ
FROM node:24-bookworm

RUN apt-get update && apt-get install -y socat && rm -rf /var/lib/apt/lists/*

# Example binary 1: Gmail CLI (gogcli — installs as `gog`)
# Copy the current Linux asset URL from https://github.com/steipete/gogcli/releases
RUN curl -L https://github.com/steipete/gogcli/releases/latest/download/gogcli_linux_amd64.tar.gz \
  | tar -xzO gog > /usr/local/bin/gog; \
  chmod +x /usr/local/bin/gog

# Example binary 2: Google Places CLI
# Copy the current Linux asset URL from https://github.com/steipete/goplaces/releases
RUN curl -L https://github.com/steipete/goplaces/releases/latest/download/goplaces_linux_amd64.tar.gz \
  | tar -xzO goplaces > /usr/local/bin/goplaces; \
  chmod +x /usr/local/bin/goplaces

# Example binary 3: WhatsApp CLI
# Copy the current Linux asset URL from https://github.com/steipete/wacli/releases
RUN curl -L https://github.com/steipete/wacli/releases/latest/download/wacli-linux-amd64.tar.gz \
  | tar -xzO wacli > /usr/local/bin/wacli; \
  chmod +x /usr/local/bin/wacli

# Add more binaries below using the same pattern

WORKDIR /app
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml .npmrc ./
COPY ui/package.json ./ui/package.json
COPY scripts ./scripts

RUN corepack enable
RUN pnpm install --frozen-lockfile

COPY . .
RUN pnpm build
RUN pnpm ui:install
RUN pnpm ui:build

ENV NODE_ENV=production

CMD ["node","dist/index.js"]
Các URL ở trên là ví dụ. Với VM dựa trên ARM, hãy chọn các asset arm64. Để build có thể tái lập, hãy ghim các URL bản phát hành có phiên bản.

Build và khởi chạy

docker compose build
docker compose up -d openclaw-gateway
Nếu build thất bại với Killed hoặc exit code 137 trong khi chạy pnpm install --frozen-lockfile, VM đã hết bộ nhớ. Hãy dùng một lớp máy lớn hơn trước khi thử lại. Xác minh binary:
docker compose exec openclaw-gateway which gog
docker compose exec openclaw-gateway which goplaces
docker compose exec openclaw-gateway which wacli
Kết quả mong đợi:
/usr/local/bin/gog
/usr/local/bin/goplaces
/usr/local/bin/wacli
Xác minh Gateway:
docker compose logs -f openclaw-gateway
Kết quả mong đợi:
[gateway] listening on ws://0.0.0.0:18789

Nội dung nào được lưu bền ở đâu

OpenClaw chạy trong Docker, nhưng Docker không phải nguồn sự thật. Tất cả trạng thái tồn tại lâu dài phải sống sót qua các lần khởi động lại, build lại và reboot.
Thành phầnVị tríCơ chế lưu bềnGhi chú
Cấu hình Gateway/home/node/.openclaw/Gắn volume từ hostBao gồm openclaw.json, .env
Hồ sơ xác thực model/home/node/.openclaw/agents/Gắn volume từ hostagents/<agentId>/agent/auth-profiles.json (OAuth, API keys)
Cấu hình Skill/home/node/.openclaw/skills/Gắn volume từ hostTrạng thái cấp Skill
Workspace của agent/home/node/.openclaw/workspace/Gắn volume từ hostMã nguồn và artifact của agent
Phiên WhatsApp/home/node/.openclaw/Gắn volume từ hostGiữ lại đăng nhập QR
Keyring Gmail/home/node/.openclaw/Volume từ host + mật khẩuYêu cầu GOG_KEYRING_PASSWORD
Dependency runtime của Plugin/var/lib/openclaw/plugin-runtime-deps/Volume có tên của DockerDependency Plugin tích hợp được tạo và mirror runtime
Binary bên ngoài/usr/local/bin/Docker imagePhải được đưa vào tại thời điểm build
Runtime NodeHệ thống tệp containerDocker imageĐược build lại sau mỗi lần build image
Gói hệ điều hànhHệ thống tệp containerDocker imageKhông cài đặt lúc runtime
Docker containerTạm thờiCó thể khởi động lạiAn toàn để hủy

Cập nhật

Để cập nhật OpenClaw trên VM:
git pull
docker compose build
docker compose up -d

Liên quan