Docker Deployment
Deploy LibreChat using Docker for a production-ready, containerized setup. This guide covers both development and production deployments.Prerequisites
- Docker Engine 20.10+
- Docker Compose v2.0+
- At least 4GB RAM available
- 10GB disk space
Quick Start
Configure Environment
Copy the example environment file and configure your API keys:Edit
.env and set required variables:Start the Application
- LibreChat API (port 3080)
- MongoDB (internal)
- Meilisearch (internal)
- Vector Database (pgvector)
- RAG API (internal)
Docker Compose Files
Development Setup (docker-compose.yml)
The defaultdocker-compose.yml uses pre-built development images:
Production Setup (deploy-compose.yml)
For production deployments with separate API and NGINX:Building from Source
Standard Dockerfile
Build using the single-stage Dockerfile:Multi-Stage Dockerfile
For optimized production builds:Configuration Options
Using librechat.yaml
Mount your custom configuration:Volume Persistence
Data is persisted in these locations:Environment Variables
Key environment variables for Docker deployment:| Variable | Description | Default |
|---|---|---|
PORT | Application port | 3080 |
HOST | Bind address | 0.0.0.0 |
MONGO_URI | MongoDB connection string | mongodb://mongodb:27017/LibreChat |
MEILI_HOST | Meilisearch endpoint | http://meilisearch:7700 |
RAG_API_URL | RAG API endpoint | http://rag_api:8000 |
UID | User ID for file permissions | 1000 |
GID | Group ID for file permissions | 1000 |
NODE_ENV | Environment mode | production |
Management Commands
Update LibreChat
View Logs
Restart Services
Stop and Remove
User Management
Manage users with npm scripts:Troubleshooting
Permission Issues
If you encounter permission errors:MongoDB Connection Issues
Check MongoDB is running:Container Won’t Start
Check resource usage:Reset Everything
Advanced Configuration
Adding Mongo Express (Database UI)
Add todocker-compose.override.yml:
http://localhost:8081
Using External MongoDB
Enable Redis for Caching
Add Redis service and configure LibreChat:.env:
Production Checklist
- Generate strong secrets for
CREDS_KEY,JWT_SECRET, andMEILI_MASTER_KEY - Change default
UIDandGIDto match your system - Configure proper backup strategy for
data-nodeandmeili_data_v1.35.1 - Set up SSL/TLS with reverse proxy (nginx, Caddy, Traefik)
- Configure firewall rules
- Set
NODE_ENV=production - Enable log rotation
- Configure monitoring and health checks
- Review and restrict
ALLOW_REGISTRATIONsetting - Set up external authentication (OAuth, LDAP) if needed