All Products
Search
Document Center

Use the image cache feature to accelerate the creation of an elastic container instance

Last Updated: Dec 21, 2021

When you create an elastic container instance, you can use the image cache feature to accelerate image pulling 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

When you use the image cache feature to create an elastic container instance, one of the following methods can be used:

  • Automatically match image caches

    The system automatically matches the most suitable image cache based on the match policies. Then, the system uses the image cache 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 the image cache that is used to create the elastic container instance

    You can specify an image cache and then use it to create the elastic container instance. The image cache must be in the Ready state.

For more information, see Overview of the image cache feature.

Automatically match image caches

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

When you call the CreateContainerGroup 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 Elastic Container Group page, click Create an elastic container group.

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

    In the Container Group Configuration section, click Advanced configuration and then 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. Image cache 2

  3. Click Configuration confirmation and complete the subsequent operations as prompted.

Specify an image cache

When you call the CreateContainerGroup operation to create an elastic container instance, you can use the ImageSnapshotId parameter to specify the 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 operation in OpenAPI Explorer to create an elastic container instance. You cannot specify an image cache if you use the Elastic Container Instance console to create an elastic container instance.

Parameter

Type

Example

Description

ImageSnapshotId

String

imc-2zebxkiifuyzzlhl****

Specifies the ID of the image cache.

View the created elastic container instance

In the Elastic Container Instance console, click Container Group in the left-side navigation pane to go to the Elastic Container Group page. Find the elastic container instance created from your image cache and click the instance ID to go to the details page. On the Event tab, you can find that an image cache was matched when the elastic container instance was created. Images were pulled nearly instantaneously.

Image cache 1