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

[Skip to content](#_top)

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

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

[Registries](https://developers.cloudflare.com/api/python/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

containers.registries.create(RegistryCreateParams\*\*kwargs) -> [RegistryCreateResponse](<https://developers.cloudflare.com/api/python/resources/containers#(resource)%20containers.registries%20%3E%20(model)%20registry_create_response%20%3E%20(schema)>)

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

account\_id: str

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

<details>

<summary>

auth: <a href="https://developers.cloudflare.com/api/python/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)">Auth</a>

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>

private\_credential: AuthPrivateCredential

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>

secret\_name: str

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>

store\_id: str

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>

public\_credential: str

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>

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

domain: str

Hostname of the private registry, without a scheme or image path. Supported hostnames are `docker.io`, AWS ECR hostnames, and Google Artifact Registry `*-docker.pkg.dev` hostnames.

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

<details>

<summary>

kind: Literal\["ECR", "DockerHub", "GAR"]

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>

One of the following:

"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>

"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>

"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>

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

is\_public: Optional\[Literal\[false]]

Omit this field or set it to `false`. Public Docker Hub images do not require registry configuration and cannot be added with this endpoint.

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

##### ReturnsExpand Collapse

<details>

<summary>

class RegistryCreateResponse: …

An image registry added in a customer account.

</summary>

created\_at: str

UTC timestamp string in ISO 8601 format.

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

domain: str

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)%20registry_create_response%20%3E%20(schema)%20%3E%20(property)%20domain">Link to this property</a>

<details>

<summary>

kind: Optional\[Literal\["ECR", "DockerHub", "GAR", "default"]]

The type of registry that is being configured.

</summary>

One of the following:

"ECR"

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

"DockerHub"

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

"GAR"

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

"default"

<a href="#(resource)%20containers.registries%20%3E%20(model)%20registry_create_response%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)%20registry_create_response%20%3E%20(schema)%20%3E%20(property)%20kind">Link to this property</a>

public\_key: Optional\[str]

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)%20registry_create_response%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)%20registry_create_response%20%3E%20(schema)>)

### Configure a private external image registry

Python

HTTPTypeScriptPythonGoTerraform

```
import os
from cloudflare import Cloudflare

client = Cloudflare(
    api_token=os.environ.get("CLOUDFLARE_API_TOKEN"),  # This is the default and can be omitted
)
registry = client.containers.registries.create(
    account_id="account-123",
    auth={
        "private_credential": {
            "secret_name": "API_KEY",
            "store_id": "14758f1afd44c09b7992073ccf00b43d",
        },
        "public_credential": "example-user",
    },
    domain="docker.io",
    kind="ECR",
)
print(registry.created_at)
```

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
}
```