Supported Databases
Dokploy supports five major database systems:PostgreSQL
Full-featured relational database with advanced features and excellent performance.
MySQL
Popular open-source relational database, ideal for web applications.
MariaDB
MySQL-compatible database with enhanced features and performance improvements.
MongoDB
Document-oriented NoSQL database for flexible, schema-less data storage.
Redis
In-memory data store for caching, session management, and real-time applications.
Creating a Database
Databases are created within environments, similar to applications. Each database type requires specific configuration:Common Configuration
All databases share these common properties:string
required
Display name for your database (shown in the UI)
string
required
Unique internal identifier (auto-generated if not provided)
string
Optional description to help identify the database’s purpose
string
required
Docker image to use (e.g.,
postgres:16, mysql:8, mongo:7, redis:7)string
required
The environment where this database will be deployed
PostgreSQL
PostgreSQL is a powerful, open-source relational database system.Configuration
string
required
Name of the database to create
string
required
Username for database access
string
required
Password for the database user (stored securely)
string
default:"postgres:16"
PostgreSQL version to use
Example Configuration
Connection String
The hostname uses the internal Docker network name. From your applications, use the
appName as the hostname.Schema Reference
PostgreSQL databases are stored with this structure:MySQL
MySQL is one of the most popular open-source relational databases.Configuration
string
required
Name of the database to create
string
required
Username for database access
string
required
Password for the database user
string
required
Root password for MySQL (administrative access)
string
default:"mysql:8"
MySQL version to use
Connection String
MariaDB
MariaDB is a MySQL-compatible database with enhanced features.Configuration
MariaDB uses the same configuration structure as MySQL:string
required
Database name
string
required
Database username
string
required
User password
string
required
Root password
string
default:"mariadb:11"
MariaDB version to use
Connection String
MongoDB
MongoDB is a document-oriented NoSQL database.Configuration
string
required
Name of the MongoDB database
string
required
Username with access to the database
string
required
Password for the database user
string
default:"mongo:7"
MongoDB version to use
Connection String
Authentication Database
By default, MongoDB uses the database name for authentication. If you need to use a different auth database:Redis
Redis is an in-memory data structure store used as a database, cache, and message broker.Configuration
string
required
Password for Redis authentication
string
default:"redis:7"
Redis version to use
Redis doesn’t use traditional database names or users. It uses a single password for authentication.
Connection String
Resource Management
All databases support resource allocation controls:string
Minimum memory guaranteed (e.g., “512m”, “1g”)
string
Maximum memory the database can use (e.g., “2g”, “4g”)
string
Minimum CPU guaranteed (e.g., “0.5”, “1.0”)
string
Maximum CPU the database can use (e.g., “2.0”, “4.0”)
Persistence & Mounts
Databases typically require persistent storage to preserve data across container restarts:Volume Mounts
Common Mount Paths
- PostgreSQL:
/var/lib/postgresql/data - MySQL:
/var/lib/mysql - MariaDB:
/var/lib/mysql - MongoDB:
/data/db - Redis:
/data
Backups
Dokploy provides automated backup functionality for all databases:Configuring Backups
string
required
Cron expression for backup schedule (e.g.,
0 2 * * * for daily at 2 AM)boolean
default:true
Enable or disable the backup schedule
string
required
Storage destination for backups (S3, local storage, etc.)
Backup Destinations
Backups can be stored in:- Local filesystem
- AWS S3
- S3-compatible storage (MinIO, DigitalOcean Spaces, etc.)
- Remote servers via SFTP
Example Backup Configuration
Manual Backups
You can also trigger backups manually through the UI or API:External Access
By default, databases are only accessible within the internal Docker network. To expose a database externally:number
Port to expose on the host machine (e.g., 5432, 3306, 27017, 6379)
Environment Variables
Custom environment variables can be added to databases:Advanced Configuration
Custom Commands
Override the default container command:Configuration Files
Mount custom configuration files:Swarm Configuration
For Docker Swarm deployments, databases support additional configuration:Replicas
number
default:1
Number of database replicas (use with caution - most databases require special configuration for replication)
Health Checks
Placement Constraints
Monitoring & Logs
Container Logs
Access database logs through:- Real-time log streaming in the UI
- Historical log viewing
- Export logs for analysis
Performance Metrics
Monitor database performance:- CPU usage
- Memory consumption
- Disk I/O
- Network traffic
Health Status
Dokploy tracks database health:- Container running status
- Connection availability
- Resource usage alerts
Connecting Applications
To connect your applications to databases:Internal Network (Recommended)
Use the database’s internal hostname:Service Discovery
Dokploy automatically handles service discovery within the Docker network. Applications in the same environment can connect using theappName as the hostname.
Example Connection Strings
Best Practices
Use Strong Passwords
Use Strong Passwords
Always use strong, unique passwords for database access. Consider using a password manager to generate and store them securely.
Regular Backups
Regular Backups
Configure automated backups and test restoration periodically. Store backups in a different location than your database.
Resource Limits
Resource Limits
Always set appropriate memory and CPU limits based on your database’s workload and available system resources.
Monitor Performance
Monitor Performance
Regularly check database performance metrics and logs to identify issues before they become critical.
Keep Images Updated
Keep Images Updated
Regularly update database images to get security patches and performance improvements.
Separate Environments
Separate Environments
Use different database instances for production, staging, and development environments.
Next Steps
Applications
Connect your applications to databases
Backups
Learn more about backup strategies