Skip to main content
Mounts in Dokploy provide persistent storage and file injection for your applications and services. You can create volume mounts, bind mounts to host directories, or inject configuration files directly into containers.

Create Mount

curl -X POST https://your-dokploy-instance.com/api/trpc/mount.create \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "volume",
    "volumeName": "app-data",
    "mountPath": "/data",
    "serviceId": "app_abc123",
    "serviceType": "application"
  }'

Request Body

type
enum
required
Type of mount to create.
mountPath
string
required
Path inside the container where the mount will be attached (e.g., /data, /etc/nginx/nginx.conf).
serviceId
string
required
ID of the service (application, database, or compose) to attach this mount to.
serviceType
enum
required
Type of service this mount is for.
volumeName
string
Name of the Docker volume. Required when type is volume.
hostPath
string
Absolute path on the host filesystem. Required when type is bind.
filePath
string
Virtual path for the file. Required when type is file.
content
string
File content to inject. Required when type is file.

Get Mount

curl -X GET "https://your-dokploy-instance.com/api/trpc/mount.one?mountId=mount_xyz789" \
  -H "Authorization: Bearer YOUR_API_TOKEN"

Query Parameters

mountId
string
required
ID of the mount to retrieve.

Response

mountId
string
Unique identifier for the mount.
type
string
Mount type: volume, bind, or file.
mountPath
string
Container path where the mount is attached.
volumeName
string
Docker volume name (for volume mounts).
hostPath
string
Host filesystem path (for bind mounts).
filePath
string
Virtual file path (for file mounts).
content
string
File content (for file mounts).
serviceType
string
Type of service this mount belongs to.
applicationId
string
Application ID (if applicable).

List Mounts by Service

curl -X GET "https://your-dokploy-instance.com/api/trpc/mount.listByServiceId?serviceId=app_abc123&serviceType=application" \
  -H "Authorization: Bearer YOUR_API_TOKEN"

Query Parameters

serviceId
string
required
ID of the service.
serviceType
enum
required
Type of service: application, postgres, mysql, mariadb, mongo, redis, or compose.

Response

Returns an array of all mounts configured for the specified service.

Update Mount

curl -X POST https://your-dokploy-instance.com/api/trpc/mount.update \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "mountId": "mount_xyz789",
    "mountPath": "/data/updated",
    "content": "{\"updated\": true}"
  }'

Request Body

mountId
string
required
ID of the mount to update.
type
enum
Updated mount type.
mountPath
string
Updated container path.
volumeName
string
Updated volume name (for volume mounts).
hostPath
string
Updated host path (for bind mounts).
filePath
string
Updated file path (for file mounts).
content
string
Updated file content (for file mounts).

Delete Mount

curl -X POST https://your-dokploy-instance.com/api/trpc/mount.remove \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "mountId": "mount_xyz789"
  }'

Request Body

mountId
string
required
ID of the mount to delete.
Deleting a mount does not delete the underlying volume or data. To remove a Docker volume, use Docker CLI commands.

Mount Types Explained

Volume Mounts

Docker-managed volumes that persist data independently of containers. Use cases:
  • Database storage
  • Application data that needs to persist across deployments
  • Shared data between multiple containers
Example:
{
  "type": "volume",
  "volumeName": "postgres-data",
  "mountPath": "/var/lib/postgresql/data",
  "serviceId": "postgres_123",
  "serviceType": "postgres"
}

Bind Mounts

Direct mounts from the host filesystem into the container. Use cases:
  • Development with live code updates
  • Sharing configuration files from host
  • Accessing host directories for logging
Example:
{
  "type": "bind",
  "hostPath": "/opt/app/uploads",
  "mountPath": "/app/public/uploads",
  "serviceId": "app_123",
  "serviceType": "application"
}
Bind mounts require the host path to exist before container startup. Ensure proper permissions are set on the host directory.

File Mounts

Inject configuration files directly into containers without managing separate config files on the host. Use cases:
  • Configuration files (nginx.conf, app.json)
  • Environment-specific settings
  • Small static files
Example:
{
  "type": "file",
  "filePath": "/config/nginx.conf",
  "content": "server {\n  listen 80;\n  server_name example.com;\n}",
  "mountPath": "/etc/nginx/conf.d/default.conf",
  "serviceId": "app_123",
  "serviceType": "application"
}

Best Practices

Volume Management

Use named volumes for production data. Docker manages their lifecycle and they’re easier to backup and restore.
  • Use volumes for database storage
  • Name volumes descriptively (e.g., myapp-postgres-data)
  • Regularly backup volume data
  • Monitor volume disk usage

Bind Mount Security

  • Avoid binding sensitive host directories
  • Use read-only mounts when possible
  • Set appropriate file permissions
  • Be cautious with root-owned directories

File Mount Limitations

  • Keep file content small (< 1MB recommended)
  • For large configurations, use volumes or bind mounts
  • File mounts are stored in the database
  • Changes require container restart

Path Considerations

  • Always use absolute paths for mountPath
  • Ensure container processes have appropriate permissions
  • Avoid mounting over system directories
  • Check for conflicts with existing container files

Common Patterns

Database Persistence

{
  "type": "volume",
  "volumeName": "myapp-postgres",
  "mountPath": "/var/lib/postgresql/data",
  "serviceId": "postgres_id",
  "serviceType": "postgres"
}

Nginx Configuration

{
  "type": "file",
  "filePath": "/nginx/default.conf",
  "content": "server { listen 80; root /usr/share/nginx/html; }",
  "mountPath": "/etc/nginx/conf.d/default.conf",
  "serviceId": "app_id",
  "serviceType": "application"
}

Shared Upload Directory

{
  "type": "volume",
  "volumeName": "shared-uploads",
  "mountPath": "/app/uploads",
  "serviceId": "app_id",
  "serviceType": "application"
}