dokploy_mount (Resource)
A volume, bind or file mount attached to a Dokploy service.
~> Database services create their own data mount. A dokploy_postgres (or mysql/mariadb/mongo/redis) owns a volume mount for its data directory from the moment it is created, without anything asking for it. That mount belongs to the server, not to Terraform — do not import it or declare it here.
Example Usage
# A named Docker volume for an application's uploads directory.
resource "dokploy_mount" "uploads" {
service_id = dokploy_application.web.id
service_type = "application"
type = "volume"
volume_name = "web-uploads"
mount_path = "/app/uploads"
}
# A bind mount from a path on the Dokploy host.
resource "dokploy_mount" "certs" {
service_id = dokploy_application.web.id
service_type = "application"
type = "bind"
host_path = "/etc/ssl/private/app"
mount_path = "/certs"
}
# A file written into the container at deploy time.
resource "dokploy_mount" "config" {
service_id = dokploy_application.web.id
service_type = "application"
type = "file"
mount_path = "/app/config"
file_path = "settings.json"
content = jsonencode({ log_level = "info" })
}
Schema
Required
mount_path(String) Path inside the container to mount at.service_id(String) Id of the service this mount attaches to. Changing it forces replacement: Dokploy’s update endpoint sets the new parent without clearing the old one, leaving the mount owned by two services at once.service_type(String) Kind of serviceservice_idrefers to: one ofapplication,postgres,mysql,mariadb,mongo,redis,compose,libsql. Changing it forces replacement, for the same reason asservice_id.type(String) Mount kind:bind(host path),volume(named Docker volume), orfile(inline content written into the container).
Optional
content(String) Contents of the file. Required whentypeisfile, and invalid otherwise.file_path(String) File name to create insidemount_path. Required whentypeisfile, and invalid otherwise.host_path(String) Absolute path on the host. Required whentypeisbind, and invalid otherwise.volume_name(String) Name of the Docker volume. Required whentypeisvolume, and invalid otherwise.
Read-Only
id(String) Mount id.
Import
Import is supported using the following syntax:
The terraform import command can be used, for example:
# Mounts import by their own id; the parent service is recovered from the record.
terraform import dokploy_mount.uploads m1a2b3c4d5e6f7g8h9i0j