All Products
Search
Document Center

Elastic Container Instance:CreateImageCache

Last Updated:Jun 10, 2026

Anda dapat memanggil operasi CreateImageCache untuk membuat cache gambar. Hal ini mempercepat penarikan gambar dan mengurangi pengatur waktu mulai untuk instans Elastic Container Instance (ECI).

Deskripsi operasi

Precautions

  • Creating an image cache incurs fees. Review the billing information before you proceed. For more information, see Image cache billing.

  • Before you create an image cache, evaluate the total size of the images to be cached. If the total image size exceeds the cache size, the creation fails.

  • When you create an image cache, the system automatically creates an ECI instance and an Enhanced SSD (ESSD) PL1 disk. Do not delete the ECI instance or the disk during the creation process. Otherwise, the image cache cannot be created.

  • When you create an image cache, a corresponding snapshot is generated. Do not delete the snapshot. Otherwise, the image cache becomes invalid.

  • If you use a software development kit (SDK), make sure that you use one of the following versions or a later version: Java 1.0.10 or Python 1.0.7.

Usage suggestions

  • To enable password-free access for images from an ACR Enterprise instance that uses a custom domain name, set the AcrRegistryInfo parameters. When you set the AcrRegistryInfo parameters, you must also set the AcrRegistryInfo.N.InstanceId parameter.

  • If the image cache is used to create more than 1,000 ECI instances in a batch, set the StandardCopyCount and FlashCopyCount parameters to create multiple snapshot replicas. Multiple snapshot replicas are billed based on the incremental data size. Because the data in the snapshot replicas is the same, no additional fees are incurred.

Catatan

When you call the CreateImageCache operation, the system automatically creates the service-linked role AliyunServiceRoleForECI. This role is used to access other Alibaba Cloud services such as ECS and VPC. For more information, see Service-linked role for Elastic Container Instance.

Coba sekarang

Coba API ini di OpenAPI Explorer tanpa perlu penandatanganan manual. Panggilan yang berhasil akan secara otomatis menghasilkan contoh kode SDK sesuai dengan parameter Anda. Unduh kode tersebut dengan kredensial bawaan yang aman untuk penggunaan lokal.

Test

RAM authorization

Tabel berikut menjelaskan otorisasi yang diperlukan untuk memanggil API ini. Anda dapat menentukannya dalam kebijakan Resource Access Management (RAM). Kolom pada tabel dijelaskan sebagai berikut:

  • Action: Aksi yang dapat digunakan dalam elemen Action pada pernyataan kebijakan izin RAM untuk memberikan izin guna melakukan operasi tersebut.

  • API: API yang dapat Anda panggil untuk melakukan aksi tersebut.

  • Access level: Tingkat akses yang telah ditentukan untuk setiap API. Nilai yang valid: create, list, get, update, dan delete.

  • Resource type: Jenis resource yang mendukung otorisasi untuk melakukan aksi tersebut. Ini menunjukkan apakah aksi tersebut mendukung izin tingkat resource. Resource yang ditentukan harus kompatibel dengan aksi tersebut. Jika tidak, kebijakan tersebut tidak akan berlaku.

    • Untuk API dengan izin tingkat resource, jenis resource yang diperlukan ditandai dengan tanda bintang (*). Tentukan Nama Sumber Daya Alibaba Cloud (ARN) yang sesuai dalam elemen Resource pada kebijakan.

    • Untuk API tanpa izin tingkat resource, ditampilkan sebagai All Resources. Gunakan tanda bintang (*) dalam elemen Resource pada kebijakan.

  • Condition key: Kunci kondisi yang didefinisikan oleh layanan. Kunci ini memungkinkan kontrol granular, berlaku baik hanya untuk aksi maupun untuk aksi yang terkait dengan resource tertentu. Selain kunci kondisi spesifik layanan, Alibaba Cloud menyediakan serangkaian common condition keys yang berlaku di semua layanan yang didukung RAM.

  • Dependent action: Aksi dependen yang diperlukan untuk menjalankan aksi tersebut. Untuk menyelesaikan aksi tersebut, pengguna RAM atau role RAM harus memiliki izin untuk melakukan semua aksi dependen.

Action

Access level

Resource type

Condition key

Dependent action

eci:CreateImageCache

create

*ImageCache

acs:eci:{#regionId}:{#accountId}:imagecache/*

  • eci:tag
None

Parameter permintaan

Parameter

Type

Required

Description

Example

RegionId

string

Yes

ID Wilayah.

cn-hangzhou

RegionId

string

Yes

The ID of the region.

cn-hangzhou

ZoneId

string

No

Zona.

cn-hangzhou-g

SecurityGroupId

string

No

ID grup keamanan.

sg-uf66jeqopgqa9hdn****

VSwitchId

string

No

ID vSwitch. Anda dapat menentukan hingga 10 ID vSwitch, dipisahkan dengan koma (,). Contoh, vsw-***,vsw-***.

vsw-uf6h3rbwbm90urjwa****

ImageCacheName

string

Yes

Nama cache gambar.

testcache

EipInstanceId

string

No

EIP. Untuk menarik gambar dari Internet, pastikan instans ECI dapat mengakses Internet. Untuk mengaktifkan akses Internet, konfigurasikan EIP atau Gateway NAT.

eip-2zedsm5mfl3uhdj2d****

ResourceGroupId

string

No

ID kelompok sumber daya.

rg-aekzh43v*****

ClientToken

string

No

Token klien untuk memastikan idempotensi permintaan. Hasilkan nilai dari klien Anda untuk memastikan bahwa nilai tersebut unik di antara permintaan yang berbeda. Token hanya boleh berisi karakter ASCII dan panjangnya tidak boleh melebihi 64 karakter. Untuk informasi selengkapnya, lihat Cara memastikan idempotensi.

123e4567-xxx-xxx-xxxx-42665544xxxx

ImageCacheSize

integer

No

Ukuran cache gambar. Nilai default adalah 20 GiB.

20

RetentionDays

integer

No

Periode retensi cache gambar. Cache gambar akan dihapus setelah periode retensi berakhir. Secara default, cache gambar tidak pernah kedaluwarsa.

Catatan

Cache gambar yang gagal dibuat hanya disimpan selama satu hari.

7

AutoMatchImageCache

boolean

No

Apakah akan mengaktifkan penggunaan ulang cache gambar. Jika Anda mengaktifkan fitur ini, cache gambar baru dapat menggunakan ulang lapisan gambar dari cache gambar yang ada. Hal ini mempercepat pembuatan cache gambar. Nilai valid:

  • true

  • false

Nilai default: false.

true

ImageRegistryCredential

array<object>

No

Kredensial Repository image.

object

No

The credentials of the image repository.

Password

string

No

The password for the image repository.

password

Server

string

No

The address of the image repository. Do not include the http:// or https:// prefix.

registry-vpc.cn-hangzhou.aliyuncs.com

UserName

string

No

The username for the image repository.

username

Image

array

Yes

Gambar kontainer yang digunakan untuk membuat cache gambar.

registry-vpc.cn-hangzhou.aliyuncs.com/eci_open/nginx:1.15.10-perl

string

No

The container images used to create the image cache.

registry-vpc.cn-hangzhou.aliyuncs.com/eci_open/nginx:1.15.10-perl

Tag

array<object>

No

Tag cache gambar. Anda dapat menentukan hingga 20 tag.

object

No

The tags of the image cache. You can specify up to 20 tags.

Key

string

No

The key of the image cache tag.

imc

Value

string

No

The value of the image cache tag.

test

Flash

boolean

No

Apakah akan mengaktifkan fitur cache gambar instan. Jika Anda mengaktifkan fitur ini, pembuatan cache gambar akan dipercepat. Nilai valid:

  • true

  • false

Nilai default: false.

true

AcrRegistryInfo

array<object>

No

Informasi tentang instans ACR. Untuk informasi selengkapnya, lihat Gunakan metode tanpa kata sandi untuk menarik gambar dari repository ACR.

object

No

The information about the ACR instance.

Domain

array

No

The domain names of the ACR Enterprise instance. By default, all domain names of the instance are specified. You can specify one or more domain names. Separate multiple domain names with commas (,).

test****-registry.cn-beijing.cr.aliyuncs.com

string

No

The domain names of the ACR Enterprise instance. By default, all domain names of the instance are specified. You can specify one or more domain names. Separate multiple domain names with commas (,).

test****-registry.cn-beijing.cr.aliyuncs.com

InstanceName

string

No

The name of the ACR Enterprise instance.

test****

InstanceId

string

No

The ID of the ACR Enterprise instance.

cri-nwj395hgf6f3****

RegionId

string

No

The region where the ACR Enterprise instance resides.

cn-beijing

ArnService

string

No

The Alibaba Cloud Resource Name (ARN) of the RAM role that belongs to the account of the resource, such as an ECI instance.

acs:ram::1609982529******:role/role-assume

ArnUser

string

No

The ARN of the RAM role that belongs to the account of the ACR instance.

acs:ram::1298452580******:role/role-acr

Annotations

string

No

Anotasi. Parameter ini tidak untuk penggunaan eksternal.

hide

PlainHttpRegistry

string

No

Alamat Repository image yang dikelola sendiri. Saat Anda membuat cache gambar menggunakan gambar dari Repository image yang dikelola sendiri yang menggunakan protokol HTTP, atur parameter ini untuk mengizinkan ECI menarik gambar melalui HTTP. Hal ini mencegah kegagalan penarikan gambar yang disebabkan oleh ketidakcocokan protokol.

"harbor***.pre.com,192.168.XX.XX:5000,reg***.test.com:80"

InsecureRegistry

string

No

Alamat Repository image yang dikelola sendiri.

Saat Anda membuat cache gambar menggunakan gambar dari Repository image yang dikelola sendiri yang menggunakan Sertifikat yang ditandatangani sendiri, atur parameter ini untuk melewati verifikasi Sertifikat. Hal ini mencegah kegagalan penarikan gambar yang disebabkan oleh kegagalan verifikasi Sertifikat.

"harbor***.pre.com,192.168.XX.XX:5000,reg***.test.com:80"

StandardCopyCount

integer

No

Jumlah replika Snapshot standar. Secara default, satu cache gambar berkaitan dengan satu Snapshot. Jika cache gambar digunakan untuk membuat beberapa instans ECI secara Batch, buat beberapa replika Snapshot. Tambahkan satu replika Snapshot untuk setiap 1.000 instans ECI.

Catatan

Jika fitur cache gambar instan dinonaktifkan (Flash diatur ke false), hanya Snapshot standar yang dibuat selama proses pembuatan cache gambar.

7

FlashCopyCount

integer

No

Jumlah replika Snapshot lokal. Secara default, satu cache gambar berkaitan dengan satu Snapshot. Jika cache gambar digunakan untuk membuat beberapa instans ECI secara Batch, buat beberapa replika Snapshot. Tambahkan satu replika Snapshot untuk setiap 1.000 instans ECI.

Catatan

Jika fitur cache gambar instan diaktifkan (Flash diatur ke true), Snapshot lokal terlebih dahulu dibuat selama proses pembuatan cache gambar. Setelah Snapshot lokal dibuat, Snapshot standar dibuat. Setelah Snapshot standar dibuat, Snapshot lokal akan dihapus secara otomatis.

7

EliminationStrategy

string

No

Kebijakan penggantian cache gambar. Nilai default kosong, yang menunjukkan bahwa cache gambar selalu dipertahankan.

Anda dapat mengatur parameter ini ke LRU, yang menunjukkan bahwa cache gambar dapat dihapus secara otomatis. Ketika jumlah cache gambar mencapai batas Kuota, sistem secara otomatis menghapus cache gambar yang paling jarang digunakan dan memiliki EliminationStrategy yang diatur ke LRU.

LRU

OsType

string

No

Sistem operasi gambar kontainer. Nilai valid:

  • Linux (default)

  • Windows

Catatan

Windows berada dalam pratinjau undangan. Untuk menggunakan fitur ini, kirim Tiket.

Linux

Elemen respons

Element

Type

Description

Example

object

RequestId

string

The ID of the request.

0E234675-3465-4CC3-9D0F-9A864BC391DD

ImageCacheId

string

The ID of the image cache.

imc-2zebxkiifuyzzlhl****

ContainerGroupId

string

The ID of the ECI instance that is used to create the image cache.

eci-2zebxkiifuyzzlhl****

Contoh

Respons sukses

JSONformat

{
  "RequestId": "0E234675-3465-4CC3-9D0F-9A864BC391DD",
  "ImageCacheId": "imc-2zebxkiifuyzzlhl****",
  "ContainerGroupId": "eci-2zebxkiifuyzzlhl****"
}

Kode kesalahan

HTTP status code

Error code

Error message

Description

400 Account.Arrearage Your account has an outstanding payment. Your account has an outstanding payment.
400 DryRunOperation Request validation has been passed with DryRun flag set. Request validation has been passed with DryRun flag set.
400 InvalidParameter.CPU.Memory The specified cpu and memory are not allowed
400 IncorrectStatus %s
400 ServiceNotEnabled %s The service on which this request depends has not been activated. Please activate and try again.
400 DiskVolume.NotSupport The disk volume is not supported. Disk volume does not support your structure. If you want to enable this function, contact us.
400 RamRole.NotSupport The RAM role is not supported. The RAM role is not supported.
400 ImageCache.IncorrectStatus %s
400 ImageCacheNotSupport Image cache is not available for all users. If you want to enable this function, contact us. Container image cache is currently not available to all users. Submit a ticket if you need to use the feature.
400 EipAddressPoolIpNotEnough The ip address of specified PublicIpAddressPool is not enough.
400 OperationConflict The request was denied. It conflicts with a previous request.
403 OperationDenied.VswZoneMisMatch The specified VSwitchId is not in the specified Zone.
403 QuotaExceeded %s quota exceeded.
403 Zone.NotOnSale The specified zone is not available for purchase.
403 Forbidden.RiskControl This operation has been identified as an abnormal operation and cannot be processed.
403 Forbidden.SubUser The specified action is not available for you.
403 Forbidden.OnlyForInvitedTest Eci create action is only open to invited users during public beta.
403 OperationDenied.SecurityGroupMisMatch The specified VSwitchId and SecurityGroupId are not in the same VPC.
403 InvalidVSwitchId.IpNotEnough The specified VSwitch does not have enough IP addresses.
403 Forbidden.UserBussinessStatus This operation is not allowed, because you have overdue bills. Pay the overdue bill and try again.
403 Forbidden.UserNotRealNameAuthentication This operation is not allowed, because you have not passed the real-name verification.
403 InvalidUser.PassRoleForbidden The RAM user is not authorized to assume a RAM role. The RAM user is not authorized to assume a RAM role.
403 OperationDenied.NoStock Sales of this resource are temporarily suspended in the specified zone. We recommend that you use the multi-zone creation function to avoid the risk of insufficient resource. For more information, see https://www.alibabacloud.com/help/document_detail/157290.html
403 NoPermission The RAM role AliyunECIContainerGroupRole does not belong to eci.aliyuncs.com. Please check and try again.
403 SecurityRisk.3DVerification We have detected a security risk with your default credit or debit card. Please proceed with verification via the link in your email.
403 CreateServiceLinkedRole.Denied Please make sure the account has ram:CreateServiceLinkedRole permission. Please make sure the account has ram:CreateServiceLinkedRole permission.

Lihat Error Codes untuk daftar lengkap.

Catatan rilis

Lihat Release Notes untuk daftar lengkap.