Image compliance tool

This topic describes how to use the image compliance tool provided by Alibaba Cloud to check the validity of a custom Linux image and whether it meets the image import conditions.

Background information

ECS allows you to create instances from custom images. However, the custom images must meet certain requirements before they can be used in Alibaba Cloud. For more information, see Notes for importing images.

To reduce the time needed to create a custom image, we recommend that you use the image compliance tool of ECS. The image compliance tool is designed to automatically validate configuration items in a target Linux server environment to locate non-compliant items, generate TXT and JSON detection reports, and provide possible troubleshooting actions if required.

This topic uses a server running the CentOS 7.4 64-bit OS as an example.

In the preceding code example,
<path of the image compliance tool> is also the path where the detection report is generated. Therefore, run the following command to start the image compliance tool:

sudo ./image_check

Note You can use the
-p [destination path] command to specify the path where the detection report is generated. If this parameter is not specified, the detection report will be generated in the path of the image compliance tool by default.

The path of the detection report is displayed in the tool execution result. In this example, the path is /root. The report is named in the format of image_check_report_date_time.txt or image_check_report.json.

Detection items

The compliance tool detects the following server configuration items to ensure that the ECS instances created from your custom image are fully functional.

Note The
64 bit feature is one feature of the Ext4 file system. You can use the
man ext4 command to view detailed descriptions.

root

You cannot use your username and password to remotely connect to the ECS instance.

Reserve the root account.

passwd

You cannot add users to the ECS instance.

Retain or reinstall the passwd command.

Partition table

The ECS instance cannot start normally.

Use MBR partitioning.

/lib

The ECS instance cannot be automatically configured.

The /lib and /lib64 files cannot be stored in absolute paths. Modify the storage paths of the files to their relative paths.

system disk

N/A

Increase the system disk capacity. The optimal system disk capacity is 40 GiB to 500 GiB. When you import images, configure the system disk capacity based on the virtual file size of images, instead of the usage capacity of images.

disk_usage

You cannot install the necessary drivers or services for the ECS instance.

Make sure that sufficient disk space is allocated.

inode usage

You cannot install the necessary drivers or services for the ECS instance.

Make sure that sufficient inode resources are allocated.

The image compliance tool provides a detection result OK, FAILED, or WARNING based on detection items.

OK: The detection items all comply with requirements.

FAILED: The detection items do not comply with requirements, which means an ECS instance created from the custom image cannot start normally. We recommend that you rectify the non-compliant items and recreate the image to improve instance startup efficiency.

WARNING: The detection items do not comply with requirements, which means an ECS instance created from the custom image can start normally, but ECS cannot use valid methods to configure your instance. You can choose to immediately rectify the non-compliant items or temporarily retain the items and create an image.

Output items

The image compliance tool generates detection reports in both TXT and JSON formats in the destination path after it detects the system environment.

Note You can use the
-p [destination path] command to specify the path where the detection report is generated. If this parameter is not specified, the detection report will be generated in the path of the compliance tool by default.

Reports in TXT format are named image_check_report_date_time.txt. The reports include server configuration information and detection results. The following example uses a server running the CentOS 7.4 64-bit OS.

Reports in JSON format are named image_check_report.json. The reports include server configuration information and detection results. The following example uses a server running the CentOS 7.4 64-bit OS.