Embedded container mirror image simplification method and system

By generating a streamlined container mirror file that supports the multi -processor architecture, and verifying compatibility on different architectures, the container mirror in the existing technology is too large and unsatisfactory, and the lightweight and cross -architectural container mirror scheme is realized.

CN119336377APending Publication Date: 2025-01-21QINGDAO ITECHENE TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411291182.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-14
Publication Date
2025-01-21

AI Technical Summary

Technical Problem

When generating container images, the image is too large and incompatible with different processor architectures, resulting in the need to recompile and generate basic images after switching the architecture, which cannot meet the lightweight and cross-architecture compatibility needs of concentrators in the power industry.

Method used

By generating a root file system that supports both armhf and aarch64 processor architectures, removing unnecessary library files and executable files, compressing the file system, generating the final container image file, and verifying the compatibility of the image on different architectures.

Benefits of technology

The container mirror is achieved, occupying small space, about 60kb, and good compatibility. The same mirror file is common on the operating system of different processor architectures. The switching processor architecture does not need to re -compile new mirrors.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119336377A_ABST
    Figure CN119336377A_ABST
Patent Text Reader

Abstract

The invention relates to a method and a system for simplifying an embedded container mirror image. S1, generating a basic mirror image; s2, transmitting the container mirror image file to a specified device; s3, using and verifying the container basic mirror image; the device is reasonable in design, compact in structure and convenient to use.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to a method and system for streamlining an embedded container image. Background Art

[0002] In the concentrator, docker is used as the container engine, and a self-made basic image is imported. The current container image solution is to import a complete root file system, but this method has the following disadvantages: 1) The container image is too large, and the complete file system takes up about 100MB of space. This problem makes it difficult to upgrade remotely in the future; 2) The versions of some basic tools of the host and the container may be inconsistent, 3) The compatibility is poor, and a new version of the basic image must be released every time a processor architecture is switched. Another method is to use buildroot to make a minimum system containing only busybox as the basic image of the container. This solution can reduce the image to about 5MB, but there are still the following disadvantages: 1) Although it has been greatly streamlined, the space occupied is still large. According to the needs of the site, it needs to be streamlined to less than 2MB. 2) Because it is recompiled, the version difference of the basic tools will be greater than the original difference. The existing technology still cannot solve the problem of recompiling and generating basic images after switching the processor architecture.

[0003] Therefore, on the concentrators in the power industry, especially after the introduction of the aarch64 64-bit operating system, a container base image solution that is both lightweight and compatible with the armhf and aarch64 architectures is needed. Summary of the invention

[0004] The technical problem to be solved by the present invention is generally to provide a method and system for streamlining embedded container images.

[0005] To solve the above problems, the technical solution adopted by the present invention is: A method for streamlining an embedded container image, the method comprising the following steps: S1. Generate a basic image; S2. Transfer the container image file to the specified device; S3. Use and verification of container base images.

[0006] As an improvement, in step S1, S1.1. compile and generate the root file systems of armhf and aarch64 respectively, and the generation method is consistent with the method of making the root file system of the host machine; S1.2. Integrate the file system generated in step S1.1 into a file system that supports both armhf and aarch64 processor architectures; S1.3. Streamlining the library files and executable files, removing all library files and executable files in the file system in step S1.2; S1.4. Streamline the configuration files in the setting directory and remove the time zone configuration and hwdb configuration in the container; S1.5. Compress the modified file system to generate the final container image file.

[0007] As an improvement, in step S2, S2.1. Use a removable medium to transfer the file generated in step 1 to the concentrator; S2.2. Use Docker to load the container image file in step S1.5 as a container image.

