An image component stores one or more commands, such as application, configuration, and test commands, that you commonly use to build an image. You can add image components to an image template to quickly specify custom image content. The system provides predefined system image components. You can directly use the components. In specific scenarios or to meet specific requirements, you can create custom image components based on your business requirements. This topic describes how to create an image component in the Elastic Compute Service (ECS) console.
Image templates that are created by using system image components provide stable and reliable images. We recommend that you use system image components to create image templates.
Limits
Take note of the following limits:
You cannot create or modify system image components. You can create or modify only custom image components.
The command content size cannot exceed 16 KB. An image component supports up to 127 commands. For information about commands supported by Image Builder, see Commands supported by Image Builder.
Procedure
Log on to the ECS console.
In the left-side navigation pane, choose .
In the top navigation bar, select the region and resource group to which the resource belongs.
On the Image Builder page, click the Image Components tab.
NoteThe first time you access Image Builder, the Image Builder welcome page appears. You must click Experience Now to go to the Image Builder page.
Click the Custom Components tab, and then click Create Image Component.
In the dialog box that appears, configure the parameters and click Confirm.
The following table describes the parameters.
Parameter
Description
Name
Specify a name for the image component.
Component Type
Image build components and image test components are supported.
An image build component is used to specify custom image content and can be used only in image build templates.
An image test component is used to test whether an image can run as expected and can be used only in image test templates.
System Type
Select an operating system type for the image component. Linux and Windows are supported.
Release Type
The version number of the image component, which is used together with the name of the image component.
Configure Component Content
Linux operating systems support YAML Ain't Markup Language (YAML) commands and DockerFile commands. Windows operating systems support only YAML commands.
YAML
You can directly enter the command content in the YAML format.
You can also select a predefined template from the sample template drop-down list, such as the template used to install PHP, MySQL, or NGINX. If you select a predefined template for the image component, the latest stable version of an application, such as PHP, MySQL, or NGINX, is installed on ECS instances when you use an image created based on an image template that includes the image component to create the instances. If the version of an application does not meet your business requirements, you can install the version that you require. For example, you can change the
sudo yum -y install nginx
command tosudo yum -y install nginx-<version>
.
DockerFile
You can click the Visual View tab and click Add Command to enter command parameters for each type of command, or click the Script View tab and enter the command content in the code editor.
For information about the YAML and DockerFile commands, see Commands supported by Image Builder.
Advanced Settings
Configure the description and labels of the image component based on your business requirements.
References
You can also call API operations to create an image component and query the details of the component. For more information, see CreateImageComponent and DescribeImageComponents.
You can use image components to quickly create an image template. For more information, see Create an image template and execute an image building task.
If you no longer require an image component, you can delete the component. For more information, see Delete image components.