Anda dapat memanggil operasi CreateImageCache untuk membuat cache gambar, yang mempercepat proses menarik gambar dan mengurangi waktu startup instans Elastic Container Instance (ECI).
Deskripsi operasi
Perhatian
Pembuatan cache gambar dikenai biaya. Tinjau informasi penagihan sebelum melanjutkan. Untuk informasi selengkapnya, lihat Penagihan cache gambar.
Sebelum membuat cache gambar, evaluasi ukuran total gambar yang akan di-cache. Jika ukuran total gambar melebihi kapasitas cache, pembuatan akan gagal.
Saat membuat cache gambar, sistem secara otomatis membuat instans ECI dan disk Enhanced SSD (ESSD) PL1. Jangan menghapus instans ECI atau disk tersebut selama proses pembuatan; jika tidak, cache gambar tidak dapat dibuat.
Saat membuat cache gambar, sebuah Snapshot yang sesuai akan dihasilkan. Jangan menghapus Snapshot tersebut; jika tidak, cache gambar menjadi tidak valid.
Jika Anda menggunakan kit pengembangan perangkat lunak (SDK), pastikan Anda menggunakan versi berikut atau yang lebih baru: Java 1.0.10 atau Python 1.0.7.
Saran penggunaan
Untuk mengaktifkan akses tanpa password ke gambar dari instans ACR Enterprise yang menggunakan nama domain kustom, atur parameter AcrRegistryInfo. Saat mengatur parameter tersebut, Anda juga harus menentukan parameter AcrRegistryInfo.N.InstanceId.
Jika cache gambar digunakan untuk membuat lebih dari 1.000 instans ECI dalam satu Batch, atur parameter StandardCopyCount dan FlashCopyCount untuk membuat beberapa replika Snapshot. Beberapa replika Snapshot ditagih berdasarkan ukuran Data inkremental. Karena data dalam replika Snapshot identik, tidak ada biaya tambahan yang dikenakan.
Saat memanggil operasi CreateImageCache, sistem secara otomatis membuat peran terkait layanan AliyunServiceRoleForECI. Peran ini digunakan untuk mengakses layanan Alibaba Cloud lainnya seperti ECS dan VPC. Untuk informasi selengkapnya, lihat Peran terkait layanan untuk Elastic Container Instance.
Coba sekarang
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
eci:CreateImageCache |
create |
*ImageCache
|
|
None |
Parameter permintaan
|
Parameter |
Type |
Required |
Description |
Example |
| RegionId |
string |
Yes |
ID wilayah. |
cn-hangzhou |
| RegionId |
string |
Yes |
ID wilayah. |
cn-hangzhou |
| ZoneId |
string |
No |
Zona. |
cn-hangzhou-g |
| SecurityGroupId |
string |
No |
ID security group. |
sg-uf66jeqopgqa9hdn**** |
| VSwitchId |
string |
No |
ID vSwitch. Anda dapat menentukan hingga 10 ID vSwitch, dipisahkan dengan koma (,). Misalnya, |
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 nilainya 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 |
Menentukan apakah akan mengaktifkan penggunaan ulang cache gambar. Jika Anda mengaktifkan fitur ini, cache gambar baru dapat menggunakan kembali lapisan gambar dari cache gambar yang sudah ada. Hal ini mempercepat pembuatan cache gambar. Nilai yang valid:
Nilai default: false. |
true |
| ImageRegistryCredential |
array<object> |
No |
Kredensial repository image. |
|
|
object |
No |
Kredensial repository image. |
||
| Password |
string |
No |
Password untuk repository image. |
password |
| Server |
string |
No |
Alamat repository image. Jangan sertakan awalan |
registry-vpc.cn-hangzhou.aliyuncs.com |
| UserName |
string |
No |
Username untuk repository image. |
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 |
Gambar kontainer yang digunakan untuk membuat cache gambar. |
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 |
Tag cache gambar. Anda dapat menentukan hingga 20 tag. |
||
| Key |
string |
No |
Kunci tag cache gambar. |
imc |
| Value |
string |
No |
Nilai tag cache gambar. |
test |
| Flash |
boolean |
No |
Menentukan apakah akan mengaktifkan fitur cache gambar instan. Jika Anda mengaktifkan fitur ini, pembuatan cache gambar dipercepat. Nilai yang valid:
Nilai default: false. |
true |
| AcrRegistryInfo |
array<object> |
No |
Informasi tentang instans ACR. Untuk informasi selengkapnya, lihat Gunakan metode tanpa password untuk menarik gambar dari repository ACR. |
|
|
object |
No |
Informasi tentang instans ACR. |
||
| Domain |
array |
No |
Nama domain instans ACR Enterprise. Secara default, semua nama domain instans ditentukan. Anda dapat menentukan satu atau beberapa nama domain. Pisahkan beberapa nama domain dengan koma (,). |
test****-registry.cn-beijing.cr.aliyuncs.com |
|
string |
No |
Nama domain instans ACR Enterprise. Secara default, semua nama domain instans ditentukan. Anda dapat menentukan satu atau beberapa nama domain. Pisahkan beberapa nama domain dengan koma (,). |
test****-registry.cn-beijing.cr.aliyuncs.com |
|
| InstanceName |
string |
No |
Nama instans ACR Enterprise. |
test**** |
| InstanceId |
string |
No |
ID instans ACR Enterprise. |
cri-nwj395hgf6f3**** |
| RegionId |
string |
No |
Wilayah tempat instans ACR Enterprise berada. |
cn-beijing |
| ArnService |
string |
No |
Nama Sumber Daya Alibaba Cloud (ARN) dari peran RAM milik akun sumber daya, seperti instans ECI. |
acs:ram::1609982529******:role/role-assume |
| ArnUser |
string |
No |
ARN dari peran RAM milik akun instans ACR. |
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 membuat cache gambar menggunakan gambar dari repository image yang dikelola sendiri yang menggunakan protokol HTTP, atur parameter ini agar ECI dapat menarik gambar melalui HTTP. Hal ini mencegah kegagalan menarik gambar akibat ketidakcocokan protokol. |
"harbor***.pre.com,192.168.XX.XX:5000,reg***.test.com:80" |
| InsecureRegistry |
string |
No |
Alamat repository image yang dikelola sendiri. Saat membuat cache gambar menggunakan gambar dari repository image yang dikelola sendiri yang menggunakan Sertifikat tanda tangan sendiri, atur parameter ini untuk melewati verifikasi sertifikat. Hal ini mencegah kegagalan menarik gambar akibat 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 sesuai dengan satu Snapshot. Jika cache gambar digunakan untuk membuat beberapa instans ECI dalam satu 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 sesuai dengan satu Snapshot. Jika cache gambar digunakan untuk membuat beberapa instans ECI dalam satu 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 pertama kali dibuat selama proses pembuatan cache gambar. Setelah Snapshot lokal dibuat, Snapshot standar dibuat. Setelah Snapshot standar dibuat, Snapshot lokal secara otomatis dihapus. |
7 |
| EliminationStrategy |
string |
No |
Kebijakan penggantian cache gambar. Nilai default kosong, yang menunjukkan bahwa cache gambar selalu disimpan. Anda dapat mengatur parameter ini ke LRU, yang menunjukkan bahwa cache gambar dapat dihapus secara otomatis. Saat jumlah cache gambar mencapai batas kuota, sistem secara otomatis menghapus cache gambar yang paling jarang digunakan dan memiliki EliminationStrategy diatur ke LRU. |
LRU |
| OsType |
string |
No |
Sistem operasi gambar kontainer. Nilai yang valid:
Catatan
Windows sedang dalam pratinjau undangan. Untuk menggunakan fitur ini, kirim Tiket. |
Linux |
Elemen respons
|
Element |
Type |
Description |
Example |
|
object |
|||
| RequestId |
string |
ID permintaan. |
0E234675-3465-4CC3-9D0F-9A864BC391DD |
| ImageCacheId |
string |
ID cache gambar. |
imc-2zebxkiifuyzzlhl**** |
| ContainerGroupId |
string |
ID instans ECI yang digunakan untuk membuat cache gambar. |
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.