When you create an ECI instance with automatic image cache matching enabled, the system automatically matches and uses the optimal image cache. This avoids or reduces image layer downloads and accelerates instance creation. This topic describes how to enable automatic image cache matching to create ECI instances faster.
Background
The image cache feature accelerates instance creation. When automatic image cache matching is enabled, a matching image cache accelerates ECI instance creation. If no perfect match is found, the system automatically creates an image cache. This cache is created at no cost and can be used for subsequent ECI instances that use the same image. For more information, see Image cache overview.
Prerequisites
ECI and Resource Access Management (RAM) are activated. Your RAM role is granted the required permissions.
NoteIf you create an ECI instance as a RAM user, you must grant the required permissions to the RAM user. For more information, see Grant permissions to a RAM user.
vSwitches and a VPC are created in the region where you want to create an ECI instance.
For information about the regions and zones where ECI is available, see Regions and zones.
For information about how to create a VPC and vSwitch, see Create and manage a VPC and Create and manage a vSwitch.
NoteWe recommend creating multiple vSwitches. This way, you can select multiple vSwitches to implement the multi-zone feature when you create an ECI instance. This improves the success rate of instance creation.
A security group is created. For more information, see Create a security group.
Security groups serve as virtual firewalls that provide Stateful Packet Inspection (SPI) and packet filtering capabilities to isolate security domains on the cloud. Each ECI instance must belong to a security group. For more information, see Assign a security group to an ECI instance.
Procedure
These steps describe the key configurations for creating an ECI instance with automatic image cache matching enabled. This procedure uses default or minimum values for some settings.
-
Log on to the Elastic Container Instance console.
-
On the Image Cache page, review your existing image caches.
NoteImage caches can be created in two ways: manually or automatically.
-
Manual creation: Use this method when you need to accelerate the creation of the very first ECI instance. For instructions, see Create an image cache.
-
Automatic creation: The system automatically creates an image cache if automatic image cache matching is enabled and no exact match is found.
The image cache list includes columns such as Image Cache ID/Name, Tag, Status, and Image Information. When the Status column shows Created, the image cache has been successfully created and is ready for use.
-
-
Navigate to the Container Group page and click Create Elastic Container Group.
-
Configure the basic information of the instance.
-
Specify the billing method and type of the instance.
Use the default settings. The billing method is pay-as-you-go, and the instance type is regular instance.
Select the region in which you want to create the ECI instance.
Select a VPC and a vSwitch.
We recommend that you select multiple vSwitches to implement the multi-zone feature. The system preferentially creates the instance in a zone where inventory resources are sufficient.
-
Select a security group. Security group rules allow or deny access for ECI instances to the public internet or within the VPC, and control access between IP addresses.
NoteIf you want to access ECI instances in a VPC over the Internet, you must enable corresponding ports in the security group to which the ECI instances belong. For more information, see Add a security group rule.
-
-
Configure the container group.
Specify specifications for the container group.
In this example, the instance is created by using vCPU and memory specifications. This creation mode provides better elasticity and resource provisioning capabilities. If your business requires special specifications, such as GPU-accelerated instances, you can specify corresponding Elastic Compute Service (ECS) instance types. For more information, see Specify ECS instance types to create an ECI instance.
Enter a name for the container group.
-
Click Advanced Settings and confirm that Automatic Image Cache Matching is selected.
Set the Quantity parameter.
If you purchase multiple container groups, a sequential suffix is automatically appended to the name of each container group. For example, if you set Name to test and Quantity to 3, the names of your container groups are test001, test002, and test003.
-
Configure the container.
-
Enter a name for the container.
-
Select an image and the corresponding image tag.
If the selected image and tag match an existing image cache, the system uses that cache automatically.
-
-
Click Confirm Configuration.
-
Confirm the instance configuration, read and select the terms of service, and then click Confirm Order.
After the instance is created, you can view it on the Container Group page. Click the instance ID to view its details.
Verify results
Click the instance ID to view its details. On the Events tab, you can check the image cache matching status.
-
If a matching image cache was found, you will notice that the instance was created very quickly.
On the Events tab of the container group, the event log shows that the instance is created with specifications of
2.0 vCPU and 4.0 GiB, successfully matches an image cache (ID: imc-xxx), skips the image pull, and starts the containercontainer-1. This process takes about 20 seconds, and all related events are of the Normal type. -
If no exact match is found, the system automatically creates an image cache, which you can view on the Image Cache page.
The name of an automatically created image cache starts with
auto-create-for-eci-, and its initial status is Preparing (0%).NoteIf the matched image cache does not exactly match the required ECI instance specifications, the system still automatically creates a new image cache.