For the complete documentation index, see llms.txt. This page is also available as Markdown.

Container registries

Create a Secret for securing container registry (Docker) credentials used to pull private images

Use this Secret when a Workflow, Service, Worker, or App needs to pull a container image from a private registry (for example, Docker Hub, AWS ECR, GCP Artifact Registry, or a self-hosted registry). The Secret stores the registry authentication in the same format as a Docker config.json, and is referenced by name from the consuming Resource's imagePullSecret field.

Prerequisites

To create a Secret for securing container registry credentials, you need the following information from your registry.

Source system requirements

  • Registry server: the registry hostname (for example, https://index.docker.io/v1/ for Docker Hub, or <account>.dkr.ecr.<region>.amazonaws.com for AWS ECR).

  • Username and Password (or token): credentials DataOS uses to authenticate with the registry.

  • auth: base64 encoding of username:password. Most registries read this field first, so leaving it empty can cause the pull to fail even if username/password are filled in.

Get these credentials from the registry provider's account settings, or from an administrator.

For AWS ECR, the password is a short-lived token from aws ecr get-login-password. Since it expires (typically in 12 hours), the Secret needs to be refreshed and re-applied periodically, or image pulls will start failing again once the token expires.

Create a Secret to secure container registry credentials

Step 1: Create a manifest file

Create a manifest file with the configuration details for your container registry Secret.

name: ${{secret-name}}
version: v2alpha
type: secret
tags:
  - ${{tag-1}}
  - ${{tag-2}}
description: ${{secret-description}}
owner: ${{owner-id}}
secret:
  type: image-pull
  data:
    .dockerconfigjson: |
      {
        "auths": {
          "${{registry-server}}": {
            "auth": "${{base64-of-username:password}}",
            "username": "${{username}}",
            "password": "${{password}}"
          }
        }
      }

secret.data must contain exactly one key, .dockerconfigjson, holding the Docker config.json auth block as a YAML block scalar (|). DataOS base64-encodes this value automatically when the manifest is applied. Do not base64-encode it yourself in the manifest.

For more information about each attribute, refer to the configurations section.

Step 2: Apply the manifest

Use the apply command to create the container registry Secret in DataOS.

Example usage:

Step 3: Validate the Secret

Use the get command to verify the Secret in DataOS.

Expected output:

Consume the Secret

Reference the Secret by name from spec.service.imagePullSecret in the Resource that needs to pull the private image (for example, an App):

See Deploy a data application for the full App manifest.

Delete the Secret

To delete the container registry Secret, use one of the following commands:

Example usage:

Last updated

Was this helpful?