---
title: How to Enable IAM Authentication for Vultr Container Registry
url: https://docs.vultr.com/platform/iam/product-integrations/container-registry-auth/enable-iam-auth
description: Attach a container.registry policy, mint short-lived Docker credentials, and log in to Vultr Container Registry.
publish_date: 2026-10-14T13:46:16.172100Z
last_updated: 2026-10-23T20:36:31.160745Z
---

> Index of every Vultr Docs page in markdown: https://docs.vultr.com/llms.txt

# How to Enable IAM Authentication for Vultr Container Registry

Vultr Container Registry integrates with IAM, so registry access follows least-privilege policies instead of account-wide API keys. To enable it, attach a policy with `container.registry.*` actions to a user, group, or service user. That identity can then mint short-lived Docker credentials whose scope matches its effective IAM permissions.

> [!NOTE]
> Before enabling IAM authentication for Vultr Container Registry, you must have an IAM organization and a container registry provisioned. See [How to Provision Vultr Container Registry](https://docs.vultr.com/products/orchestration/container-registry/provisioning).

Follow this guide to enable IAM authentication for a registry and log in to it with Docker using the Vultr API.

## Grant Registry Permissions

Attach a policy to the identity that defines what it can do on the registry.

1. Create a policy that grants the `GetCredentials` capability on `*` and the required registry actions on the target registry. The following example lets an identity pull and push to a single registry. Replace `REGISTRY_ID` with your registry's ID.

    ```json
    {
      "Version": "2012-10-17",
      "Statement": [
        {
          "Effect": "Allow",
          "Action": ["container.registry.GetCredentials"],
          "Resource": ["*"]
        },
        {
          "Effect": "Allow",
          "Action": ["container.registry.Pull", "container.registry.Push"],
          "Resource": ["registry:REGISTRY_ID"]
        }
      ]
    }
    ```

    For a read-only CI runner, grant only `container.registry.Pull` and set `Resource` to `registry:*`.

1. Attach the policy to a user, group, or role using the Vultr Console or the IAM API endpoints. See [How to Create a Policy](https://docs.vultr.com/platform/iam/policies/how-to-create-a-policy) for details.

## Discover Grantable Credentials

Send a `GET` request to the credential endpoint to see which registries your effective IAM permissions allow you to mint credentials for.

```console
$ curl "https://api.vultr.com/v2/container-registry/docker-credentials" \
    -X GET \
    -H "Authorization: Bearer ${VULTR_API_KEY}"
```

> [!NOTE]
> Use the API key of the identity you are testing, not your own.

If you cannot mint credentials for any registry, the request returns `403`. Verify that your policy grants `container.registry.GetCredentials` and `Pull` or `Push` on the target registry.

## Mint IAM-Scoped Docker Credentials

Send a `POST` request to the credential endpoint to mint a new set of credentials. Replace `REGISTRY_ID` with your registry's ID. Set `read_write` to `true` for push and pull access, which requires `container.registry.Push` on the registry. Omit it for read-only credentials.

```console
$ curl "https://api.vultr.com/v2/container-registry/docker-credentials" \
    -X POST \
    -H "Authorization: Bearer ${VULTR_API_KEY}" \
    -H "Content-Type: application/json" \
    -d '{
        "registry": "REGISTRY_ID",
        "expiry_seconds": 3600,
        "read_write": true
    }' > creds.json
```

A successful request returns an HTTP `201 Created` response containing a Docker-compatible `auths` map keyed by registry host, along with `minted` and `errors`.

## Log In with Docker

Use the minted credentials to authenticate Docker against the registry.

1. Extract the `auth` value for your registry host from `creds.json`. Replace `REGISTRY_HOST` with your registry host.

    ```console
    $ AUTH=$(jq -r '.auths["REGISTRY_HOST"].auth' creds.json)
    ```

1. Decode the value.

    ```console
    $ LOGIN=$(echo "$AUTH" | base64 -d)
    ```

1. Log in to the registry. Replace `REGISTRY_HOST` with the same registry host. Passing the password over `stdin` keeps it out of your shell history.

    ```console
    $ echo "${LOGIN#*:}" | docker login REGISTRY_HOST -u "${LOGIN%%:*}" --password-stdin
    ```

    A successful login returns `Login Succeeded`. You can now pull images from the registry and push images if you have minted read/write credentials. Alternatively, merge the returned `auths` map directly into `~/.docker/config.json`.
