Configure OpenClaw Docker Sandboxing and Memory
Running agents locally can be a bit of a headache. You want them to have enough power to get things done, but you don’t want them poking around where they shouldn’t. Managing security and persistence shouldn’t feel like a chore. There is nothing more annoying than an agent that loses its train of thought halfway through a task.
Is there a dedicated sandboxing doc?
Section titled “Is there a dedicated sandboxing doc?”You bet. If you want the deep dive, check out the Sandboxing guide. For those of you specifically looking to get things running with Docker, head over to the Docker setup page. Both links will help you get started.
Docker feels limited—How do I enable full features?
Section titled “Docker feels limited—How do I enable full features?”The default image is built with a security-first mindset. It runs as the node user and skips things like system packages and Homebrew, or pre-installed browsers. If you need more power, you can customize it. Here are a few ways to do that:
- Persist
/home/nodewithOPENCLAW_HOME_VOLUMEso caches survive - Bake system deps into the image with
OPENCLAW_DOCKER_APT_PACKAGES - Install Playwright browsers via:
node /app/node_modules/playwright-core/cli.js install chromium - Set
PLAYWRIGHT_BROWSERS_PATHand ensure the path is persisted
Can I keep DMs personal but make groups public/sandboxed with one agent?
Section titled “Can I keep DMs personal but make groups public/sandboxed with one agent?”You can. This is a great setup if your private chats happen in DMs but you want your groups to be sandboxed. Just set agents.defaults.sandbox.mode: "non-main". This keeps your main DM session on the host while pushing group and channel sessions into Docker.
How do I bind a host folder into the sandbox?
Section titled “How do I bind a host folder into the sandbox?”You can map host folders by setting agents.defaults.sandbox.docker.binds to ["host:path:mode"]. Here is how that looks in your config:
{ agents: { defaults: { sandbox: { docker: { binds: ["/home/user/src:/src:ro"] } } } }}I recommend using :ro (read-only) for sensitive data. Keep in mind that binds go right through the sandbox walls.
How does memory work?
Section titled “How does memory work?”Memory in OpenClaw is straightforward—it is just Markdown files stored in the agent workspace:
- Daily notes in
memory/YYYY-MM-DD.md - Curated long-term notes in
MEMORY.md(main/private sessions only)
OpenClaw also runs a silent pre-compaction memory flush. This reminds the model to write durable notes before auto-compaction.
Memory keeps forgetting things. How do I make it stick?
Section titled “Memory keeps forgetting things. How do I make it stick?”If the bot is being forgetful, just **ask it to write the fact
OpenClaw Expert
Still stuck?
If this page didn't answer your case, ask OpenClaw Expert for step-by-step guidance.