#openclaw in docker with volume
1 messages · Page 1 of 1 (latest)
yep, that’s doable, and the cleanest way is:
- run OpenClaw + Ollama in the same
docker composestack - keep the container disposable
- persist only the data dirs with bind mounts / named volumes
What I’d recommend:
-
Use the official Docker flow with the prebuilt image, so you don’t need Node/pnpm installed on the host
https://docs.openclaw.ai/install/docker -
Persist these paths:
/home/node/.openclaw→ config, auth, channel state/home/node/.openclaw/workspace→ projects / agent workspace
-
For shared skills, use one of these:
- mount a folder to
/home/node/.openclaw/skillsif you want shared skills for all agents
- mount a folder to
- or mount a separate folder and add it via
skills.load.extraDirsif you want to keep it separate
docs: https://docs.openclaw.ai/tools/skills
-
If Ollama is another container in the same compose network, point OpenClaw at:
http://ollama:11434- not
.../v1
docs: https://docs.openclaw.ai/providers/ollama
-
Important gotcha: if a skill needs extra binaries, bake them into the image. Don’t install them into a running container, they’ll disappear on restart.
docs: https://docs.openclaw.ai/install/docker-vm-runtime
So the pattern is basically:
configvolumeworkspacevolume- optional
shared-skillsvolume - Ollama reachable by compose service name
I would not share one giant /home/node volume across everything. Separate mounts are cleaner and much easier to debug.
If you want, I can paste a small docker-compose.yml example for:
openclawollama- shared workspace
- shared skills dir
yes please
yep, here’s a small pattern I’d use if you want OpenClaw + Ollama fully containerized and persistent data on shared folders.
services:
ollama:
image: ollama/ollama:latest
container_name: ollama
restart: unless-stopped
ports:
- "11434:11434"
volumes:
- ./data/ollama:/root/.ollama
openclaw-gateway:
image: ghcr.io/openclaw/openclaw:latest
container_name: openclaw-gateway
restart: unless-stopped
depends_on:
- ollama
environment:
HOME: /home/node
TERM: xterm-256color
TZ: UTC
OPENCLAW_GATEWAY_TOKEN: ${OPENCLAW_GATEWAY_TOKEN}
volumes:
- ./data/openclaw-config:/home/node/.openclaw
- ./data/openclaw-workspace:/home/node/.openclaw/workspace
- ./data/shared-skills:/opt/openclaw-shared-skills:ro
ports:
- "18789:18789"
- "18790:18790"
init: true
command:
[
"node",
"dist/index.js",
"gateway",
"--bind",
"lan",
"--port",
"18789"
]
openclaw-cli:
image: ghcr.io/openclaw/openclaw:latest
container_name: openclaw-cli
depends_on:
- openclaw-gateway
network_mode: "service:openclaw-gateway"
environment:
HOME: /home/node
TERM: xterm-256color
BROWSER: echo
TZ: UTC
OPENCLAW_GATEWAY_TOKEN: ${OPENCLAW_GATEWAY_TOKEN}
volumes:
- ./data/openclaw-config:/home/node/.openclaw
- ./data/openclaw-workspace:/home/node/.openclaw/workspace
- ./data/shared-skills:/opt/openclaw-shared-skills:ro
stdin_open: true
tty: true
init: true
entrypoint: ["node", "dist/index.js"]
.env
OPENCLAW_GATEWAY_TOKEN=put-a-long-random-token-here
Then in ./data/openclaw-config/openclaw.json:
{
skills: {
load: {
extraDirs: ["/opt/openclaw-shared-skills"],
},
},
}
A few important notes:
- Ollama URL inside OpenClaw should be
http://ollama:11434 - Do not use
/v1 ./data/openclaw-workspaceis your persisted project/workspace area./data/shared-skillsis a reusable shared skills folder- if you only want per-workspace skills, you can also just put them in
./data/openclaw-workspace/skills
For first setup, I’d do:
docker compose run --rm --no-deps --entrypoint node openclaw-gateway dist/index.js onboard --mode local --no-install-daemon
When onboarding asks for Ollama, give it:
http://ollama:11434
Then start the gateway:
docker compose up -d
Docs: