Creates an image cache.

Description

Version: 2018-08-08

SDK version: Java 1.0.10 or later and Python 1.0.7 or later

Limits

1. A maximum of 20 image caches can be created under each account. You need to delete the caches that you no longer use in time. By default, the cache that fails to be created can only be retained for one day.

2. You need to estimate the total size of images to be cached. If the total size exceeds the specified cache size, the image cache will fail to be created.

3. Each time you create an image cache, a container group will be created automatically. After the image cache is created, the container group must be deleted in time to stop being billed. You must keep the group when you create an image cache. Otherwise, the cache will fail to be created.

4. To stop creating the image cache when certain image issues occur, delete the image caches returned. You can also stop creating the image cache by deleting the corresponding container group job. However, it is not a recommended method.

Note: Each image cache corresponds to one snapshot. Keep the snapshot for an image cache. If you delete the snapshot, the image cache cannot work properly.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String No CreateImageCache

The operation that you want to perform. Set the value to CreateImageCache.

RegionId String Yes cn-hangzhou

The region ID of the image cache. Specify the same region as the container group.

ImageCacheName String Yes test-cache

The name of the image cache.

Image.N RepeatList Yes registry-vpc.cn-beijing.aliyuncs.com/eci_open/busybox:1.3

The images to be cached.

SecurityGroupId String Yes sg-uf66jeqopgqa9hdn2***

The ID of the security group. You do not need to specify the same security group as the container group.

VSwitchId String Yes vsw-uf6h3rbwbm90urjwav***

The ID of the VSwitch. You do not need to specify the same VSwitch as the container group.

ZoneId String No cn-hangzhou-g N/A
ImageRegistryCredential.N.Server String No registry-vpc.cn-shanghai.aliyuncs.com

The image repository address without the http:// or https:// prefix.

ImageRegistryCredential.N.UserName String No username

The username used to log on to the image repository.

ImageRegistryCredential.N.Password String No password

The password used to log on to the image repository.

EipInstanceId String No eip-xxx

The instance ID of the Elastic IP Address (EIP). If you want to pull images from the Internet, you must specify an EIP to make sure that the container group can access the Internet. You can also configure the network address translation (NAT) gateway. We recommend that you configure the NAT gateway for the Internet access.

ImageCacheSize Integer No 15

The size of the image cache. Default value: 20. Unit: GiB.

RetentionDays Integer No 7

The retention days of the image cache. Once the image cache expires, it will be cleared. By default, the image cache never expires. Note: The image cache that fails to be created is retained for only one day.

ResourceGroupId String No rg-aekzh43v*****

The ID of the resource group.

ClientToken String No 123e4567-xxx-xxx-xxxx-42665544xxxx

The client token that is used to guarantee the idempotence of the request. You can use the client to generate the value, but you must make sure that the value is unique among different requests. The token can only contain ASCII characters and cannot exceed 64 characters in length. For more information, see How to ensure idempotence

Response parameters

Parameter Type Example Description
RequestId String FC5F8BF8-4546-4E42-B156-881DB1607FFC

The unique ID of the request.

ImageCacheId String imc-2zebxkiifuyzzlhl1***

The ID of the image cache.

ContainerGroupId String eci-2zebxkiifuyzzlhl1***

The ID of the container group job that is used to create the image cache.

Examples

Sample requests

http(s)://eci.aliyuncs.com/? Action=CreateImageCache
&RegionId=cn-hangzhou
&ImageCacheName=test-cache
&Image.1=registry-vpc.cn-beijing.aliyuncs.com/eci_open/busybox:1.3
&SecurityGroupId=sg-uf66jeqopgqa9hdn2***
&VSwitchId=vsw-uf6h3rbwbm90urjwav***
&<Common request parameters>

Sample success responses

JSON format

{
    "ImageCacheId": "imc-2zebxkiifuyzzlhl1***",
    "RequestId": "FC5F8BF8-4546-4E42-B156-881DB1607FFC",
    "ContainerGroupId": "eci-2zebxkiifuyzzlhl1***"
}

XML format

<ImageCacheId>imc-2zebxkiifuyzzlhl1***</ImageCacheId>
<RequestId>FC5F8BF8-4546-4E42-B156-881DB1607FFC</RequestId>
<ContainerGroupId>eci-2zebxkiifuyzzlhl1***</ContainerGroupId>

Error codes

HTTP status code Error code Error message Description
400 Account.Arrearage Your account has an outstanding payment. The error message returned because your account has an overdue payment.
400 DryRunOperation Request validation has been passed with DryRun flag set. The error message returned because the specified dry run passed.
400 InvalidParameter.CPU.Memory The specified cpu and memory are not allowed The error message returned because the CPU and memory specifications are invalid.
403 OperationDenied.NoStock Sales of this resource are temporarily suspended in the specified region; please try again later. The error message returned because the specified resource is insufficient. Specify another resource, region, or zone.
403 OperationDenied.VswZoneMisMatch The specified VSwitchId is not in the specified Zone. The error message returned because the specified VSwitch is not deployed in the specified zone.
403 QuotaExceeded %s quota exceeded. The error message returned because the number of container groups that you have created has reached the upper limit.
403 Zone.NotOnSale The specified zone is not available for purchase. The error message returned because the specified zone is unavailable or the VSwitch of the specified Virtual Private Cloud (VPC) is unavailable in the specified zone. Specify another zone.
403 Forbidden.RiskControl This operation has been identified as an abnormal operation and cannot be processed. The error message returned because the operation has been identified as an anomaly and cannot be processed.
403 Forbidden.SubUser The specified action is not available for you. The error message returned because the current user cannot perform the specified operation.
403 Forbidden.OnlyForInvitedTest Eci create action is only open to invited users during public beta. The error message returned because ECI is only available to invited users during the public preview period.
400 IncorrectStatus %s The error message returned because the status of the specified container group is invalid.
403 OperationDenied.SecurityGroupMisMatch The specified VSwitchId and SecurityGroupId are not in the same VPC. The error message returned because the specified VSwitch and security group are not deployed in the same VPC.
403 InvalidVSwitchId.IpNotEnough The specified VSwitch does not have enough IP addresses. The error message returned because the VSwitch does not have sufficient IP addresses.
403 Forbidden.UserBussinessStatus This operation is not allowed, because you have overdue bills. Pay the overdue bill and try again. The error message returned because you have overdue payments. Settle the overdue payments and try again later.
403 Forbidden.UserNotRealNameAuthentication This operation is not allowed, because you have not passed the real-name verification. The error message returned because you have not completed real-name verification and the specified operation is not allowed.
400 ServiceNotEnabled %s The error message returned because the service required to call the operation is not activated. Activate the service and try again later.
400 DiskVolume.NotSupport The disk volume is not supported. The error message returned because the disk as a volume is not supported. If the problem persists, contact Alibaba Cloud customer service.
403 InvalidUser.PassRoleForbidden The RAM user is not authorized to assume a RAM role. The error message returned because RAM users do not have the permission to assume the RAM role.
400 RamRole.NotSupport The RAM role is not supported. The error message returned because the specified RAM role is not supported.
400 ImageCache.IncorrectStatus %s The error message returned because the status of the specified image cache is invalid.
400 ImageCacheNotSupport Image cache is not available for all users. If you want to enable this function, contact us. The error message returned because the image cache feature is not available to all users. If you need to use this feature, contact Alibaba Cloud customer service.
Note For more information about how to create a container group by using an image cache, see .Use image caches