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 cài đặt Docker dựa trên máy ảo 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 container đang chạy là một cái bẫy. Bất cứ thứ gì đượ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 máy ảo dựa trên ARM, hãy chọn các asset arm64. Để build có thể tái lập, hãy ghim 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 lúc chạy pnpm install --frozen-lockfile, máy ảo đã hết bộ nhớ. Hãy dùng lớp máy lớn hơn trước khi thử lại. Xác minh các binary:
docker compose exec openclaw-gateway which gog
docker compose exec openclaw-gateway which goplaces
docker compose exec openclaw-gateway which wacli
Đầu ra mong đợi:
/usr/local/bin/gog
/usr/local/bin/goplaces
/usr/local/bin/wacli
Xác minh Gateway:
docker compose logs -f openclaw-gateway
Đầu ra mong đợi:
[gateway] listening on ws://0.0.0.0:18789

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

OpenClaw chạy trong Docker, nhưng Docker không phải nguồn chân lý. Mọi 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ền vữngGhi chú
Cấu hình Gateway/home/node/.openclaw/Mount volume hostBao gồm openclaw.json, .env
Hồ sơ xác thực model/home/node/.openclaw/agents/Mount volume hostagents/<agentId>/agent/auth-profiles.json (OAuth, khóa API)
Cấu hình Skills/home/node/.openclaw/skills/Mount volume hostTrạng thái cấp Skill
Workspace agent/home/node/.openclaw/workspace/Mount volume hostMã và artifact của agent
Phiên WhatsApp/home/node/.openclaw/Mount volume hostGiữ đăng nhập QR
Keyring Gmail/home/node/.openclaw/Volume host + mật khẩuYêu cầu GOG_KEYRING_PASSWORD
Gói Plugin/home/node/.openclaw/npm, /home/node/.openclaw/gitMount volume hostGốc gói Plugin có thể tải xuống
Binary bên ngoài/usr/local/bin/Image DockerPhải được đưa vào tại thời điểm build
Runtime NodeHệ thống tệp containerImage DockerĐược build lại mỗi lần build image
Gói OSHệ thống tệp containerImage DockerKhông cài đặt lúc runtime
Container DockerTạm thờiCó thể khởi động lạiCó thể hủy an toàn

Cập nhật

Để cập nhật OpenClaw trên máy ảo:
git pull
docker compose build
docker compose up -d

Liên quan