[0008] As an improvement, in step S3, S3.1. when creating a container, mount the file path of the host machine into the container in read-only mode; S3.2. Verify on aarch64 processors and operating systems that the container created using the above image can run armhf and aarch64 applications normally. S3.3. Verify on the armhf architecture processor and operating system, using the container created by the image in step S3.2 to run the armhf application; S3.4. If you want the burned image to include the container base image in step S3.2 and the container created based on the base image, you can package the container and the files related to the container base image (for docker, usually / var / lib / docker) on the concentrator of the loaded container base image in step S3.2 and add them to the burned image; S3.5. End of usage verification.

[0009] As an improvement, in step S2, the designated device is an electric power equipment terminal, especially a concentrator; the designated device is equipped with an operating system (including but not limited to Linux, macOS and other UNIX-like operating systems and their derivative systems) and has container support (including but not limited to docker, lxc and other containers).

[0010] As an improvement, in step S1.1, the root file systems of armhf and aarch64 are compiled and generated on the host computer; Integrate the root file system and patch package manually or by patching on the host computer or designated device; On the host computer or specified device, remove unnecessary files (such as time zone configuration, hwdb configuration) or files that can be shared with the host (such as / bin, / lib) manually or by patching to streamline.

[0011] As an improvement, in step S2, the file transmission method includes but is not limited to removable media (including USB flash drives or mobile hard disks, etc.), networks (including ftp, sftp, etc.), and any other method that can transmit files.

[0012] As an improvement, in step S3, the basic runtime library includes a 32-bit or 64-bit basic library and a HAL library; the path includes a storage path of the hypervisor in the container, a basic runtime library path, a basic tool path, and other file paths that need to be shared with the host machine; Verify on the aarch64 architecture processor and operating system that the container base image created in step S3.2 can be used to create containers and run armhf and aarch64 applications in the container after being imported on the specified device; Verify on the armhf architecture processor and operating system that the container base image created in step S3.2 can be used to create containers and run armhf applications in the container after being imported on the specified device.

[0013] A streamlined system of embedded container images, comprising a designated device (such as a concentrator); the designated device is equipped with an operating system and a container; the system is equipped with the method according to claim 1; A container can be created based on a container image on a specified device, and the created container shares the basic runtime library and basic tools with the host operating system of the specified device.

[0014] The container image of the present invention is streamlined, and the container image is compatible across processor architectures. The container base image generated by the present invention occupies a small space, only about 60KB, has good consistency with the host machine, and the runtime library and basic tools are all the same version, with good compatibility. The same image file is universal on operating systems of different processor architectures, and there is no need to recompile a new image after switching the processor architecture. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] Figure 1 It is a schematic diagram of the overall process of the present invention.

[0016] Figure 2 It is a schematic flow chart of step S1 of the present invention.

[0017] Figure 3 It is a schematic flow chart of step S2 of the present invention.

[0018] Figure 4 It is a schematic flow chart of step S3 of the present invention. DETAILED DESCRIPTION

[0019] like Figure 1-4The present invention realizes a method for streamlining container images that is lightweight, has good compatibility, and can maintain consistency with the host machine's operating environment, and is applied to the implementation of embedded software upgrades in concentrators.

[0020] To achieve the above content, the present invention adopts the following technical solution, which includes: S1. Generate a basic image; S1.1. Compile and generate the armhf and aarch64 root file systems respectively. The generation method is the same as that of the host machine root file system. S1.2. Integrate the file system into a file system that supports both armhf and aarch64 processor architectures; S1.3. Streamline the library files and executable files and remove all library files and executable files in the file system; S1.4. Streamline the configuration files in / etc / and remove unnecessary time zone, hwdb and other configurations in the container; S1.5. Compress the modified file system to generate the final container image file; S2. Transfer the container image file to the specified device; S2.1. Use removable media such as a USB flash drive to transfer files to the concentrator; S2.2. Use Docker to load the container image file as a container image; S3. Use and verification of container base images; S3.1. When creating a container, mount the host's executable files, runtime libraries (including 32 / 64-bit basic libraries and HAL libraries, etc.), and the storage path of the hypervisor in the container into the container in read-only mode; S3.2. Verify on aarch64 processors and operating systems that the container created using the above image can run armhf and aarch64 applications normally. S3.3. Verify on the armhf architecture processor and operating system that the container created using the above image can run armhf applications normally; S3.4. Add the container base image to the burning image used in mass production. If you want the burning image to include the container base image in step S3.2 and the container created based on the base image, you can package the container and the container base image related files (for docker, usually / var / lib / docker) on the concentrator of the loaded container base image in step S3.2 and add them to the burning image; S3.5. End of usage verification.

