Skip to content
Start here

Prepare a container image

containers.images.prepare(ImagePrepareParams**kwargs) -> ImagePrepareResponse
POST/accounts/{account_id}/containers/image-preparations

Idempotently starts or observes preparation of the runtime artifacts required to run one digest-pinned managed container image on Cloudflare’s network. Returns 202 while durable preparation continues and 200 when the image is ready or preparation has reached a terminal error.

Security
API Token

The preferred authorization scheme for interacting with the Cloudflare API. Create a token.

Example:Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY
API Email + API Key

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

Example:X-Auth-Email: user@example.com

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

Example:X-Auth-Key: 144c9defac04969c7bfad8efaa8ea194
ParametersExpand Collapse
account_id: str
image: str

Image url.

ReturnsExpand Collapse
class ImagePrepareResponse: …

Durable preparation state for a container image.

image: str

Image url.

status: Literal["pending", "ready", "error"]

Current durable preparation state for a container image.

One of the following:
"pending"
"ready"
"error"
artifact_digest: Optional[str]

Digest of the prepared runtime artifact when status is ready.

reason: Optional[str]

Human-readable pending or terminal error detail.

Prepare a container image

import os
from cloudflare import Cloudflare

client = Cloudflare(
    api_token=os.environ.get("CLOUDFLARE_API_TOKEN"),  # This is the default and can be omitted
)
response = client.containers.images.prepare(
    account_id="account-123",
    image="image",
)
print(response.image)
{
  "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": {
    "image": "image",
    "status": "pending",
    "artifact_digest": "artifact_digest",
    "reason": "reason"
  },
  "success": true
}
Returns Examples
{
  "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": {
    "image": "image",
    "status": "pending",
    "artifact_digest": "artifact_digest",
    "reason": "reason"
  },
  "success": true
}