Skip to main content
Dokploy provides built-in support for deploying and managing multiple database types as Docker services. Each database is automatically configured with persistent storage, environment variables, and connection credentials.

Supported Databases

Dokploy supports the following database systems:
  • PostgreSQL - Popular open-source relational database
  • MySQL - World’s most popular open-source relational database
  • MariaDB - MySQL-compatible relational database
  • MongoDB - Document-oriented NoSQL database
  • Redis - In-memory data structure store

Features

Automatic Configuration

When you create a database in Dokploy, it automatically:
  • Creates a Docker Swarm service with the selected database image
  • Sets up persistent volume mounts for data storage
  • Configures authentication credentials
  • Generates connection strings for your applications
  • Enables health checks and restart policies

Volume Management

Each database automatically creates a data volume:
Mount path: /var/lib/postgresql/data (varies by image) Volume name: {appName}-data

Network Access

Internal Access: All databases are accessible within the Docker Swarm network using their service name. External Access: You can optionally expose databases to external networks by configuring an external port.
Be cautious when exposing databases externally. Use strong passwords and consider using firewalls or VPNs for production databases.

Environment Variables

Databases can inherit environment variables from:
  1. Project-level environment variables
  2. Environment-level variables (e.g., staging, production)
  3. Database-specific environment variables
Variables are merged with database-specific taking precedence.

Resource Limits

You can configure resource limits for each database:
  • Memory Limit - Maximum memory allocation
  • Memory Reservation - Guaranteed memory allocation
  • CPU Limit - Maximum CPU usage
  • CPU Reservation - Guaranteed CPU allocation

Connection Strings

Each database type has a specific connection string format. See the individual database pages for details:

Backups

Dokploy includes automated backup functionality for all database types. Learn more in the Backups section.

Common Operations

Starting a Database

Databases can be started through the Dokploy UI or API. When started, the service is created or updated in Docker Swarm.

Stopping a Database

Stopping a database removes the running container but preserves data volumes.

Reloading a Database

Reloading stops and starts the database, applying any configuration changes.

Rebuilding a Database

Rebuilding a database will delete all data and recreate the service from scratch. This operation cannot be undone.
The rebuild operation:
  1. Stops the database service
  2. Removes associated volumes
  3. Recreates the service with fresh configuration

Best Practices

  1. Use Strong Passwords - Generate secure, random passwords for production databases
  2. Regular Backups - Configure automated backups to prevent data loss
  3. Resource Limits - Set appropriate memory and CPU limits based on workload
  4. Internal Networks - Keep databases on internal networks when possible
  5. Monitoring - Monitor database logs and health status regularly
  6. Version Pinning - Use specific Docker image tags instead of latest

Next Steps

PostgreSQL

Deploy and configure PostgreSQL databases

MySQL

Deploy and configure MySQL databases

MongoDB

Deploy and configure MongoDB databases

Backups

Configure automated database backups

Build docs developers (and LLMs) love