[0021] The present invention is fully described for a clearer disclosure, and the prior art is not listed one by one.

[0022] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit them; although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some of the technical features therein with equivalents; it is obvious for those skilled in the art to combine multiple technical solutions of the present invention. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention. The technical contents not described in detail in the present invention are all known technologies.

Claims

1. A method for streamlining an embedded container image, characterized in that: The method comprises the following steps: S1. Generate a base image; S2. Transfer the container image file to the specified device; S3. Use and verification of container base images.

2. The method for streamlining an embedded container image according to claim 1, characterized in that: In step S1, S1.

1. Compile and generate the armhf and aarch64 root file systems respectively. The generation method is the same as that of the host machine root file system. S1.

2. Integrate the file system generated in step S1.1 into a file system that supports both armhf and aarch64 processor architectures; S1.

3. Streamline the library files and executable files, and remove all library files and executable files in the file system in step S1.2; S1.

4. Streamline the configuration files in the setting directory and remove the time zone configuration and hwdb configuration in the container; S1.

5. Compress the modified file system to generate the final container image file.

3. The method for streamlining an embedded container image according to claim 1, characterized in that: In step S2, S2.

1. Use removable media to transfer the file generated in step 1 to the concentrator; S2.

2. Use Docker to load the container image file in step S1.5 as a container image.

4. The method for streamlining an embedded container image according to claim 1, characterized in that: In step S3, S3.

1. When creating a container, mount the host's file path into the container in read-only mode; S3.

2. Verify on aarch64 architecture processors and operating systems that the container created using the above image can run armhf and aarch64 applications normally; S3.

3. Verify on the armhf architecture processor and operating system, using the container created by the image in step S3.2 to run the armhf application; S3.

4. If you want to make the burning image include the container base image in step S3.2 and the container created based on the base image, on the concentrator of the loaded container base image in step S3.2, package the container and the container base image file and transfer them out, and add them to the burning image; S3.

5. Usage verification is completed.

5. The method for streamlining an embedded container image according to claim 1, characterized in that: In step S2, the device is designated as a concentrator, which is equipped with an operating system and supported by a container.

6. The method for streamlining an embedded container image according to claim 2, characterized in that: In step S1.1, the root file system of armhf and aarch64 is compiled and generated on the host computer; Integrate the root file system and patch package manually or by patching on the host computer or designated device; Streamline the host computer or designated device manually or by patching or by using files shared with the host computer.

7. The method for streamlining an embedded container image according to claim 3, characterized in that: In step S2, the removable medium includes a USB flash drive or a mobile hard disk.

8. The method for streamlining an embedded container image according to claim 1, characterized in that: In step S3, the basic runtime library includes a 32-bit or 64-bit basic library and a HAL library; the path includes a storage path of the hypervisor in the container, a basic runtime library path, and a basic tool path; Verify on a processor and operating system of the aarch64 architecture, use the container base image created in step S3.2, import it on the specified device, use it to create a container, and run armhf and aarch64 applications in the container; Verify on the armhf architecture processor and operating system, use the container base image created in step S3.2, import it on the specified device, use it to create a container, and run the armhf application normally in the container.

9. A streamlined system for embedded container images, characterized in that: The invention comprises a designated device; the designated device is equipped with an operating system and a container; the system executes the method described in claim 1; a container is created on the designated device based on the container image, and the created container shares the basic runtime library and basic tools with the host operating system of the designated device.