# dokploy_registry (Data Source)

Looks up a container registry login that already exists in Dokploy (Settings > Registry), so that an application can push its built images to it:

```terraform
data "dokploy_registry" "ghcr" {
  name = "ghcr"
}

resource "dokploy_application" "api" {
  registry_id = data.dokploy_registry.ghcr.id
  # ...
}
```

~> **The data source does not expose the password.** `password` exists on the `dokploy_registry` resource, but not here, by design. A consumer needs only the id.

~> Dokploy does not enforce name uniqueness. If two registries share a name, this data source fails instead of a guess. Look the record up by `id` in that case.

## Example Usage

```terraform
data "dokploy_registry" "example" {
  id = "your-registry-id"
}

data "dokploy_registry" "ghcr" {
  name = "ghcr"
}

# Push the built images to the registry.
resource "dokploy_application" "api" {
  name           = "api"
  environment_id = data.dokploy_environment.production.id
  registry_id    = data.dokploy_registry.ghcr.id

  git = {
    url    = "https://github.com/example/api.git"
    branch = "main"
  }
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Optional

- `id` (String) Registry id. Set it for a lookup by id, or leave it unset and set `name`.
- `name` (String) Display name as shown in Dokploy. Set exactly one of `id` or `name`.

### Read-Only

- `created_at` (String) Creation timestamp from the server.
- `image_prefix` (String) Path that Dokploy puts in front of each image name it pushes, or null.
- `organization_id` (String) Id of the organization that owns the registry.
- `registry_type` (String) Registry type, `cloud` on Dokploy v0.30.
- `url` (String) Registry host, with an optional port and without a scheme.
- `username` (String) Login user.