Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Nettalco/dokploy/llms.txt

Use this file to discover all available pages before exploring further.

Dokploy provides first-class managed database support, allowing you to spin up fully containerised database servers directly inside your projects — no external cloud service required. Each database runs as a Docker service with a persistent volume, and connection credentials are automatically available as environment variables to other services in the same project.

Supported Database Engines

PostgreSQL

The world’s most advanced open-source relational database. Supports any Docker Hub postgres image tag for version selection.

MySQL

The most widely deployed open-source relational database. Compatible with all mysql image tags.

MariaDB

A community-developed MySQL fork with additional storage engines and features.

MongoDB

A document-oriented NoSQL database designed for flexibility and horizontal scale.

Redis

An in-memory key-value store used for caching, sessions, pub/sub messaging, and queues.

libsql

A community open-contribution fork of SQLite designed to be used as a server, compatible with the Turso client libraries.

Creating a Database

1

Open a project

Navigate to the project where you want the database to live. Databases and applications in the same project share a private Docker network, enabling connection by service name.
2

Add a database service

Click Add Service and select the database engine you need (PostgreSQL, MySQL, MariaDB, MongoDB, Redis, or libsql).
3

Configure the database

Fill in:
  • Name — a human-readable label for the service.
  • Docker Image — the image tag to use, e.g. postgres:16, mysql:8.0, mongo:7. This is how you pin a specific version.
  • Database name, username, and password (where applicable).
4

Deploy

Click Create (or Deploy). Dokploy pulls the image, creates a named Docker volume for persistence, and starts the container. The service is immediately reachable by other containers in the project over the internal Docker network.

Connecting to Your Application

Every database service automatically exposes its connection string as an environment variable that you can copy and paste into any application in the same project.
# PostgreSQL connection string (available from the database's Connect tab)
POSTGRES_URL=postgres://dokploy:password@<appName>:5432/mydb

# MySQL
MYSQL_URL=mysql://dokploy:password@<appName>:3306/mydb

# MongoDB
MONGO_URL=mongodb://dokploy:password@<appName>:27017/mydb

# Redis
REDIS_URL=redis://:password@<appName>:6379
The <appName> hostname resolves automatically within the shared Docker network — no manual IP or hostname configuration is needed. Open the Connect tab on any database service to copy the ready-to-use connection strings.
Internal connections use Docker’s overlay network and never leave your server. You do not need to expose a database externally just to connect an application running on the same Dokploy instance.

External Access

If you need to connect to a database from outside the server — for example, from a local database GUI like TablePlus or DBeaver — you can expose an external port.
1

Open the database service

Navigate to the database and open the General or Ports tab.
2

Set an external port

Enter an available host port in the External Port field. Dokploy checks whether the port is already in use before saving; if it is, you will see a conflict error naming the container that holds the port.
3

Connect remotely

Use <server-ip>:<external-port> in your database client with the credentials configured for the service.
Exposing a database port publicly makes it reachable from the internet. Always use a strong, unique password and restrict access with firewall rules (ufw or your cloud provider’s security groups) to trusted IP addresses only. Never expose database ports in production without additional network-level controls.

Database Versions

Dokploy uses standard Docker Hub image tags for versioning. When creating or editing a database, set the Docker Image field to the desired tag:
postgres:16          # PostgreSQL 16 (latest patch)
postgres:15.6        # PostgreSQL 15.6 (exact version)
mysql:8.0            # MySQL 8.0
mongo:7              # MongoDB 7
mariadb:11.3         # MariaDB 11.3
redis:7-alpine       # Redis 7 on Alpine Linux
To upgrade a database version, update the Docker Image field and click Rebuild. Always back up your data before upgrading between major versions.

Environment Variables

Each database service has its own Environment Variables tab where you can inject additional environment variables directly into the database container. This is useful for setting database-specific tuning flags or enabling plugins supported by the official Docker image.
# Example: tuning PostgreSQL via environment
POSTGRES_INITDB_ARGS=--encoding=UTF8 --lc-collate=C

Stopping and Restarting

From any database detail page you can:
ActionDescription
StopGracefully stops the running container while keeping the volume intact.
StartRestarts a previously stopped database container.
RebuildPulls the latest image matching the configured tag and recreates the container, preserving the volume data.

Moving Databases

A database can be reassigned to a different project environment using the Move action (found in the service’s settings menu). Moving a database updates the environmentId association — the underlying Docker service and volume remain on the same server unchanged.

Build docs developers (and LLMs) love