OpenClaw Docker Compose ─ Deploy AI Agent in One Command
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.

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
curlcommand 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
curlis not installed, runsudo apt-get install curl(Debian/Ubuntu) orsudo yum install curl(RHEL/CentOS).
Arguments
| Flag | Description | Default |
|---|---|---|
--destination | Installation directory | (required) |
--port | Gateway HTTP port | 18789 |
--port-ws | Gateway WebSocket port | 18790 |
--password | Gateway login password | minhng.info |
--model-provider | Model provider name | openai |
--model-base-url | Model provider base URL | https://api.openai.com |
--model-api-key | Model provider API key (written to agent.env) | — |
--model-api-adapter | Model API adapter | openai-completions |
--model-id | Model ID | gpt-5.4 |
--telegram-bot-token | Telegram 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
| File | Purpose |
|---|---|
.env | Default environment variables (tracked by Git) |
agent.env | Deployment overrides — takes precedence over .env, ignored by .gitignore |
openclaw.json | OpenClaw 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
- OpenClaw Official: openclaw.ai
- OpenClaw Docs: docs.openclaw.ai
More docker-compose files for you:
- Deploying Supabase with Docker Compose
- Docker for Zabbix
- Docker compose for Redis
- Docker Compose for Traefik (reverse proxy HTTP)
- Set up Nginx reverse proxy HTTP/HTTPS with Docker Compose
- Docker compose for VSCode server
- Set up Pytorch Env with Docker within 1 Minute
- Docker Compose for Jekyll
- Docker Compose for Odoo 10
- Docker Compose for Odoo 11
- Docker Compose for Odoo 12
- Docker Compose for Odoo 13
- Docker Compose for Odoo 14
- Docker Compose for Odoo 15
- Docker Compose for Odoo 16
- Docker Compose for Odoo 17
- Docker Compose for Odoo 18
- Docker Compose for Odoo 19