Tüm Ürünler
Search
Belge Merkezi

:CreateImageComponent

Son Güncelleme:Oct 02, 2026

Bir görüntü bileşeni oluşturur. Görüntü bileşenleri, görüntü oluşturma işlemlerinde yaygın olarak kullanılan oluşturma şablonu komutlarını depolamak için kullanılır.

Operation description

İşlem açıklaması

Bir görüntü bileşeni oluşturmadan önce aşağıdaki hususlara dikkat edin:

  • Yalnızca özel görüntü bileşenleri oluşturulabilir.

  • Bileşen sürüm numaraları, aynı bileşen adı için benzersiz olmalıdır. Bir şablonda bileşen kullanırken, bileşene ad ve sürüm numarasıyla başvurabilirsiniz.

  • Bir görüntü bileşeninin içerik boyutu 16 KB'ı aşamaz. Desteklenen komutlar hakkında ayrıntılı bilgi için Image Builder tarafından desteklenen komutlar bölümüne bakın.

Daha fazla bilgi için Image Builder'a genel bakış bölümüne bakın.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

ecs:CreateImageComponent

create

*ImageComponent

acs:ecs:{#regionId}:{#accountId}:imagecomponent/*

None None

Request parameters

Parameter

Type

Required

Description

Example

RegionId

string

Yes

Bölge kimliği. En son bölge listesini sorgulamak için DescribeRegions API'sini çağırabilirsiniz.

cn-hangzhou

ResourceGroupId

string

No

Kurumsal kaynak grubu kimliği.

rg-bp67acfmxazb4p****

Tag

array<object>

No

Etiketler.

object

No

Key

string

No

Etiketin anahtarı. N için geçerli değerler: 1 ile 20 arası. Etiket anahtarı boş bir dize olamaz. Etiket anahtarı en fazla 128 karakter uzunluğunda olabilir ve aliyun veya acs: ile başlayamaz. Etiket anahtarı http:// veya https:// içeremez.

TestKey

Value

string

No

Etiketin değeri. N için geçerli değerler: 1 ile 20 arası. Etiket değeri boş bir dize olabilir. Etiket değeri en fazla 128 karakter uzunluğunda olabilir ve acs: ile başlayamaz. Etiket değeri http:// veya https:// içeremez.

TestValue

Name

string

No

Bileşen adı. Ad, 2 ila 128 karakter uzunluğunda olmalı ve bir harf veya Çince karakterle başlamalıdır. Ad, http:// veya https:// ile başlayamaz. Ad; harfler, Çince karakterler, rakamlar, iki nokta üst üste (:), alt çizgi (_), nokta (.) veya tire (-) içerebilir.

Not

Name parametresini belirtmezseniz, varsayılan olarak ImageComponentId dönüş değeri kullanılır.

testComponent

Description

string

No

Açıklama. Açıklama 2 ila 256 karakter uzunluğunda olmalı ve http:// veya https:// ile başlamamalıdır.

This is description.

SystemType

string

No

Bileşen tarafından desteklenen işletim sistemi.

Geçerli değerler:

  • Linux

  • Windows

Varsayılan değer: Linux.

Linux

ComponentType

string

No

Bileşen türü. Görüntü oluşturma bileşenleri ve test bileşenleri desteklenir.

Geçerli değerler:

  • Build

  • Test

Varsayılan değer: Build.

Not

Build bileşenleri yalnızca oluşturma şablonlarında, Test bileşenleri ise yalnızca test şablonlarında kullanılabilir.

Build

Content

string

No

Bileşen içeriği. İçerik birden fazla komuttan oluşur ve 16 KB'ı aşamaz. Desteklenen komutlar ve komut biçimleri hakkında daha fazla bilgi için Image Builder tarafından desteklenen komutlar bölümüne bakın.

Tasks: - Name: HelloWorld Action: RunShellCommand Properties: commandContent: echo hello world

ClientToken

string

No

İsteğin idempotent olmasını sağlamak için kullanılan istemci belirteci. Belirteci oluşturmak için istemciyi kullanabilirsiniz, ancak belirtecin farklı istekler arasında benzersiz olduğundan emin olmalısınız. ClientToken değeri yalnızca ASCII karakterler içerebilir ve 64 karakteri aşamaz. Daha fazla bilgi için İdempotans nasıl sağlanır bölümüne bakın.

123e4567-e89b-12d3-a456-426655440000

ComponentVersion

string

No

Bileşen sürüm numarası. Bu parametre, bileşen adıyla birlikte kullanılır. Biçim major.minor.patch şeklindedir ve tüm değerler negatif olmayan tam sayılardır.

Varsayılan değer: (x+1).0.0; burada x, bileşenin mevcut maksimum major sürüm numarasıdır.

1.0.0

Response elements

Element

Type

Description

Example

object

ImageComponentId

string

Görüntü bileşeni kimliği.

ic-bp67acfmxazb4p****

RequestId

string

İstek kimliği.

473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E

Examples

Success response

JSON format

{
  "ImageComponentId": "ic-bp67acfmxazb4p****",
  "RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E"
}

Error codes

HTTP status code

Error code

Error message

Description

400 InvalidCommand.Component Image component does not support component command.
400 InvalidName.Malformed %s
400 InvalidDescription.Malformed %s
400 InvalidSystemType.NotSupportedValue %s
400 InvalidComponentType.NotSupportedValue %s
400 InvalidContent.LengthExceeded %s
400 InvalidImageTemplateCommandSize.ExceededMaxNumber %s
400 InvalidImageTemplateCommand.NotSupported %s
400 InvalidCommandContent.RUN %s
400 InvalidCommandContent.ENV %s
400 InvalidCommandContent.WORKDIR %s
400 InvalidCommandContent.COPY %s
400 InvalidCommandContent.USER %s
400 InvalidCommandContent.CMD %s
400 InvalidCommandContent.ENTRYPOINT %s
400 MissingParameter.Content %s
400 EmptyCommandContent.RUN %s. If the RUN command exists in the template, you must specify RUN.
400 EmptyCommandContent.ENV %s. If the ENV command exists in the template, you must specify ENV.
400 EmptyCommandContent.LABEL %s. If the LABEL command exists in the template, you must specify LABEL.
400 EmptyCommandContent.COPY %s. If the COPY command exists in the template, you must specify COPY.
400 EmptyCommandContent.ENTRYPOINT %s. If the ENTRYPOINT command exists in the template, you must specify ENTRYPOINT.
400 EmptyCommandContent.CMD %s. If the CMD command exists in the template, you must specify CMD.
400 NotEmptyCommandContent.RESTART %s. If the RESTART command exists in the template, you must specify RESTART.
400 EmptyCommandContent.WORKDIR %s. If the WORKDIR command exists in the template, you must specify WORKDIR.
400 EmptyCommandContent.USER %s. If the USER command exists in the template, you must specify USER.
400 QuotaExceed.ImageComponent %s. Image component quota exceeded in current region.
400 InvalidParameter.Content %s. The image component content is invalid.
400 InvalidImage.OsTypeUnsupported The specified base image does not support image building. The operating system of the specified base image does not support image building.
400 InvalidParameter.ComponentVersion The specified ComponentVersion is invalid. The specified ComponentVersion is invalid.
403 InvalidComponentVersion.Exist The specified ComponentVersion does exist with the specified Name. The specified ComponentVersion does exist with the specified Name.
403 InvalidOperation.NoPermissionCreateServiceLinkedRole You are not authorized to create Service-linked role. The system will automatically create it when the API is called for the first time. Check your RAM policies, and ensure that you are using the correct credentials. You are not authorized to create Service-linked role. The system will automatically create it when the API is called for the first time. Check your RAM policies, and ensure that you are using the correct credentials.
404 InvalidResourceGroup.NotFound The ResourceGroup provided does not exist in our records. The specified resource group does not exist.
404 NotSupportedCommand.FROM %s

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.