#openclaw bot inside of docker

1 messages · Page 1 of 1 (latest)

last steppe
#

I want to sandbox my bot thats currently integrated with Discord and uses ollama model qwen3-coder:30b on my Windows PC. I have docker desktop, what needs to be done so this can be safe running exec and accessing files?

left flintBOT
#

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

last steppe
#

I want to containerize the bot, not the ollama model and keep that locally on my PC

cobalt oasisBOT
#

Yes — that’s a solid setup, and OpenClaw supports it well.

If you want bot containerized but Ollama local on Windows host, do this:

  1. Run OpenClaw in Docker
  1. Point OpenClaw to host Ollama
  1. Limit file blast radius
  • Mount only a dedicated workspace folder as writable
  • Mount any extra host folders as read-only unless absolutely needed
  • Avoid mounting your full user profile/drive
#
  1. Harden tool execution
  1. Lock down Discord ingress
  1. Run security audit after config

If you want, I can give you a copy-paste config next.

#

Reply with one number:

  1. Balanced (practical daily use)
  2. Strict (max lockdown, more friction)

Also paste openclaw --version first so I match current keys exactly.

last steppe
#

Step 1 I want to use the sandbox option, but still am unsure how to properly configure it

cobalt oasisBOT
#
agents: {
defaults: {
sandbox: {
mode: "all", // sandbox every session
backend: "docker",
scope: "session", // strongest isolation
workspaceAccess: "none",
workspaceRoot: "~/.openclaw/sandboxes",
docker: {
image: "openclaw-sandbox:bookworm-slim",
readOnlyRoot: true,
tmpfs: ["/tmp", "/var/tmp", "/run"],
network: "none",
user: "1000:1000",
capDrop: ["ALL"],
#
pidsLimit: 256,
memory: "1g",
cpus: 1
},
prune: {
idleHours: 24,
maxAgeDays: 7
}
}
}
},
tools: {
sandbox: {
tools: {
allow: ["group:runtime", "group:fs", "group:sessions"],
#

Use agents.defaults.sandbox.docker.binds with :ro wherever possible (never broad mounts like whole C:\Users).


4) Verify it’s actually active

Run:

  • openclaw sandbox explain
  • openclaw security audit --deep

If you paste those outputs, I’ll help tune Step 2 (Ollama host URL + safe file bind rules for Windows paths).