OpenClaw Coolify Docker Deployment
Deploy OpenClaw self-hosted AI assistant on Coolify with Docker. Multi-LLM support, OAuth, persistent config, Telegram integration. Production-ready.
Originally published:
Deploy OpenClaw on Coolify: Self-Hosted AI Assistant Infrastructure
OpenClaw is a personal AI assistant framework designed for developers and teams who need fine-grained control over LLM integrations, model selection, and deployment environment. This repository provides production-ready Docker configurations to deploy OpenClaw on Coolify—a modern PaaS platform—or as a standalone containerized application. It bridges the gap between local AI development and scalable, self-hosted infrastructure.
Key Features & Capabilities
- Multi-LLM Support: Compatible with OpenRouter, OpenAI, and Anthropic APIs—switch models at runtime without code changes
- Coolify Integration: One-click Docker Compose deployment with environment variable management in Coolify's UI
- Persistent Configuration: Volume-backed storage ensures settings survive container restarts and redeployments
- OAuth & Security: Built-in gateway token authentication and trusted proxy support for reverse-proxy setups
- Telegram Integration: Native support for Telegram bot connectivity out of the box
- Non-Root Execution: Container runs as unprivileged
linuxbrewuser with minimal attack surface - HTTPS Ready: Domain-based HTTPS configuration with automatic port mapping (exposed on 18789)
Getting Started
Coolify Deployment (Recommended)
For managed deployment with UI controls:
- Create a new Service in Coolify and select "Git Repository" as source
- Enter repository URL and set Build Pack to Docker Compose
- Configure required environment variables (LLM API keys, domain, optional gateway token)
- Deploy and retrieve the auto-generated gateway token from logs
- Save token as
OPENCLAW_GATEWAY_TOKENand redeploy - Access
https://your-domain/?token=YOUR_TOKENand complete onboarding viaopenclaw onboardin the terminal
The entire configuration can be injected via OPENCLAW_CONFIG_CONTENT environment variable on first deploy, including gateway mode, authentication, and model defaults. After initial setup, changes made through the UI persist to the volume automatically.
Docker Compose Standalone
For local or direct server deployment:
- Clone the repository and create a
.envfile with your LLM API credentials - Run
docker-compose upand access the container viadocker exec -it openclaw bash - Optionally use
OPENCLAW_FORCE_CONFIGto inject full configuration on each deploy (disable after first setup) - Edit
~/.openclaw/openclaw.jsondirectly inside the container for advanced tuning
Architecture & Components
The deployment consists of three key artifacts:
- Dockerfile: Multi-layer image based on Node 22 with Python, Homebrew, and OpenClaw pre-installed
- entrypoint.sh: Initialization script handling configuration generation, migrations, and service startup
- docker-compose.yaml: Service orchestration defining volumes, networking, and port exposure
The container runs with limited privileges (non-root linuxbrew user) while retaining sudo access for skill-based package installations. This design balances security with extensibility for AI agent workflows.
Who This Is For
- DevOps & Platform Engineers: Need repeatable, containerized deployment of AI infrastructure with multi-provider LLM support
- Privacy-Focused Organizations: Require self-hosted AI assistants without external SaaS dependencies
- Full-Stack AI Developers: Want to experiment with OpenClaw in production-like environments before scaling
- Coolify Users: Seeking pre-built Docker Compose templates for rapid AI service deployment
Prerequisites & Requirements
- Server with Docker and Docker Compose installed (or Coolify with Docker backend)
- At least one active LLM API key from OpenRouter, OpenAI, or Anthropic
- Public domain with HTTPS support for production deployments
- Minimum 2GB RAM recommended; 4GB+ for multi-model concurrent inference
Advanced Configuration
For complex setups, you can inject the entire openclaw.json configuration as a base64-encoded environment variable, controlling gateway mode (local/distributed), trusted proxies, authentication, Telegram webhooks, and default model selection. Runtime model switching is supported via openclaw agent --model {provider}/{model-id} inside the container.
Resources
- GitHub Repository – Source code, Dockerfile, Docker Compose configuration
- Full README – Complete setup guide with environment variable reference
- OpenClaw AI Assistant Framework
- Coolify Deployment Platform
- Docker Compose for AI Services
Source: GitHub repository by mklozinski, last updated February 2026. Licensed under repository default terms.
Original Source
https://github.com/mklozinski/openclaw-coolify
Last updated: