Skip to main content
Docker provides a consistent, containerized way to deploy Directus across any environment. This guide covers deploying Directus with Docker and Docker Compose.

Quick Start with Docker

Using Official Image

Run Directus with SQLite (development only):
Access Directus at http://localhost:8055

With External Database

Run Directus with PostgreSQL:

Docker Compose

Docker Compose is the recommended approach for production deployments.

Basic Setup

Create docker-compose.yml:

Production Setup

Complete production setup with Redis, PostgreSQL, and persistence:
Create a .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:
Create 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

  1. Don’t expose database ports - Keep database internal to Docker network
  2. Use secrets - Store sensitive data in .env file, never commit to Git
  3. Update regularly - Pull latest images for security patches
  4. Use specific versions - Pin image versions in production (e.g., directus/directus:10.10.0)
  5. Enable health checks - Ensure containers restart on failure
  6. Limit resources - Prevent containers from consuming all host resources

Next Steps