Updated on 2026-09-20 GMT+08:00

Creating an Image Snapshot

Before you run a container, the container image needs to be pulled. However, image pull is time-consuming due to factors such as the network status and container image size. To speed up the container startup, CCI allows you to create snapshots for the required images and then use the snapshots to create pods. In this way, image pull is not required, and the container startup time is significantly reduced. This section describes how to create an image snapshot manually. For details about how image snapshots work, see Image Snapshot Overview.

Creating an Image Snapshot Using the Console

  1. Log in to the CCI 2.0 console.
  2. In the navigation pane, choose Image Acceleration.
  3. In the upper right corner, click Create Image Snapshot.
  4. On the page that is displayed, configure the parameters. For details about the parameters, see Table 1. After the configuration is complete, click Create Image Snapshot in the lower right corner.
    Table 1 Parameters for creating an image snapshot

    Parameter

    Description

    Image Snapshot Name

    Enter a custom name for the image snapshot.

    NOTE:

    You can enter 1 to 190 characters. Start with a lowercase letter and end with a digit or lowercase letter. Only lowercase letters, digits, and hyphens (-) are allowed.

    Images

    Select the images used to create an image snapshot. Up to 10 images can be added.

    Image Snapshot Size

    Specify the image snapshot size, ranging from 10 to 400 GiB. Decompressed images are stored as cached objects, and actual space usage depends on the image compression ratio. The snapshot size should be at least three times the image size.

    Image Snapshot Retention Period

    Set the retention period of the image snapshot. Expired image snapshots will be deleted. If this parameter is set to Not limited, the image snapshot is retained permanently. You can also specify the number of retention days.

    Namespace

    Select a namespace for the image snapshot. During image snapshot creation, a pod will be created in this namespace.

    Use EIP to Cache Public Images

    Determine whether to automatically assign an EIP to the pod that is used for creating the image snapshot. Configure this parameter based on site requirements.

    • Assign new: An automatically-assigned EIP will be used to cache public images. You can specify the line, bandwidth billing option, and bandwidth capacity. After an image snapshot is created, the EIP will be automatically released.
    • Use existing: An existing EIP will be used to cache public images.
    • Not required: No EIP will be used to cache public images.

    Image Repository Access Credential

    Add an image repository access credential. Each image repository must be configured with a kubernetes.io/dockerconfigjson secret. A maximum of 10 credentials can be added.

