Skip to main content

Overview

The MariaDB API allows you to create, manage, deploy, and monitor MariaDB database instances. MariaDB databases run as Docker containers with support for automated backups, external port configuration, and resource management.

Create MariaDB Database

curl -X POST https://your-dokploy-instance.com/api/mariadb.create \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "production-mariadb",
    "appName": "prod-mariadb",
    "databaseName": "myapp",
    "databaseUser": "admin",
    "databasePassword": "securePassword123!",
    "databaseRootPassword": "rootPassword456!",
    "dockerImage": "mariadb:11",
    "environmentId": "env_123456",
    "description": "Production MariaDB database"
  }'
{
  "mariadbId": "mariadb_abc123",
  "name": "production-mariadb",
  "appName": "prod-mariadb",
  "databaseName": "myapp",
  "databaseUser": "admin",
  "dockerImage": "mariadb:11",
  "applicationStatus": "idle",
  "createdAt": "2024-02-28T12:00:00Z"
}

Request Body

name
string
required
Display name for the MariaDB database (minimum 1 character)
appName
string
required
Unique application name used for Docker container naming (minimum 1 character)
databaseName
string
required
Name of the MariaDB database to create (minimum 1 character)
databaseUser
string
required
Username for database authentication (minimum 1 character)
databasePassword
string
required
Password for the database user. Must match pattern: ^[a-zA-Z0-9@#%^&*()_+\-=[\]{}|;:,.<>?~]*$`
databaseRootPassword
string
required
Root password for MariaDB. Must match pattern: ^[a-zA-Z0-9@#%^&*()_+\-=[\]{}|;:,.<>?~]*$`
environmentId
string
required
ID of the environment where the database will be deployed
dockerImage
string
default:"mariadb:11"
Docker image to use for MariaDB (e.g., mariadb:11, mariadb:10.11)
description
string
Optional description for the database instance
serverId
string
ID of the server where the database should be deployed (required in cloud environments)

Get MariaDB Database

Retrieve details about a specific MariaDB database instance.
curl -X GET "https://your-dokploy-instance.com/api/mariadb.one?mariadbId=mariadb_abc123" \
  -H "Authorization: Bearer YOUR_API_TOKEN"

Query Parameters

mariadbId
string
required
Unique identifier of the MariaDB database

Deploy MariaDB Database

Deploy or redeploy a MariaDB database container.
curl -X POST https://your-dokploy-instance.com/api/mariadb.deploy \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "mariadbId": "mariadb_abc123"
  }'

Request Body

mariadbId
string
required
ID of the MariaDB database to deploy

Start MariaDB Database

Start a stopped MariaDB database container.
curl -X POST https://your-dokploy-instance.com/api/mariadb.start \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "mariadbId": "mariadb_abc123"
  }'

Stop MariaDB Database

Stop a running MariaDB database container.
curl -X POST https://your-dokploy-instance.com/api/mariadb.stop \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "mariadbId": "mariadb_abc123"
  }'

Reload MariaDB Database

Reload (restart) a MariaDB database container.
curl -X POST https://your-dokploy-instance.com/api/mariadb.reload \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "mariadbId": "mariadb_abc123",
    "appName": "prod-mariadb"
  }'

Request Body

mariadbId
string
required
ID of the MariaDB database to reload
appName
string
required
Application name of the MariaDB database (minimum 1 character)

Update MariaDB Database

Update MariaDB database configuration, including credentials, resources, and Docker image.
curl -X POST https://your-dokploy-instance.com/api/mariadb.update \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "mariadbId": "mariadb_abc123",
    "name": "production-mariadb-updated",
    "databasePassword": "newSecurePassword456!",
    "memoryLimit": "2g",
    "cpuLimit": "1.5"
  }'

Request Body

mariadbId
string
required
ID of the MariaDB database to update (minimum 1 character)
name
string
Updated display name (minimum 1 character)
appName
string
Updated application name (minimum 1 character)
databaseName
string
Updated database name (minimum 1 character)
databaseUser
string
Updated database username (minimum 1 character)
databasePassword
string
Updated database password
databaseRootPassword
string
Updated root password
dockerImage
string
default:"mariadb:11"
Updated Docker image version
memoryReservation
string
Memory reservation (e.g., “512m”, “1g”)
memoryLimit
string
Memory limit (e.g., “1g”, “2g”)
cpuReservation
string
CPU reservation (e.g., “0.5”, “1.0”)
cpuLimit
string
CPU limit (e.g., “1.0”, “2.0”)
command
string
Custom command to run in the container
args
array
Command line arguments for the MariaDB server
externalPort
number
External port to expose MariaDB

Save Environment Variables

Update environment variables for the MariaDB database container.
curl -X POST https://your-dokploy-instance.com/api/mariadb.saveEnvironment \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "mariadbId": "mariadb_abc123",
    "env": "MARIADB_MAX_CONNECTIONS=200\nMARIADB_INNODB_BUFFER_POOL_SIZE=1G"
  }'

Request Body

mariadbId
string
required
ID of the MariaDB database
env
string
Environment variables in KEY=VALUE format, separated by newlines

Save External Port

Configure external port mapping for the MariaDB database.
curl -X POST https://your-dokploy-instance.com/api/mariadb.saveExternalPort \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "mariadbId": "mariadb_abc123",
    "externalPort": 3306
  }'

Request Body

mariadbId
string
required
ID of the MariaDB database
externalPort
number
required
Port number to expose MariaDB externally. Set to null to remove external port mapping.

Change Status

Manually update the application status of a MariaDB database.
curl -X POST https://your-dokploy-instance.com/api/mariadb.changeStatus \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "mariadbId": "mariadb_abc123",
    "applicationStatus": "done"
  }'

Request Body

mariadbId
string
required
ID of the MariaDB database
applicationStatus
string
required
New status. Options: idle, running, done, error

Move MariaDB Database

Move a MariaDB database to a different environment.
curl -X POST https://your-dokploy-instance.com/api/mariadb.move \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "mariadbId": "mariadb_abc123",
    "targetEnvironmentId": "env_789xyz"
  }'

Request Body

mariadbId
string
required
ID of the MariaDB database to move
targetEnvironmentId
string
required
ID of the destination environment

Rebuild MariaDB Database

Rebuild the MariaDB database container from scratch.
curl -X POST https://your-dokploy-instance.com/api/mariadb.rebuild \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "mariadbId": "mariadb_abc123"
  }'

Request Body

mariadbId
string
required
ID of the MariaDB database to rebuild

Remove MariaDB Database

Delete a MariaDB database and all associated resources, including backups and scheduled jobs.
This action is irreversible. All database data and backups will be permanently deleted.
curl -X POST https://your-dokploy-instance.com/api/mariadb.remove \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "mariadbId": "mariadb_abc123"
  }'

Request Body

mariadbId
string
required
ID of the MariaDB database to remove

Backup Operations

For backup and restore operations, see the Backup API documentation.
  • Create automated backups: backup.create
  • Manual backup: backup.manualBackupMariadb
  • Restore from backup: backup.restoreBackupWithLogs