How to Generate Docker Credentials for Vultr Container Registry

Updated on November 27, 2024

Generating Docker Credentials for Vultr Container Registry provides secure access for pushing and pulling images. These credentials are essential for authenticating and interacting with the container registry, ensuring seamless integration with Docker and Kubernetes. For Kubernetes, these credentials enable pods to authenticate and interact with the registry, facilitating the deployment of containerized applications.

Follow this guide to generate Docker credentials for your container registry on your Vultr account using the Vultr Customer Portal, API, or CLI.

  • Vultr Customer Portal
  • Vultr API
  • Vultr CLI
  1. Navigate to Products and click Container Registry.

    Container Registry in the products menu

  2. Click your target registry to open its management page.

    Selection of a target container registry

  3. Click Docker/Kubernetes.

    Button to open the Docker/Kubernetes page

  4. In the Docker Credentials section, provide a time duration for which the docker credentials are valid.

    Field to provide the Docker credentials duration

  5. Check the Push Access box to allow push privileges for these particular credentials.

    Checkbox to enable the push access for the Docker credentials

  6. Click Generate Docker Config Json to generate credentials in JSON format.

    Button to generate Docker credentials in JSON format

  7. In the Docker Credentials for Kubernetes section, provide a time duration for which the credentials are valid.

    Field to provide the Docker credentials for Kubernetes duration

  8. Check the Push Access box to allow push privileges for these particular credentials.

    Checkbox to enable the push access for the Docker credentials for Kubernetes

  9. Click Generate Kubernetes YAML to generate a Kubernetes YAML file.

    Button to generate a Kubernetes YAML file

  1. Send a GET request to the List Registries endpoint and note the target registry's ID.

    console
    $ curl "https://api.vultr.com/v2/registries" \
        -X GET \
        -H "Authorization: Bearer ${VULTR_API_KEY}"
    
  2. Send an OPTIONS request to the Create Registry Docker Credentials endpoint and note the generated credentials.

    console
    $ curl "https://api.vultr.com/v2/registry/<registry-id>/docker-credentials?expiry_seconds=3600&read_write=true" \
        -X OPTIONS \
        -H "Authorization: Bearer ${VULTR_API_KEY}" \
        -H "Content-Type: application/json"
    
  3. Send an OPTIONS request to the Create Registry Kubernetes Docker Credentials endpoint and note the generated YAML.

    console
    $ curl "https://api.vultr.com/v2/registry/<registry-id>/docker-credentials/kubernetes?expiry_seconds=3600&read_write=true&base64_encode=false" \
        -X OPTIONS \
        -H "Authorization: Bearer ${VULTR_API_KEY}" \
        -H "Content-Type: application/json"
    
  1. List all registries available in your Vultr account and note the target registry's ID.

    console
    $ vultr-cli container-registry list
    
  2. Generate Docker credentials for the target registry.

    console
    $ vultr-cli container-registry credentials docker <registry-id> --expiry-seconds 3600 --read-write true