Field Notes/Getting Started
🔍 Discovery

How to Run OpenClaw in Docker (Security + Portability Guide)

2 min read

Docker gives your agent clear security boundaries. It only touches what you explicitly allow — nothing more. When you're handing over email, calendar, and GitHub access, isolation isn't optional.

Why Isolate?

Autonomous agents are powerful because they access your stuff. That's also what makes them risky. An uncontained agent is one prompt injection away from disaster.

Docker fixes this. Your agent runs isolated and only gets what you mount or expose:

  • No accidental SSH key leaks
  • No wandering into your password manager
  • No "helpful" modifications to system files

Each agent gets its own container, its own permissions. My email agent can't see code repos. My GitHub bot doesn't know my calendar exists.

Dead-Simple Backups

Before Docker, backing up an agent meant... what? Copying config files and hoping you remembered everything?

With Docker:

  • Commit the container — saves current state as an image
  • Push to a registry — Docker Hub, GHCR, whatever
  • Recover in seconds — pull the last known good image

I've accidentally nuked an agent's memory. Back up in under a minute. Without Docker? Rebuilding from scratch.

Move Anywhere

Laptop to Mac Mini? Local to VPS? Same image, same behavior, zero reconfiguration.

You can also run multiple isolated agents on one machine — different projects, different access levels, zero cross-contamination.

Easy Setup

You don't need Docker expertise. Just tell Claude Code:

"Set up OpenClaw in Docker with access to my email and Slack. Keep everything else isolated."

It generates the Dockerfile, docker-compose config, and volume mounts. Clean and auditable every time.

The Takeaway

Docker isn't overhead — it's insurance. Security, backups, and portability for the thing that has access to your digital life. Start containerized.