Files
Docker_Compose/4600Pro/OpenClaw/docker-compose.yml
T
2026-08-18 14:07:11 +08:00

113 lines
2.6 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
services:
openclaw-gateway:
image: ${OPENCLAW_IMAGE:-ghcr.io/openclaw/openclaw:latest}
container_name: openclaw-gateway
# 你的 /volume2 无法正常 chown 给 UID 1000,
# 因此当前环境用 root 运行,解决持久化目录写权限问题
user: "0:0"
env_file:
- .env
environment:
TZ: ${OPENCLAW_TZ:-Asia/Shanghai}
HOME: /root
OPENCLAW_HOME: /root
TERM: xterm-256color
OPENCLAW_STATE_DIR: /root/.openclaw
OPENCLAW_CONFIG_PATH: /root/.openclaw/openclaw.json
OPENCLAW_CONFIG_DIR: /root/.openclaw
OPENCLAW_WORKSPACE_DIR: /root/.openclaw/workspace
# OpenClaw 内部始终认 18789
OPENCLAW_GATEWAY_PORT: "18789"
OPENCLAW_GATEWAY_BIND: ${OPENCLAW_GATEWAY_BIND:-lan}
OPENCLAW_GATEWAY_TOKEN: ${OPENCLAW_GATEWAY_TOKEN}
volumes:
# 所有长期数据统一持久化
- /volume2/docker/docker_projects/openclaw/data:/root/.openclaw
ports:
# 宿主机 Web UI 2800 -> 容器 Gateway 18789
- "2800:18789"
# 如果你希望 Bridge 外部仍用 2799
- "2799:18790"
extra_hosts:
- "host.docker.internal:host-gateway"
init: true
restart: unless-stopped
command:
[
"node",
"dist/index.js",
"gateway",
"--bind",
"lan",
"--port",
"18789"
]
healthcheck:
test:
[
"CMD",
"node",
"-e",
"fetch('http://127.0.0.1:18789/healthz').then(r=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))"
]
interval: 30s
timeout: 5s
retries: 5
start_period: 20s
openclaw-cli:
image: ${OPENCLAW_IMAGE:-ghcr.io/openclaw/openclaw:latest}
container_name: openclaw-cli
user: "0:0"
env_file:
- .env
# 官方 Compose 就是让 CLI 与 Gateway 共用 network namespace
network_mode: "service:openclaw-gateway"
environment:
TZ: ${OPENCLAW_TZ:-Asia/Shanghai}
HOME: /root
OPENCLAW_HOME: /root
TERM: xterm-256color
BROWSER: echo
OPENCLAW_STATE_DIR: /root/.openclaw
OPENCLAW_CONFIG_PATH: /root/.openclaw/openclaw.json
OPENCLAW_CONFIG_DIR: /root/.openclaw
OPENCLAW_WORKSPACE_DIR: /root/.openclaw/workspace
OPENCLAW_GATEWAY_PORT: "18789"
OPENCLAW_GATEWAY_BIND: ${OPENCLAW_GATEWAY_BIND:-lan}
OPENCLAW_GATEWAY_TOKEN: ${OPENCLAW_GATEWAY_TOKEN}
volumes:
- /volume2/docker/docker_projects/openclaw/data:/root/.openclaw
stdin_open: true
tty: true
init: true
entrypoint:
- node
- dist/index.js
depends_on:
- openclaw-gateway