Quick Start with Docker
Using Official Image
Run Directus with SQLite (development only):http://localhost:8055
With External Database
Run Directus with PostgreSQL:Docker Compose
Docker Compose is the recommended approach for production deployments.Basic Setup
Createdocker-compose.yml:
Production Setup
Complete production setup with Redis, PostgreSQL, and persistence:.env file for sensitive values:
Start Services
1
Start Containers
2
View Logs
3
Access Directus
Open
http://localhost:8055 in your browser and log in with your admin credentials.Dockerfile Reference
The official Directus Dockerfile uses a multi-stage build:Persistent Storage
Ensure data persists across container restarts:Database Data
File Uploads
Extensions
Using S3 for Storage
Recommended for production to avoid container storage:Advanced Configurations
Custom Extensions
Mount your extensions directory:WebSockets Support
Enable WebSockets for real-time features:Multiple Storage Locations
Reverse Proxy with Nginx
Add Nginx for SSL termination:nginx.conf:
Docker Management
Useful Commands
Database Backups
Monitor Resources
Scaling with Docker Swarm
Deploy multiple Directus instances:Troubleshooting
Container Won’t Start
Database Connection Failed
Permission Issues
Out of Memory
Increase memory limits:Security Best Practices
- Don’t expose database ports - Keep database internal to Docker network
- Use secrets - Store sensitive data in
.envfile, never commit to Git - Update regularly - Pull latest images for security patches
- Use specific versions - Pin image versions in production (e.g.,
directus/directus:10.10.0) - Enable health checks - Ensure containers restart on failure
- Limit resources - Prevent containers from consuming all host resources
Next Steps
- Configure environment variables
- Set up automated backups
- Enable monitoring
- Review production checklist