OpenClaw Docker Compose ─ Deploy AI Agent in One Command

  Apr 5, 2026      2m      0   
 

Deploy one or more OpenClaw AI agent instances with Docker Compose: fully containerized, one-line setup, portable backup and restore, multiple instances on the same machine.

OpenClaw Docker Compose ─ Deploy AI Agent in One Command

Please install Docker and Docker Compose before walking through this tutorial.

What is OpenClaw?

OpenClaw is an open-source AI agent. This guide shows how to deploy it using Docker Compose with the openclaw-minimal-docker-compose repository.

Why Docker Compose?

  • Fully containerized — OpenClaw runs in an isolated container, leaving the host system untouched
  • One-line setup — a single curl command installs and starts everything
  • Minimal Docker Compose — lean, readable config that is easy to customize
  • Portable backup & restore — zip the folder, move it anywhere, run again
  • Multiple instances on one machine — spin up several agents on different ports simultaneously

Github: https://github.com/minhng92/openclaw-minimal-docker-compose

Star my repository if it helps. Thank you.

I. Quick Installation

curl -fsSL https://raw.githubusercontent.com/minhng92/openclaw-minimal-docker-compose/master/run.sh | bash -s -- --destination openclaw-one

This creates an OpenClaw instance at http://localhost:18789 with the default gateway password minhng.info.

If curl is not installed, run sudo apt-get install curl (Debian/Ubuntu) or sudo yum install curl (RHEL/CentOS).

Arguments

FlagDescriptionDefault
--destinationInstallation directory(required)
--portGateway HTTP port18789
--port-wsGateway WebSocket port18790
--passwordGateway login passwordminhng.info
--model-providerModel provider nameopenai
--model-base-urlModel provider base URLhttps://api.openai.com
--model-api-keyModel provider API key (written to agent.env)
--model-api-adapterModel API adapteropenai-completions
--model-idModel IDgpt-5.4
--telegram-bot-tokenTelegram bot token (written to agent.env)

Examples

Custom gateway password:

curl -fsSL https://raw.githubusercontent.com/minhng92/openclaw-minimal-docker-compose/master/run.sh | bash -s -- --destination openclaw-one --password mySecret123

Password + model API key:

curl -fsSL https://raw.githubusercontent.com/minhng92/openclaw-minimal-docker-compose/master/run.sh | bash -s -- --destination openclaw-one --password mySecret123 --model-api-key sk-proj-abc123XYZ

All options (custom ports + password + model + Telegram):

curl -fsSL https://raw.githubusercontent.com/minhng92/openclaw-minimal-docker-compose/master/run.sh | bash -s -- \
  --destination openclaw-one \
  --port 18789 \
  --port-ws 18790 \
  --password mySecret123 \
  --model-api-key sk-proj-abc123XYZ \
  --telegram-bot-token XXX:XXX

Custom model provider (e.g. DeepSeek):

curl -fsSL https://raw.githubusercontent.com/minhng92/openclaw-minimal-docker-compose/master/run.sh | bash -s -- \
  --destination openclaw-one \
  --model-provider deepseek \
  --model-base-url https://api.deepseek.com \
  --model-api-key sk-abc123XYZ \
  --model-api-adapter openai-completions \
  --model-id deepseek-chat

II. Manual Installation

git clone git@github.com:minhng92/openclaw-minimal-docker-compose.git
cd openclaw-minimal-docker-compose
# nano agent.env   # set password, model provider, Telegram token, etc.
docker-compose up -d

Configuration files

FilePurpose
.envDefault environment variables (tracked by Git)
agent.envDeployment overrides — takes precedence over .env, ignored by .gitignore
openclaw.jsonOpenClaw gateway & agent configuration (reference)

To change the gateway password, set the variable in agent.env:

OPENCLAW_GATEWAY_PASSWORD=mySecret123

To expose the gateway on custom ports, edit the host-side values (before the colon) in docker-compose.yml:

    ports:
      - "YOUR_HTTP_PORT:18789"
      - "YOUR_WS_PORT:18790"

III. Device Pairing (First Connection)

Open http://localhost:18789 and log in with your gateway password. On the first connection the UI will show pairing required.

Approve the pending device request from the terminal:

docker-compose exec openclaw-gateway bash -c 'openclaw devices list'
docker-compose exec openclaw-gateway bash -c 'openclaw devices approve <REQUEST-ID>'

After approval, log in again to access the Control UI.

Telegram Bot Pairing

Requires a Telegram bot token already configured via .env or agent.env.

Start a chat with your bot on Telegram — it will reply with a pairing code. Then approve it from the terminal:

docker-compose exec openclaw-gateway bash -c 'openclaw pairing approve telegram <PAIRING-CODE>'

IV. Grant Full Execution Permission

Edit _data/exec-approvals.json and set:

{
  "defaults": {
    "security": "full",
    "ask": "off"
  }
}

V. Managing the Instance

# Apply modified env
docker-compose down && docker-compose up -d

# Check logs
docker-compose logs --tail 50

# Stop the instance
docker-compose down

# Restart the instance
docker-compose restart

# Remove the instance completely
docker-compose down -v
cd .. && rm -rf <destination-folder>

VI. Multiple Instances on One Machine

Spin up a second instance on different ports:

curl -fsSL https://raw.githubusercontent.com/minhng92/openclaw-minimal-docker-compose/master/run.sh | bash -s -- --destination openclaw-two --port 18889 --port-ws 18890

Each instance runs independently in its own directory with its own ports.

VII. Backup & Restore

Backup:

sudo zip -r openclaw-minimal.zip openclaw-minimal

Restore:

sudo unzip openclaw-minimal.zip
cd openclaw-minimal
docker-compose up -d

All data lives inside the installation directory — zip it, move it, and it runs anywhere.

References


More docker-compose files for you: