#openclaw in docker with volume

1 messages · Page 1 of 1 (latest)

smoky crypt
#

hi all!
i want to run openclaw in docker container (i have another ollama container as well) and to have a shared volume for the opencalw projects and skills - what is the best way to do it so i wont install anything and it will all run in containers?

fallow coralBOT
shell havenBOT
#

To help others find answers, you can mark your question as solved via Right click solution message -> Apps -> ✅ Mark Solution

queen kilnBOT
#

yep, that’s doable, and the cleanest way is:

  • run OpenClaw + Ollama in the same docker compose stack
  • keep the container disposable
  • persist only the data dirs with bind mounts / named volumes

What I’d recommend:

  1. 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

  2. Persist these paths:

    • /home/node/.openclaw → config, auth, channel state
    • /home/node/.openclaw/workspace → projects / agent workspace
  3. For shared skills, use one of these:

    • mount a folder to /home/node/.openclaw/skills if you want shared skills for all agents
#
  1. If Ollama is another container in the same compose network, point OpenClaw at:

  2. 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:

  • config volume
  • workspace volume
  • optional shared-skills volume
  • 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:

  • openclaw
  • ollama
  • shared workspace
  • shared skills dir
queen kilnBOT
#

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-workspace is your persisted project/workspace area
  • ./data/shared-skills is 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: