The quick version

If you just want OpenClaw in a container, the pattern is the usual Docker one: pull the image, map a port, and keep state in a named volume or bind mount.

docker run -d \
  --name openclaw \
  -p 3000:3000 \
  -v openclaw-data:/data \
  --restart unless-stopped \
  openclaw/openclaw

Then open http://localhost:3000 and go through the setup wizard in the browser. The image tag and the exact port may have changed by the time you read this, so check the official docs for the current tag instead of trusting a blog post from six months ago — including this one.

The volume gotcha

The mistake I see people make is running the container with no volume, then wondering why their config and memory vanish on every update. Containers are throwaway by design. If your agent's state lives inside the container filesystem, it dies the moment you docker rm it.

Whatever the image documents as its state directory — /data in the example above — mount it to something on the host. A named volume is fine for a single host. A bind mount is easier to back up and inspect.

Filesystem permissions

This is the one that actually bites. OpenClaw's whole value is that it can read files, write scripts, and run shell commands on your behalf. Inside a container, "your behalf" means the container's filesystem, not your machine's. If you want the agent to touch a real directory — say, a projects folder — you have to mount it in and get the user IDs right.

docker run -d \
  --name openclaw \
  -p 3000:3000 \
  -v "$(pwd)/projects:/projects" \
  -v openclaw-data:/data \
  --restart unless-stopped \
  openclaw/openclaw

The image likely runs as a non-root user. If your host folder is owned by root or a different UID, the agent will hit a permission wall the first time it tries to write. Check the image's documented user and chown the mount to match. This is also why a sandboxed, least-privilege setup matters: a container that mounts your entire home directory with write access has given the agent the keys to everything.

When to skip Docker

Docker is clean until it isn't. I reach for a bare-metal install in three cases:

If you want the agent up 24/7 on a cheap box, the systemd approach is simpler than Docker for most people. Use Docker when you're already running a container fleet, or when you want to pin versions and blow away the environment without leaving a trace.