All Products
Search
Document Center

Elastic Container Instance:Use image caches to accelerate the creation of an elastic container instance

Last Updated:Mar 04, 2024

When you create an elastic container instance, you can use the image cache feature to accelerate image pulls and reduce the startup time of the elastic container instance. This topic describes how to use the image cache feature to accelerate the creation of an elastic container instance.

Background information

You can choose one of the following modes to use the image cache feature when you create an elastic container instance:

  • Enable automatic match of image caches

    The system automatically matches the most suitable image cache based on the match policy to create the elastic container instance. If no image cache is matched, the system automatically creates an image cache when the system creates the elastic container instance.

  • Specify an image cache that is used to create the instance

    You can specify an image cache that is used to create the elastic container instance. The image cache must be in the Ready state.

For more information, see Overview of image caches.

Enable automatic match of image caches

Create an elastic container instance by calling an API operation in OpenAPI Explorer

When you call the CreateContainerGroup API operation in OpenAPI Explorer to create an elastic container instance, you can use the AutoMatchImageCache parameter to enable automatic match of image caches. The following table describes the parameter. For more information, see CreateContainerGroup.

Parameter

Type

Example

Description

AutoMatchImageCache

Boolean

true

Specifies whether to enable automatic match of image caches.

Create an elastic container instance by using the Elastic Container Instance console

  1. In the left-side navigation pane of the Elastic Container Instance console, click Container Group. On the Container Group page, click Create Container Group.

  2. In the "Basic Settings" step of the instance creation wizard, configure parameters.

    In the Container Group Configurations section, you can click Advanced Settings and select Automatically Match Image Cache. Then, the system automatically matches the most suitable image cache and uses it to create the elastic container instance. If no image cache is matched, the system automatically creates an image cache.

    自动匹配imc

  3. Click Confirm Configuration and follow the on-screen instructions to complete the subsequent operations.

Specify an image cache

If you call the CreateContainerGroup API operation to create an elastic container instance, you can use the ImageSnapshotId parameter to specify an image cache. The following table describes the parameter. For more information, see CreateContainerGroup.

Note

You can specify an image cache only if you call the CreateContainerGroup API operation in OpenAPI Explorer to create an elastic container instance. You cannot specify an image cache if you create an instance by using the Elastic Container Instance console.

Parameter

Type

Example

Description

ImageSnapshotId

String

imc-2zebxkiifuyzzlhl****

Specifies the ID of the image cache.

View the result

On the Container Group page of the Elastic Container Instance console, find the elastic container instance that you created by using an image cache and click the instance ID to go to the details page. On the Events tab, you can find that an image cache was matched when the elastic container instance was created. The system nearly instantaneously pulled the image and the instance started up within seconds.

镜像缓存1