---
title: Configure a private external image registry
---

[Skip to content](#_top)

[API Reference](https://developers.cloudflare.com/api/go)

[Containers](https://developers.cloudflare.com/api/go/resources/containers)

[Registries](https://developers.cloudflare.com/api/go/resources/containers/subresources/registries)

Copy Markdown

Open in **Claude**Open in **ChatGPT**Open in **Cursor**

---

**Copy Markdown****View as Markdown**

# Configure a private external image registry

client.Containers.Registries.New(ctx, params) (\*[RegistryNewResponse](<https://developers.cloudflare.com/api/go/resources/containers#(resource)%20containers.registries%20%3E%20(model)%20RegistryNewResponse%20%3E%20(schema)>), error)

POST/accounts/{account\_id}/containers/registries

Registers credentials for a supported private external image registry so Containers can pull images from it. This endpoint does not create a registry or upload an image. Public Docker Hub images and images in the Cloudflare managed registry do not require this configuration.

Refer to [Image management](https://developers.cloudflare.com/containers/platform-details/image-management/) for supported registries and instructions for storing registry credentials.

##### Security

<details>

<summary>API Token</summary>



The preferred authorization scheme for interacting with the Cloudflare API. <a href="https://developers.cloudflare.com/fundamentals/api/get-started/create-token/">Create a token</a>.

**Example:**<code>Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY</code>

</details>

<details>

<summary>API Email + API Key</summary>



The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.

**Example:**<code>X-Auth-Email: user@example.com</code>

The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.

**Example:**<code>X-Auth-Key: 144c9defac04969c7bfad8efaa8ea194</code>

</details>

##### Accepted Permissions (at least one required)

`Workers Containers Write`

##### ParametersExpand Collapse

<details>

<summary>

params RegistryNewParams

</summary>

AccountID param.Field\[string]

Path param: Account identifier.

<a href="#(resource)%20containers.registries%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20account_id">Link to this property</a>

<details>

<summary>

Auth param.Field\[<a href="https://developers.cloudflare.com/api/go/resources/containers/subresources/registries/methods/create#(resource)%20containers.registries%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20auth%20%3E%20(schema)">RegistryNewParamsAuth</a>]

Body param: Credentials for authenticating to a private external image registry. Store the private credential in <a href="https://developers.cloudflare.com/secrets-store/">Secrets Store</a> before calling the API. Refer to <a href="https://developers.cloudflare.com/containers/platform-details/image-management/">Image management</a> for the credential required by each supported registry provider.

</summary>

<details>

<summary>

PrivateCredential RegistryNewParamsAuthPrivateCredential

A reference to the private registry credential in Secrets Store. The referenced secret must have the <code>containers</code> scope. Raw secret values are not accepted.

</summary>

SecretName string

Name of the secret within the store.

maxLength255

minLength1

<a href="#(resource)%20containers.registries%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20auth%20%3E%20(schema)%20%3E%20(property)%20private_credential%20%3E%20(property)%20secret_name">Link to this property</a>

StoreID string

Identifier of the Secrets Store containing the secret.

maxLength32

minLength32

<a href="#(resource)%20containers.registries%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20auth%20%3E%20(schema)%20%3E%20(property)%20private_credential%20%3E%20(property)%20store_id">Link to this property</a>

</details>

<a href="#(resource)%20containers.registries%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20auth%20%3E%20(schema)%20%3E%20(property)%20private_credential">Link to this property</a>

PublicCredential string

The non-secret part of the registry credential: an AWS access key ID for ECR, a username for Docker Hub, or a service account email for Google Artifact Registry.

<a href="#(resource)%20containers.registries%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20auth%20%3E%20(schema)%20%3E%20(property)%20public_credential">Link to this property</a>

</details>

<a href="#(resource)%20containers.registries%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20auth">Link to this property</a>

Domain param.Field\[string]

Body param: Hostname of the private registry, without a scheme or image path. Supported hostnames are <code>docker.io</code>, AWS ECR hostnames, and Google Artifact Registry <code>*-docker.pkg.dev</code> hostnames.

<a href="#(resource)%20containers.registries%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20domain">Link to this property</a>

<details>

<summary>

Kind param.Field\[<a href="https://developers.cloudflare.com/api/go/resources/containers/subresources/registries/methods/create#(resource)%20containers.registries%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20kind%20%3E%20(schema)">RegistryNewParamsKind</a>]

Body param: Registry provider. This must match <code>domain</code>: <code>DockerHub</code> for <code>docker.io</code>, <code>ECR</code> for AWS ECR, or <code>GAR</code> for Google Artifact Registry.

</summary>

const RegistryNewParamsKindEcr <a href="https://developers.cloudflare.com/api/go/resources/containers/subresources/registries/methods/create#(resource)%20containers.registries%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20kind%20%3E%20(schema)">RegistryNewParamsKind</a> = "ECR"

<a href="#(resource)%20containers.registries%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20kind%20%3E%20(schema)%20%3E%20(member)%200">Link to this property</a>

const RegistryNewParamsKindDockerHub <a href="https://developers.cloudflare.com/api/go/resources/containers/subresources/registries/methods/create#(resource)%20containers.registries%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20kind%20%3E%20(schema)">RegistryNewParamsKind</a> = "DockerHub"

<a href="#(resource)%20containers.registries%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20kind%20%3E%20(schema)%20%3E%20(member)%201">Link to this property</a>

const RegistryNewParamsKindGar <a href="https://developers.cloudflare.com/api/go/resources/containers/subresources/registries/methods/create#(resource)%20containers.registries%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20kind%20%3E%20(schema)">RegistryNewParamsKind</a> = "GAR"

<a href="#(resource)%20containers.registries%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20kind%20%3E%20(schema)%20%3E%20(member)%202">Link to this property</a>

</details>

<a href="#(resource)%20containers.registries%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20kind">Link to this property</a>

<details>

<summary>

IsPublic param.Field\[<a href="https://developers.cloudflare.com/api/go/resources/containers/subresources/registries/methods/create#(resource)%20containers.registries%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20is_public%20%3E%20(schema)">RegistryNewParamsIsPublic</a>]Optional

Body param: Omit this field or set it to <code>false</code>. Public Docker Hub images do not require registry configuration and cannot be added with this endpoint.

</summary>

const RegistryNewParamsIsPublicFalse <a href="https://developers.cloudflare.com/api/go/resources/containers/subresources/registries/methods/create#(resource)%20containers.registries%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20is_public%20%3E%20(schema)">RegistryNewParamsIsPublic</a> = false

<a href="#(resource)%20containers.registries%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20is_public%20%3E%20(schema)%20%3E%20(member)%200">Link to this property</a>

</details>

<a href="#(resource)%20containers.registries%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20is_public">Link to this property</a>

</details>

[Link to this property](<#(resource)%20containers.registries%20%3E%20(method)%20create%20%3E%20(params)%20default>)

##### ReturnsExpand Collapse

<details>

<summary>

type RegistryNewResponse struct{…}

An image registry added in a customer account.

</summary>

CreatedAt string

UTC timestamp string in ISO 8601 format.

<a href="#(resource)%20containers.registries%20%3E%20(model)%20RegistryNewResponse%20%3E%20(schema)%20%3E%20(property)%20created_at">Link to this property</a>

Domain string

A string representation of a domain name. See RFC-1034 (<a href="https://www.ietf.org/rfc/rfc1034.txt">https://www.ietf.org/rfc/rfc1034.txt</a>). Consider that the limit of a domain name is min 3 and max 253 ASCII characters.

<a href="#(resource)%20containers.registries%20%3E%20(model)%20RegistryNewResponse%20%3E%20(schema)%20%3E%20(property)%20domain">Link to this property</a>

<details>

<summary>

Kind RegistryNewResponseKindOptional

The type of registry that is being configured.

</summary>

One of the following:

const RegistryNewResponseKindEcr RegistryNewResponseKind = "ECR"

<a href="#(resource)%20containers.registries%20%3E%20(model)%20RegistryNewResponse%20%3E%20(schema)%20%3E%20(property)%20kind%20%3E%20(member)%200">Link to this property</a>

const RegistryNewResponseKindDockerHub RegistryNewResponseKind = "DockerHub"

<a href="#(resource)%20containers.registries%20%3E%20(model)%20RegistryNewResponse%20%3E%20(schema)%20%3E%20(property)%20kind%20%3E%20(member)%201">Link to this property</a>

const RegistryNewResponseKindGar RegistryNewResponseKind = "GAR"

<a href="#(resource)%20containers.registries%20%3E%20(model)%20RegistryNewResponse%20%3E%20(schema)%20%3E%20(property)%20kind%20%3E%20(member)%202">Link to this property</a>

const RegistryNewResponseKindDefault RegistryNewResponseKind = "default"

<a href="#(resource)%20containers.registries%20%3E%20(model)%20RegistryNewResponse%20%3E%20(schema)%20%3E%20(property)%20kind%20%3E%20(member)%203">Link to this property</a>

</details>

<a href="#(resource)%20containers.registries%20%3E%20(model)%20RegistryNewResponse%20%3E%20(schema)%20%3E%20(property)%20kind">Link to this property</a>

PublicKey stringOptional

Public component of the registry credentials. For managed registries this is a base64-encoded public key; for external registries the format depends on the registry provider.

<a href="#(resource)%20containers.registries%20%3E%20(model)%20RegistryNewResponse%20%3E%20(schema)%20%3E%20(property)%20public_key">Link to this property</a>

</details>

[Link to this property](<#(resource)%20containers.registries%20%3E%20(model)%20RegistryNewResponse%20%3E%20(schema)>)

### Configure a private external image registry

Go

HTTPTypeScriptPythonGoTerraform

```
package main

import (
  "context"
  "fmt"

  "github.com/cloudflare/cloudflare-go"
  "github.com/cloudflare/cloudflare-go/containers"
  "github.com/cloudflare/cloudflare-go/option"
)

func main() {
  client := cloudflare.NewClient(
    option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
  )
  registry, err := client.Containers.Registries.New(context.TODO(), containers.RegistryNewParams{
    AccountID: cloudflare.F("account-123"),
    Auth: cloudflare.F(containers.RegistryNewParamsAuth{
      PrivateCredential: cloudflare.F(containers.RegistryNewParamsAuthPrivateCredential{
        SecretName: cloudflare.F("API_KEY"),
        StoreID: cloudflare.F("14758f1afd44c09b7992073ccf00b43d"),
      }),
      PublicCredential: cloudflare.F("example-user"),
    }),
    Domain: cloudflare.F("docker.io"),
    Kind: cloudflare.F(containers.RegistryNewParamsKindEcr),
  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", registry.CreatedAt)
}
```

200 example

```
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "result": {
    "created_at": "2021-04-01T12:32:41.488Z",
    "domain": "docker.io",
    "kind": "ECR",
    "public_key": "public_key"
  },
  "success": true
}
```

##### Returns Examples

200 example

```
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "result": {
    "created_at": "2021-04-01T12:32:41.488Z",
    "domain": "docker.io",
    "kind": "ECR",
    "public_key": "public_key"
  },
  "success": true
}
```