wihan/dev

docs /dokploy / resources

markdown
browse the dokploy docs

dokploy_port (Resource)

A published port on a Dokploy application, mapping a host port to a container port.

Example Usage

resource "dokploy_port" "metrics" {
  application_id = dokploy_application.web.id
  published_port = 9100
  target_port    = 9100
  protocol       = "tcp"
  publish_mode   = "host"
}

Schema

Required

  • application_id (String) Id of the application this belongs to. Changing it forces replacement: Dokploy’s update endpoint for this record type takes no parent field, so a record cannot be moved between applications.
  • published_port (Number) Port published on the host.
  • target_port (Number) Port the container listens on.

Optional

  • protocol (String) Transport protocol: tcp or udp.
  • publish_mode (String) Swarm publish mode: host or ingress.

Read-Only

  • id (String) Record id.

Import

Import is supported using the following syntax:

The terraform import command can be used, for example:

terraform import dokploy_port.metrics p1a2b3c4d5e6f7g8h9i0j