Creating an Image Snapshot Using YAML

  1. Log in to the CCI 2.0 console.
  2. In the navigation pane, choose Image Acceleration.
  3. Click Create from YAML in the upper right corner.

    In the following example, an image snapshot named my-imagesnapshot will be created.

    apiVersion: cci/v2
    kind: ImageSnapshot
    metadata:
      name: 'my-imagesnapshot'
      labels: 
        cci.io/image-snapshot-architecture: "amd64"    # Specifies the CPU architecture.
    spec:
      buildingConfig:
        namespace: test
        eipID: 3cxxxxe0-xxxx-xxxx-xxxx-8xxxxf3xxxx4     # EIP ID required for pulling public or cross-VPC images
      imageSnapshotSize: 30                             # Snapshot capacity (GiB)
      ttlDaysAfterCreated: 7                            # Snapshot lifecycle in days. Expired snapshots are automatically deleted.
      images:
        # For non-Docker Hub official repositories, enter the full address in the format of domain/organization/image-name:tag.
        - image: 'swr.region.myhuaweicloud.com/your-organization/your-image:latest'
      registries:
        - imagePullSecret: imagepull-secret             # Secret for accessing private SWR repositories
          server: swr.region.myhuaweicloud.com   # Image repository address (omit the http:// or https:// prefix)
          plainHTTP: true
    Table 2 Parameter description

    Field

    Type

    Mandatory

    Example Value

    Description

    .metadata.name

    String

    Yes

    my-imagesnapshot

    Image snapshot name.

    .spec.images.image

    String

    Yes

    nginx:latest

    Image used to create an image snapshot. A maximum of 10 images can be added.

    .spec.registries.server

    String

    Yes

    xxxxx.myhuaweicloud.com

    Image repository address without the http:// or https:// prefix.

    .spec.registries.imagePullSecret

    String

    No

    imagepull-secret

    Secret for accessing the image repository. A maximum of 10 credentials can be added.

    .spec.registries.plainHTTP

    Boolean

    No

    true

    If the self-managed image repository address uses the HTTP protocol, set the value to true, or the image fails to be pulled due to different protocols. The default value is false.

    .spec.registries.insecureSkipVerify

    Boolean

    No

    true

    If the self-managed image repository address uses a self-issued certificate, set the value to true to skip certificate authentication, or the image fails to be pulled due to a certificate authentication failure. The default value is false.

    .spec.buildingConfig.namespace

    String

    Yes

    test

    Namespace. During image snapshot creation, a pod will be created in this namespace.

    .spec.buildingConfig.eipID

    String

    No

    3cxxxxe0-xxxx-xxxx-xxxx-8xxxxf3xxxx4

    EIP used for pulling images over the public network

    .spec.buildingConfig.autoCreateEIP

    Boolean

    No

    true

    Whether to automatically assign an EIP for the pod that is used for creating the image snapshot. If eipId is specified, autoCreateEIP is ignored. If autoCreateEIP is set to true, you need to specify the EIP configuration using autoCreateEIPAttribute.

    .spec.buildingConfig.autoCreateEIPAttribute.bandwidthChargeMode

    String

    No

    bandwidth

    Whether the bandwidth is billed by traffic or bandwidth.

    The value can be traffic or bandwidth. If this parameter is left blank or is an empty string, default value bandwidth is used. For IPv6 addresses, the default parameter value is bandwidth outside China and traffic in China.

    .spec.buildingConfig.autoCreateEIPAttribute.bandwidthSize

    Integer

    No

    1000

    Bandwidth.

    If billing by bandwidth is selected, the value ranges from 1 Mbit/s to 2,000 Mbit/s by default. If billing by traffic is selected, the value ranges from 1 Mbit/s to 300 Mbit/s by default.

    .spec.buildingConfig.autoCreateEIPAttribute.type

    String

    No

    5_bgp

    EIP type.

    The value can be 5_bgp (dynamic BGP), 5_sbgp (static BGP), or 5_youxuanbgp (premium BGP).

    .spec.buildingConfig.autoCreateEIPAttribute.ipVersion

    Integer

    No

    4

    EIP version.

    4 indicates IPv4 EIP. If this parameter is left blank or is an empty string, an IPv4 EIP is assigned by default.

    .spec.buildingConfig.TimeoutMinutes

    Integer

    No

    1440

    Timeout interval for creating a snapshot, in minutes.

    The value is an integer from 30 (30 minutes) to 10080 (one week). The default value is 1440, indicating one day.

    .spec.ttlDaysAfterCreated

    Integer

    No

    7

    Retention period of the image snapshot, in days. Expired image snapshots will be deleted. The default value is 0, indicating that the snapshot never expires.

    When an image snapshot is used by a workload or pod, this image snapshot remains valid from the time when it was used by the workload or pod until the configured retention period ends.

    NOTE:

    After an image snapshot expires, it still occupies the quota. You need to periodically review and delete expired image snapshots.

    .spec.imageSnapshotSize

    Integer

    No

    30

    Image snapshot size, in GiB. The default value is 20.

    In addition to basic parameters, you can add labels to specify the CPU architecture used for creating an image snapshot. For details about the label, see Table 3.

    Table 3 Label description

    Field

    Type

    Mandatory

    Example Value

    Description

    .labels.cci.io/image-snapshot-architecture

    String

    No

    amd64

    CPU architecture of the image. The options are as follows:

    • amd64 (default value)
    NOTE:

    When specifying the architecture, check whether the pod type is available at the site.

    • amd64: x86 general computing pods