wihan/dev

docs /dokploy / resources

markdown
browse the dokploy docs

dokploy_volume_backup (Resource)

A scheduled archive of a Docker volume to an S3-compatible destination.

Volume backups copy the volume’s contents as-is, so they work for any service that has one — including Redis, which dokploy_backup cannot cover because Dokploy has no logical dump for it.

Example Usage

# Nightly archive of an application's uploads volume.
resource "dokploy_volume_backup" "uploads" {
  name            = "web-uploads-nightly"
  service_id      = dokploy_application.web.id
  service_type    = "application"
  volume_name     = "web-uploads"
  prefix          = "volumes/web/"
  cron_expression = "0 4 * * *"
  destination_id  = dokploy_destination.backups.id

  keep_latest_count = 14
}

# Redis has no logical dump in Dokploy, so a volume backup is the only way
# to capture it. dokploy_backup rejects a redis parent at plan time.
resource "dokploy_volume_backup" "cache" {
  name            = "cache-nightly"
  service_id      = dokploy_redis.cache.id
  service_type    = "redis"
  volume_name     = "cache-data"
  prefix          = "volumes/cache/"
  cron_expression = "30 4 * * *"
  destination_id  = dokploy_destination.backups.id
}

Schema

Required

  • cron_expression (String) Standard five-field cron expression, e.g. 0 4 * * *.
  • destination_id (String) Id of the dokploy_destination archives are written to.
  • name (String) Display name.
  • prefix (String) Key prefix inside the destination bucket, e.g. volumes/web/.
  • service_id (String) Id of the service whose volume is archived. Changing it forces replacement: Dokploy’s update endpoint sets the new parent without clearing the old one, leaving the record owned by two services at once.
  • service_type (String) Kind of service service_id refers to: one of application, postgres, mysql, mariadb, mongo, redis, compose, libsql. Changing it forces replacement, for the same reason as service_id.
  • volume_name (String) Name of the Docker volume to archive.

Optional

  • enabled (Boolean) Whether the backup runs. Defaults to true: Dokploy leaves this null when a record is created through the API alone, which is neither on nor off, and a backup declared in configuration that silently never runs is the worse failure.
  • keep_latest_count (Number) How many archives to retain. Omit to keep all of them.
  • service_name (String) Name of the specific container, for compose services with more than one.
  • turn_off (Boolean) Dokploy’s turnOff flag, passed through unchanged. The server coerces both an absent key and an explicit null to false, so this attribute always sends a concrete value.

Read-Only

  • app_name (String) Dokploy-internal app name, generated by the server.
  • created_at (String) Creation timestamp (server-side).
  • id (String) Volume backup id.

Import

Import is supported using the following syntax:

The terraform import command can be used, for example:

terraform import dokploy_volume_backup.uploads v1a2b3c4d5e6f7g8h9i0j