Component container construction system and method thereof

Through componentized container construction methods and systems, the coordinated work of task closures and container component sources is used to solve the problems of large container image size, slow construction, and platform-specific, and small size, fast construction, and cross-platform container construction effects.

CN120010996AActive Publication Date: 2025-05-16INST OF COMPUTING TECH CHINESE ACAD OF SCI

Patent Information

Application Number
CN202510093772.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-21
Publication Date
2025-05-16
Estimated Expiration
2045-01-21

AI Technical Summary

Technical Problem

The existing container image is large in size, slow in construction, and only supports a single platform, making it difficult to meet the requirements of dynamic migration and multi-platform compatibility.

Method used

A componentized container construction method and system is proposed. Through the collaborative work of external software source modules, container component source modules, development machine modules and executor modules, a task closure is generated. This closure contains a list of applications and dependent software, rather than a complete dependent software. The executor actively obtains the container components of the adapter platform, merges them into the root file system, and starts the container instance.

Benefits of technology

It realizes the characteristics of small container image size, fast construction and cross-platform, saves storage and transmission overhead, and improves construction efficiency and platform compatibility.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120010996A_ABST
    Figure CN120010996A_ABST
Patent Text Reader

Abstract

The invention discloses a componentized container construction system, which comprises an external software source module, a container component source module, a development machine module and an execution machine module, and is characterized in that the development machine module reads an application program, analyzes software dependent on the application program, confirms container component information and generates a dependent software list; packaging the application program and the dependent software list into a task closure; the execution machine module reads a dependent software list in the task closure, obtains container component information meeting dependent software requirements, selects a container component to be used, combines the container component and an application program in the task closure into a root file system by using a joint file system, and sends the root file system to the execution machine module; and generating a configuration file when the container runs according to the configuration information in the container component and the task closure, and starting the container instance from the root file system. The method for constructing the container in a modularized mode has the advantages of being small in size, fast in construction, cross-platform and high in sharing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of cloud computing technology, and in particular to a container construction method and system. Background Art

[0002] Container technology is an operating system-level virtualization technology that uses mechanisms such as the Linux kernel's namespace and control group (cgroup) to implement multiple isolated operating environments on a single operating system kernel. Due to the advantages of fast startup, low resource usage, and high environmental consistency, container technology has been widely used in cloud computing, serverless computing, fog computing, edge computing, and other computing modes. In the above application scenarios, developers usually use image builders to package applications and their dependent software, and distribute the generated container images to the target execution environment (executor). After obtaining the container image, the executor will load and start it as one or more container instances, thereby achieving rapid application deployment and elastic scaling capabilities.

[0003] At present, the main technical problems when using container images for development and deployment include large size, slow build speed, and platform-specific shortcomings:

[0004] Disadvantages ⑴ Large container image size: Container images usually contain applications and all their dependent software, resulting in large file sizes and increased storage and transmission costs. The existing "Multi-Stage Build" technology can reduce the image size to a certain extent, that is, first compile the application in a complete environment, and then copy the compiled product to a streamlined environment. However, for applications such as machine learning that require large dependent libraries, the image size can still reach hundreds of megabytes to thousands of gigabytes;

[0005] Disadvantages (2) Slow container image building: Building an image usually requires using multiple software package management tools (such as Debian system software management tool apt, Python programming language library management tool pip) in a temporary container to download and compile various dependent software from different software sources, resulting in a long build time. Existing technologies attempt to shorten the build time by caching existing dependent packages or image layers, but they still cannot significantly shorten the build time when the build is first performed or when dependencies are updated frequently;

[0006] Disadvantages ⑶Container images only support a single platform: Since the image contains software dependencies related to a specific CPU, GPU architecture or operating system, a container image can usually only run on a single platform. In order to adapt to different platforms, the existing technology needs to compile and store multiple images separately, which not only takes up a lot of storage space, but also requires more time to build and maintain. In addition, when a new CPU or GPU architecture appears, the existing image is difficult to adapt in time.

[0007] In new computing modes such as multi-cloud computing, fog computing, and edge computing, compute migration is often required, that is, migrating computing tasks from the current execution machine to another execution machine. The execution machine of the migration target may be located on a different platform or architecture, resulting in container migration failure. The existing technology urgently needs a new container packaging method that can replace the existing container image and has the characteristics of small size, fast construction, and cross-platform to meet the requirements of dynamic migration and multi-platform compatibility.

[0008] like Figure 1 As shown, Figure 1 For the existing system, the application is transferred to the container instance formed by the basic image on the development machine, and the software management tool inside the container instance is used to download and install the software that the application depends on. Finally, a container image is generated from the container instance and sent to the execution machine; the execution machine imports the image to directly generate a container instance.

[0009] The above three shortcomings in the current existing technology are caused by three inherent problems in the container image workflow:

[0010] Problem ⑴ The container image contains all the software, which should be reusable, resulting in disadvantages ⑴ and ⑶;

[0011] Problem ⑵ The container image builder only calls other package management tools from the outside and cannot actively control the package installation process in the container, resulting in disadvantage ⑵;

[0012] Problem ⑶: The container image is built by the developer, and the architecture information of the execution machine cannot be predicted in advance, resulting in disadvantage ⑶.

[0013] In summary, the above defects lead to technical problems such as large container image size, slow construction, and platform specificity. Therefore, there is an urgent need to propose a lightweight, componentized, and cross-platform container construction method and system. Summary of the invention

[0014] In order to solve the problems of large container image size, slow construction and platform specificity in the above-mentioned prior art, a lightweight, componentized and cross-platform container construction method and system are proposed.

[0015] In a first aspect, an embodiment of the present application provides a componentized container construction system, the system comprising:

[0016] External software source module: used to collect different external software sources and provide a unified access interface for container component sources;

[0017] Container component source module: used to convert external software into container components and store the container components;

[0018] Development machine module: used to read the application, analyze the software that the application depends on, interact with the container component source module to confirm the container component information, and generate a list of dependent software; package the application and the list of dependent software into a task closure;

[0019] Execution machine module: used to read the list of dependent software in the task closure, interact with the container component source module to obtain the container component information that meets the dependent software requirements, and select the container component to be used. Use the joint file system to merge the container component and the application in the task closure into a root file system, generate a container runtime configuration file based on the configuration information in the container component and the task closure, call the container runtime, and the system starts the container instance.

[0020] In a specific embodiment of the present invention, the above container component source module includes:

[0021] Component conversion module: used to access external software source modules according to the requirements of dependent software, download software and convert it into container components, and then transmit it back for storage;

[0022] Component storage module: used to receive container components sent by the component conversion module, exchange information with the execution machine module, and request the component conversion module to automatically convert when encountering unmet dependent software requirements. The container components come from the developer's upload or from automatic conversion from multiple external software sources.

[0023] In a specific embodiment of the present invention, the development machine module includes:

[0024] Dependency analysis module: used to read the application, analyze the software that the application depends on, interact with the container component source module to confirm component information, and generate a list of dependent software;

[0025] Task packaging module: packages the application and dependent software list into a task closure, transfers the task closure to the warehouse storage for the execution machine to access and download, or directly transfers it to the execution machine module through any data transmission method.

[0026] In a specific embodiment of the present invention, the execution machine module includes:

[0027] Dependency parsing module: used to read the dependent software list in the task closure, interact with the component storage module, obtain the container component information that can meet the dependent software requirements, and select the container component to be used;

[0028] Component cache module: used to cache container components and their information. When the cached container components cannot meet the requirements of dependent software, it interacts with the component storage module and obtains the container components. The container components cached by the component cache module include container components built by the execution machine and common container components from the container component source.

[0029] Container assembly module: used to use the joint file system to merge the container components and the applications in the task closure into a root file system, generate a container runtime configuration file based on the configuration information in the container components and the task closure, and call the container runtime system to start the container instance.

[0030] In a specific embodiment of the present invention, the dependency analysis module is configured to include:

[0031] Read the source code file of the application and analyze the programming language type of the application;

[0032] According to the programming language type, call different dependent software list generation logic; generate dependency information, interact with the component storage module, obtain the indirect dependent components of the component, and delete all indirect dependencies from the dependency information;

[0033] Export all direct dependency information of the application as a list of dependent software and allow users to further edit it.

[0034] In a specific embodiment of the present invention, the task packaging module is configured to include:

[0035] Check the format of the dependent software list. If there is a format error, you will be prompted to re-edit the dependent software list.

[0036] Package the application and the list of dependent software into an archive format to form a task closure;

[0037] If you choose to upload to the warehouse, upload the task closure, otherwise, export the task closure as a file.

[0038] In a specific embodiment of the present invention, the dependency parsing module includes:

[0039] Read the list of dependent software in the task closure, and perform operations on each item one by one, including: sending a dependency requirement triple to the component cache module, obtaining the path of the container component and recording it in the list, and returning an error message to the user and exiting if the component cache module reports an error, wherein the triple includes: <component type t, component name n, component version requirement s>;

[0040] Read the triplet information of the obtained container component, add the dependency requirements of this container component to the list of dependent software, run the conflict resolution algorithm if a dependency conflict occurs, and return an error message to the user and exit if the dependency conflict cannot be resolved;

[0041] If each dependent software has been mapped to a container component, all corresponding container component paths are stored for use by subsequent container assembly modules.

[0042] In a specific embodiment of the present invention, the component cache module is configured to include:

[0043] Get dependency requirement triples;

[0044] Check whether there is a component of component type t in the cache. If not, execute the exit step: send the dependency requirement triple and the platform feature information of the current execution machine to the component storage module, wait for the return of the container component that meets the dependency requirement, cache the returned container component, return the path to the dependency resolution module, and exit the component cache module;

[0045] Check whether there is a component with the component name n in the component type t in the cache. If not, enter the exit step;

[0046] Query all versions of component type t and component name n in the cache, check the rules according to the version requirements of the component type, and confirm whether the existing version meets the dependency requirements. If not, enter the exit step. If yes, select the most suitable version v based on the selection rules;

[0047] Query all environment variants of component type t, component name n and version v in the cache to confirm whether the existing environment variants meet the environment of this execution machine. If not, enter the exit step. If yes, select the most suitable environment variant e based on the selection rule;

[0048] Return the path of the container component of component type t, component name n, version v, and environment variant e in the cache to the dependency resolution module, and exit the execution component cache module;

[0049] If the container component source module returns an error, the error is reported to the dependency resolution module and the component cache module exits.

[0050] In a specific embodiment of the present invention, the container assembly module comprises:

[0051] Get all corresponding container component paths from the dependency resolution module;

[0052] Use a union file system to merge the application path in the task closure with the paths of all container components to form a root file system.

[0053] Generate a default configuration for the container runtime that meets the predetermined standards, read the configuration information in the container components and task closures, modify the default configuration, and generate the final runtime configuration file;

[0054] The root file system path and runtime configuration file are passed to the local container runtime system of the execution machine module, and the container runtime system is requested to start the container instance.

[0055] In a specific embodiment of the present invention, the component storage module includes:

[0056] Receive the dependency requirement triplet and the execution machine platform feature information requested by the execution machine module;

[0057] Query whether there is a component of component type t in the storage. If not, enter the exit step. The exit step is: send the dependency requirement triple and the execution machine platform feature information to the component conversion module, wait for the return of the container component that meets the dependency requirement, store and return the returned container component, and exit the component storage module;

[0058] Query whether there is a component with the component name n in the component type t in the storage, if not, enter the exit step;

[0059] Query all versions of component type t and component name n in the storage, check the rules according to the version requirements of the component type, and confirm whether the existing version meets the dependency requirements. If not, enter the exit step. If yes, select the most suitable version v based on the selection rules;

[0060] Query all environment variants of component type t, component name n and version v in the storage to confirm whether the existing environment variants meet the execution machine platform feature information. If not, enter the exit step. If yes, select the most suitable environment variant e based on the selection rule.

[0061] Return the container component of component type t, component name n, version v and environment variant e in the cache, and exit the component storage module;

[0062] If the component conversion module returns an error, it returns an error and exits the component storage module.

[0063] In a specific embodiment of the present invention, the component conversion module includes:

[0064] Receive the dependency requirement triplet and execution machine platform feature information requested by the component storage module;

[0065] Check whether there is a conversion function for type t. If not, an error is returned.

[0066] Initiate a request to an external software source of type t to obtain the software named n. If there is no software named n, an error is returned.

[0067] Query all versions of name n in the external software source, check the version requirement rules of component type t, and confirm whether the existing version meets the dependency requirements. If not, an error is returned. If yes, the most suitable version v is selected based on the selection rules;

[0068] Query all environment variants e of name n and version v in the external software source, confirm whether the existing environment variants meet the execution machine platform feature information, and return an error if not. If yes, select the most suitable environment variant e according to the selection rules;

[0069] Download software with name n, version v and environment variant e from an external software source;

[0070] Use the conversion logic of type t to convert the software into a container component and return it; if an error occurs during the conversion, an error is returned.

[0071] In a second aspect, an embodiment of the present application provides a componentized container construction method, which is applied to the above-mentioned componentized container construction system, and the method includes:

[0072] Step 1: The development machine module reads the application, analyzes the software that the application depends on, interacts with the container component source module to confirm the container component information, and generates a list of dependent software; the application and the list of dependent software are packaged into a task closure;

[0073] Step 2: Transfer the task closure to the execution machine, or upload it from the development machine to the warehouse and then download it from the warehouse;

[0074] Step 3: The execution machine module reads the dependent software list in the task closure, interacts with the container component source module to obtain the container component information that meets the dependent software requirements, and selects the container component to be used;

[0075] Step 4: When the container component source finds that a software dependency cannot be met, it automatically accesses the upstream software source, converts the upstream software package into a container component, and stores it;

[0076] Step 5: The executor downloads all container components, uses the union file system to merge the container components and the applications in the task closure into a root file system, generates a container runtime configuration file based on the configuration information in the container components and task closure, and starts the container instance from the root file system.

[0077] In a third aspect, an embodiment of the present application provides an electronic device, including a memory, a processor and the above-mentioned componentized container construction system, the componentized container construction system including: a development machine module, an execution machine module, a container component source module and an external software source module.

[0078] Compared with the related prior art, it has the following outstanding beneficial effects:

[0079] 1) The method of the present invention proposes that the task closure directly builds the container on the execution machine, without the need to build the container image on the development machine; there is no need to manually adapt the hardware platforms of various execution machines in advance, but the execution machine builder automatically adapts, saving labor costs; developers do not need to build corresponding images for each execution machine hardware platform, saving construction time, storage space and network transmission; the execution machine can automatically select the most suitable container component according to its own platform characteristics, thereby improving the local component reuse rate, saving construction time, and obtaining a container instance with high execution efficiency;

[0080] 2) The method of the present invention proposes to use code in the task closure to describe the environment, while the container image directly packages all the contents in the environment; the storage and transmission volume is greatly reduced; since the content in the environment is usually platform-specific (for example, some software can only be executed on a CPU of the x86-64 architecture or can only be executed on certain versions of GPUs), the container image is platform-specific, while the task closure uses platform-independent code when describing the environment, so a single task closure can be deployed across platforms;

[0081] 3) The method of the present invention proposes that the container component source will uniformly convert various software packages into a container component format that does not require installation, while the container image construction method requires the installation of multiple software managers first, and then the installation of software packages in multiple formats respectively; the builder of the task closure can uniformly manage software from multiple software sources, thereby supporting dependency management across software sources, making the construction process more stable and reducing the burden on software developers. Since the container component does not require installation, the construction time is saved. BRIEF DESCRIPTION OF THE DRAWINGS

[0082] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0083] Figure 1 This is a schematic diagram of the existing container system architecture;

[0084] Figure 2 A schematic diagram of the componentized container construction system architecture of the present invention;

[0085] Figure 3 A schematic diagram of the workflow of componentized container construction of the present invention;

[0086] Figure 4 A schematic diagram showing the comparison of network and storage consumption of the present invention;

[0087] Figure 5 This is a schematic diagram of the execution time comparison of the present invention;

[0088] Figure 6 This is a schematic diagram of the component container construction method of the present invention;

[0089] Figure 7 It is a hardware schematic diagram of the electronic device of the present invention. DETAILED DESCRIPTION

[0090] It should be noted that the processor described in the present invention is the control center of the electronic device, which may be a processor or a general term for multiple processing elements. For example, it may be one or more central processing units (CPUs), or application specific integrated circuits (ASICs), or one or more integrated circuits configured to implement the embodiments of the present invention, such as one or more digital signal processors (DSPs), or one or more field programmable gate arrays (FPGAs).

[0091] Optionally, the processor can perform various functions of the electronic device by running or executing a software program stored in the memory, and calling data stored in the memory.

[0092] In a specific implementation, as an embodiment, the processor may include one or more CPUs. Each of these processors may be a single core processor or a multi-core processor. The processor here may refer to one or more devices, circuits, and / or processing cores for processing data (e.g., computer program instructions). Electronic devices may include: servers, desktop computers, laptops, smart phones, tablet computers, embedded computers, etc., wherein the embedded computers include vehicles and robots, etc.

[0093] The memory is used to store the software program for executing the solution of the present invention, and the execution is controlled by the processor. The specific implementation method can refer to the above method embodiment, which will not be repeated here.

[0094] It should be noted that the structure of the electronic device shown in the drawings of the present invention does not constitute a limitation thereto, and the actual device may include more or fewer components than shown in the drawings, or a combination of certain components, or a different arrangement of components.

[0095] The above embodiments can be implemented in whole or in part by software, hardware (such as circuits), firmware or any other combination. When implemented by software, the above embodiments can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions or computer programs. When the computer instructions or computer programs are loaded or executed on a computer, the process or function described in the embodiment of the present invention is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from one website, computer, server or data center to another website, computer, server or data center by wired (such as infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or data center that contains one or more available media sets. The available medium can be a magnetic medium (for example, a floppy disk, a hard disk, a tape), an optical medium (for example, a DVD), or a semiconductor medium. The semiconductor medium can be a solid-state hard disk.

[0096] It should also be understood that the term "and / or" in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. A and B can be singular or plural. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship, but it may also indicate an "and / or" relationship. Please refer to the context for specific understanding.

[0097] In the present invention, "at least one" means one or more, and "more than one" means two or more. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b, or c can be represented by: a, b, c, ab, ac, bc, or abc, where a, b, c can be single or multiple.

[0098] It should also be understood that in various embodiments of the present invention, the size of the serial numbers of the above-mentioned processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.

[0099] In the several embodiments provided by the present invention, it should be understood that the disclosed devices, apparatuses and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of the units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0100] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0101] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.

[0102] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in various embodiments of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0103] In order to make the above features and effects of the present invention more clearly and understandably described, embodiments are given below and described in detail with reference to the accompanying drawings. This specification discloses one or more embodiments that include the features of the present invention. The disclosed embodiments are only for illustration. The scope of protection of the present invention is not limited to the disclosed embodiments, and the present invention is defined by the attached claims.

[0104] The following is a system embodiment corresponding to the above method embodiment. This embodiment can be implemented in conjunction with the above embodiment. The relevant technical details mentioned in the above embodiment are still valid in this embodiment. In order to reduce repetition, they are not repeated here. Accordingly, the relevant technical details mentioned in this embodiment can also be applied in the above embodiment.

[0105] The terms involved in the present invention are:

[0106] Container Technology: A lightweight virtualization technology that implements multiple isolated containers by dividing resources on a single operating system kernel. Each container runs an application, and resource usage between different containers is independent of each other, effectively balancing conflicts in resource usage requirements.

[0107] Container Image: Binary data that encapsulates an application and all its software dependencies. A container image is an independently executable software package that makes explicit assumptions about its runtime environment. A container image is a static template for a container instance that contains application code, runtime, libraries, environment variables, and runtime configuration files.

[0108] Image Builder: A tool or system used to create a container image from a build script (such as Dockerfile). By reading the build script, the image builder packages the application and its dependencies into a container image. Typical image builders include Docker buildx, Buildah, Kaniko, etc.

[0109] Container Instance: An independent, executable containerized environment created and run based on a container image. Each container instance is a specific running instance of a container image, with an independent lifecycle, resource allocation, and running processes. Container instances ensure the independence and security of applications through operating system-level isolation (such as namespaces and control groups).

[0110] Image Registry: A warehouse that centrally stores and manages container images, divided into public and private warehouses. Public warehouses (such as DockerHub) provide publicly accessible images, suitable for the distribution of open source projects and public applications. Private warehouses (such as Harbor) are used within the production environment, provide higher security and access control, and are suitable for storing private applications and sensitive images.

[0111] Container Runtime: A system responsible for loading container images and running them as container instances. The container runtime can read image files locally or download images from image repositories, and manage the life cycle of containers, including starting, stopping, monitoring, and destroying them. Typical container runtime systems include containerd, CRI-O, LXC, Podman, etc.

[0112] Docker: A widely used container technology platform in the industry that integrates a variety of container management tools. Docker includes the following key components: image builder Docker buildx, container runtime containerd, and default public image repository DockerHub. Docker provides a complete containerization solution, including image building, management, network configuration, storage integration and orchestration, which greatly simplifies the development, deployment and operation and maintenance process of container applications.

[0113] The present invention aims to propose a new container software package format (hereinafter referred to as "task closure"), as well as a component construction method for this format. The characteristics of task closure are that it contains an application and a list of dependent software, rather than an application and its complete dependent software, which solves the problem of large container image size; the process of building a container from a task closure is performed on an execution machine, and the builder reads the dependent software list, accesses a container component source, and actively obtains the container component adapted to the execution machine platform, which solves the problem of slow container image construction; the dependent software list in the task closure is a set of software names and version restrictions, does not restrict the architecture of the execution machine, has a cross-platform feature, and solves the problem that the container image only supports a single platform.

[0114] The method of the present invention solves the following major technical difficulties:

[0115] Difficulty ⑴ Accurate analysis of application-dependent software: Confirming the specific software dependencies of an application requires syntax analysis of the application's source code, or secondary processing using the analysis results of other dependency analysis software.

[0116] Difficulty (2) Compatibility with multiple software manager ecosystems: In order to access the ecosystems of various existing software managers, the construction system should understand the version expression rules, version selection priority sorting rules and platform-specific identification methods of multiple software managers, and select suitable components.

[0117] Difficulty ⑶ Cross-platform differences: For the same software dependency requirements, the indirect dependency components of different platforms may be different. Taking the machine learning framework as an example, for a platform that includes a GPU (graphics processing unit), a driver related to the GPU version model is required, while for a platform that only includes a CPU (central processing unit), no driver is required.

[0118] Difficulty (4) Installation-free components: Components need to be exempted from the installation process and can be directly merged into the root file system. Existing software packages usually need to be placed in a specific directory and perform operations such as compilation, building, and configuration. In order to achieve the ability to be directly merged, the existing software packages need to be preprocessed and precompiled to exempt the installation process and improve efficiency.

[0119] The following is a detailed description with reference to specific embodiments:

[0120] Embodiment 1

[0121] like Figure 2 As shown, Figure 2 The present invention does not run a container instance on the development machine, but directly performs dependency analysis on the application, and packages the application and the analysis results into a task closure and sends it to the execution machine; the execution machine obtains the container components suitable for the execution machine based on the dependency information in the task closure, and combines them to generate a container instance.

[0122] like Figure 3 As shown, the embodiment of the present application provides a componentized container construction system, the system comprising:

[0123] The external software source module 10 is used to collect software sources maintained by different organizations, companies or individuals, and provide a unified access interface for the component source 20. The container component source accesses these external software sources through network requests or application programming interfaces (APIs) to obtain software information and download software packages. External software sources include but are not limited to Python software sources (such as pypi.org), JavaScript software sources (such as npmjs.com), Debian software sources (such as packages.debian.org), etc.

[0124] The container component source module 20 is used to store container components; the container component source module 20 is a storage warehouse for container components, providing container components for one or more execution machines. The operation of the container component source is not limited to a specific computing device or computing architecture. It can be a centralized computing device, or a computing device including an authoritative computing device and a multi-level distributed cache, or multiple distributed computing devices, etc. The container components stored in the container component source support user upload or conversion from other software package formats. The container component source executes the component storage module and the component conversion module. The component storage module exchanges information with the component storage module of the execution machine. When encountering unmet dependent software requirements, it will request the component conversion module to try automatic conversion. The container components in the component storage module come from both the developer's upload and the automatic conversion from multiple external software sources. The component conversion module accesses the corresponding external software source according to the dependent software requirements, downloads the software and converts it into a container component, and transmits it back to the component storage module.

[0125] The development machine module 30 is used to read the application, analyze the software that the application depends on, interact with the container component source module to confirm the container component information, and generate a dependent software list; package the application and the dependent software list into a task closure;

[0126] In a specific embodiment of the present invention, the development machine module 30 is the producer of the task closure, and any computing device can assume this role. The development machine runs the dependency analysis module and the task packaging module. The dependency analysis module reads the application, analyzes the software it depends on, interacts with the component storage module of the container component source to confirm the component information, and generates a list of dependent software. The task packaging module packages the application and the list of dependent software into a task closure. After the development machine generates the task closure, it can transfer the task closure to the warehouse (i.e., the storage service or storage device of the task closure, which can be public or private) for the execution machine to access and download, or it can be directly transmitted to the execution machine through any data transmission method such as the network, removable storage, etc.

[0127] The execution machine module 40 is used to read the list of dependent software in the task closure, interact with the container component source module to obtain the container component information that meets the dependent software requirements, and select the container component to be used, and use the joint file system to merge the container component and the application in the task closure into a root file system, generate a container runtime configuration file based on the configuration information in the container component and the task closure, and start the container instance from the root file system.

[0128] The execution machine module 40 is a consumer of the task closure, which is used to run and manage containers. Any computing device can assume this role. The execution machine runs the dependency resolution module, the component cache module and the container assembly module. The dependency resolution module reads the list of dependent software in the task closure, interacts with the component storage module, obtains the container component information that can meet the dependent software requirements, and selects the container component to be used. The component cache module caches the container components and their information. When the container components cached by it cannot meet a certain dependent software requirement, it interacts with the component storage module of the container component source and obtains the container components. The component cache module caches both the container components built specifically for this execution machine and the more general container components from the container component source. The container assembly module uses a union file system (Union Filesystem) to merge the container components and the applications in the task closure into a root file system (RootFS), generates a container runtime configuration file based on the configuration information in the container components and the task closure, and calls the container runtime system to start the container instance.

[0129] In a specific embodiment of the present invention, the container component source module 20 includes:

[0130] Component conversion module 201: used to access the external software source module according to the requirements of the dependent software, download the software and convert it into a container component, and transmit it back for storage;

[0131] Component storage module 202: used to receive container components sent by the component conversion module, exchange information with the execution machine module, and request the component conversion module to automatically convert when encountering unmet dependent software requirements. The container components come from the developer's upload or from automatic conversion from multiple external software sources.

[0132] In a specific embodiment of the present invention, the development machine module 30 includes:

[0133] Dependency analysis module 301: used to read the application, analyze the software that the application depends on, interact with the container component source module to confirm component information, and generate a list of dependent software;

[0134] Task packaging module 302: packages the application and the dependent software list into a task closure, transmits the task closure to the warehouse storage for the execution machine to access and download, or directly transmits it to the execution machine module through any data transmission method.

[0135] In a specific embodiment of the present invention, the execution machine module 40 includes:

[0136] Dependency parsing module 401: used to read the dependent software list in the task closure, interact with the component storage module, obtain container component information that can meet the dependent software requirements, and select the container component to be used;

[0137] Component cache module 402: used to cache container components and their information. When the cached container components cannot meet the dependent software requirements, the component storage module interacts with the component storage module and obtains the container components. The container components cached by the component cache module include the container components specific to the execution machine and the general container components from the container component source.

[0138] Container assembly module 403: used to use a joint file system to merge the container component and the application in the task closure into a root file system, generate a container runtime configuration file according to the configuration information in the container component and the task closure, and call the container runtime system to start the container instance.

[0139] In a specific embodiment of the present invention, the component conversion module 201 includes:

[0140] Receive the dependency requirement triplet and execution machine platform feature information requested by the component storage module;

[0141] Check whether there is a conversion function for type t. If not, an error is returned.

[0142] Initiate a request to an external software source of type t to obtain the software named n. If there is no software named n, an error is returned.

[0143] Query all versions of name n in the external software source, check the rules according to the version requirements of component type t, and confirm whether the existing version meets the dependency requirements. If not, an error is returned. If yes, the most suitable version v is selected based on the selection rules;

[0144] Query all environment variants e of name n and version v in the external software source, confirm whether the existing environment variants meet the execution machine platform feature information, and return an error if not. If yes, select the most suitable environment variant e based on the selection rule;

[0145] Download software with name n, version v and environment variant e from an external software source;

[0146] Use the conversion logic of type t to convert the software into a container component and return it; if an error occurs during the conversion, an error is returned.

[0147] In a specific embodiment of the present invention, the component conversion module 201 includes: step (1) receiving a dependency requirement triple <component type t, component name n, component version requirement s> and execution machine platform feature information requested by a component storage module; step (2) querying whether there is a conversion function of type t, and returning an error if not; step (3) initiating a request to an external software source s of type t to obtain software with the name n, and returning an error if not; step (4) querying all versions of the name n in the external software source s, and confirming whether the existing version meets the dependency requirement according to the version requirement check rule of this component type, and returning an error if not, and selecting the most suitable version v based on the selection rule if yes; step (5) querying all environment variants of the name n version v in the external software source s, and confirming whether the existing environment variant meets the execution machine platform feature information, and returning an error if not, and selecting the most suitable environment variant e based on the selection rule if yes; step (6) downloading software of the name n version v environment variant e from the external software source s; step (7) using the conversion logic of type t to convert the software into a container component, and returning; if an error occurs during the conversion, an error is returned;

[0148] The selection rules of the above versions and environment variants are as follows: each external software source has its own unique version selection specification and environment variant selection specification (for example, Python software source uses PyPA specification, and Debian software source uses Debian Policy Manual);

[0149] Taking the Python language type software package as an example, during the conversion process to a container component, the file named "METADATA" in the ".dist-info" directory of the software package will be read to extract the dependency of this software package on the Python interpreter version and other Python software packages, and the information in the name of "entrypoint.txt" will be read to create an entry file, etc.

[0150] In a specific embodiment of the present invention, the component storage module 202 includes:

[0151] Receive the dependency requirement triplet and the execution machine platform feature information requested by the execution machine module;

[0152] Query whether there is a component of component type t in the storage. If not, enter the exit step. The exit step is: send the dependency requirement triple and the execution machine platform feature information to the component conversion module, wait for the return of the container component that meets the dependency requirement, store and return the returned container component, and exit the component storage module;

[0153] Query whether there is a component with the component name n in the component type t in the storage, if not, enter the exit step;

[0154] Query all versions of component type t and component name n in the storage, and confirm whether the existing version meets the dependency requirement according to the version requirement check rule of the component type. If not, enter the exit step. If yes, select the most suitable version v according to the version selection specification of each external software source;

[0155] Query all environment variants of component type t, component name n and version v in the storage to confirm whether the existing environment variants meet the execution machine platform feature information. If not, enter the exit step. If yes, select the most suitable environment variant e according to the selection rules;

[0156] Return the container component of component type t, component name n, version v and environment variant e in the cache, and exit the component storage module;

[0157] If the component conversion module returns an error, it returns an error and exits the component storage module.

[0158] In a specific embodiment of the present invention, the component storage module 202 includes: step (1) receiving a dependency requirement triple <component type t, component name n, component version requirement s> and the platform feature information of the execution machine requested by a certain execution machine; step (2) querying whether there is a component of type t in the storage, if not, proceeding to step 7; step (3) querying whether there is a component named n in the type t in the storage, if not, proceeding to step 7; step (4) querying all versions of type t name n in the storage, and confirming whether the existing version meets the dependency requirement according to the version requirement check rule of this component type, if not, proceeding to step 7, if yes, selecting the most suitable version v; step (5) querying the storage Check all environment variants of type t name n version v in the cache to confirm whether the existing environment variants meet the execution machine platform feature information. If not, go to step 7. If yes, select the most suitable environment variant e; step ⑹ returns the container component of type t name n version v environment variant e in the cache and exits this module; step ⑺ sends the dependency requirement triple <component type t, component name n, component version requirement s> and the execution machine platform feature information to the component conversion module, waits for it to return the container component that meets the dependency requirements, stores and returns the returned container component, and exits this module; step ⑻ returns an error and exits this module if the component conversion module returns an error.

[0159] In a specific embodiment of the present invention, the dependency analysis module 301 is configured to include:

[0160] Read the source code file of the application and analyze the programming language type of the application; finally, a programming language type can be obtained through various methods such as but not limited to file extension, file content, project metadata, etc.;

[0161] According to the programming language type, call different dependent software list generation logic; generate dependency information, interact with the component storage module, obtain the indirect dependent components of the component, and delete all indirect dependencies from the dependency information;

[0162] Export all direct dependency information of the application as a list of dependent software and allow users to further edit it.

[0163] In a specific embodiment of the present invention, the dependency analysis module 301 includes: step (1) reading the file list of the application folder, guessing the programming language type of the application according to the number of occurrences of different file extensions, and if the analyzed language type is not supported, the subsequent steps are not executed and the user is prompted to edit the dependency software list by himself; step (2) calling different dependency software list generation logics according to the programming language type; step (3) taking the application software of Python language as an example, first scanning the root directory file list of the program folder, and confirming one by one whether there is dependency information generated by other software or provided by the application software developer; step (4) if there is a file named requirements.txt (the analysis result generated by pipreqs software), Then call the corresponding converter, otherwise; step ⑸ if there is a file named pyproject.toml (the analysis result generated by the poetry software), then call the corresponding converter, otherwise; step ⑹ if there is no generated dependency information, then traverse and read each Python program, perform syntax analysis on it, extract the name of the imported Python library, and generate dependency information; step ⑺ read the dependency information generated in the above steps 4, 5 or 6, interact with the component storage module of the container component source, obtain the indirect dependency components of the component, and delete all indirect dependencies from the dependency information; step ⑻ export all direct dependency information of the application as a list of dependent software, and allow the user to further edit it.

[0164] In a specific embodiment of the present invention, the task packaging module is configured 302 to include:

[0165] Check the format of the dependent software list. If there is a format error, you will be prompted to re-edit the dependent software list.

[0166] Package the application and the list of dependent software into an archive format to form a task closure;

[0167] If you choose to upload to the warehouse, upload the task closure, otherwise, export the task closure as a file.

[0168] In a specific embodiment of the present invention, the task packaging module 302 includes: step (1) checking the format of the dependent software list, and if a format error occurs, reminding the user to re-edit the dependent software list; step (2) packaging the application and the dependent software list into an archive format to form a task closure; step (3) if the user chooses to upload it to the warehouse, uploading the task closure, otherwise; step (4) exporting the task closure as a file.

[0169] In a specific embodiment of the present invention, the dependency parsing module 401 includes:

[0170] Read the list of dependent software in the task closure, and perform operations on each item one by one, including: sending a dependency requirement triple to the component cache module, obtaining the path of the container component and recording it in the list, and returning an error message to the user and exiting if the component cache module reports an error, wherein the triple includes: <component type t, component name n, component version requirement s>;

[0171] Read the tuple information of the obtained container component, add the dependency requirements of this container component to the list of dependent software, run the conflict resolution algorithm if a dependency conflict occurs, and return an error message to the user and exit if the dependency conflict cannot be resolved;

[0172] If each dependent software has been mapped to a container component, all corresponding container component paths are stored for use by subsequent container assembly modules.

[0173] In a specific embodiment of the present invention, the dependency parsing module 401 includes: step (1) reading the list of dependent software in the task closure, and performing the following operations on each item one by one; step (2) sending a dependency requirement triple <component type t, component name n, component version requirement s> to the component cache module, obtaining the path of the container component and recording it in the list, if the component cache module reports an error, returning an error message to the user and exiting; step (3) reading the meta information of the container component obtained in the previous step, adding the dependency requirement of this container component to the list of dependent software, if a dependency conflict occurs, running the conflict handling algorithm, if the dependency conflict cannot be resolved, returning an error message to the user and exiting; step (4) if each dependent software has been mapped to a container component, then storing all corresponding container component paths for use by subsequent container assembly modules.

[0174] In a specific embodiment of the present invention, the component cache module configuration 402 includes:

[0175] Get dependency requirement triples;

[0176] Check whether there is a component of component type t in the cache. If not, execute the exit step: send the dependency requirement triple and the platform feature information of the current execution machine to the component storage module, wait for the return of the container component that meets the dependency requirement, cache the returned container component, return the path to the dependency resolution module, and exit the execution component cache;

[0177] Check whether there is a component with the component name n in the component type t in the cache. If not, enter the exit step;

[0178] Query all versions of component type t and component name n in the cache, check the rules according to the version requirements of the component type, and confirm whether the existing version meets the dependency requirements. If not, enter the exit step. If yes, select the most suitable version v based on the selection rules;

[0179] Query all environment variants of component type t, component name n and version v in the cache to confirm whether the existing environment variants meet the environment of this execution machine. If not, enter the exit step. If yes, select the most suitable environment variant e based on the selection rule;

[0180] Return the path of the container component of component type t, component name n, version v, and environment variant e in the cache to the dependency resolution module, and exit the execution component cache module;

[0181] If the container component source module returns an error, the error is reported to the dependency resolution module and the module exits.

[0182] In a specific embodiment of the present invention, the component cache module 402 includes: step (1) obtaining a dependency requirement triple <component type t, component name n, component version requirement s>; step (2) querying whether there is a component of type t in the cache, if not, proceeding to step 7; step (3) querying whether there is a component of type t with the name n in the cache, if not, proceeding to step 7; step (4) querying all versions of type t name n in the cache, and confirming whether the existing version meets the dependency requirement according to the version requirement check rule of this component type, if not, proceeding to step 7, if yes, selecting the most suitable version v; step (5) querying all loops of type t name n version v in the cache environment variant, confirm whether the existing environment variant meets the environment of this execution machine. If not, go to step 7. If yes, select the most suitable environment variant e; step (6) returns the path of the container component of type t name n version v environment variant e in the cache to the dependency resolution module and exits this module; step (7) sends the dependency requirement triple and the platform feature information of this execution machine to the component storage module of the container component source, waits for it to return the container component that meets the dependency requirement, caches the returned container component, and returns the path to the dependency resolution module, and exits this module; step (8) if the container component source returns an error, reports the error to the dependency resolution module and exits this module.

[0183] In a specific embodiment of the present invention, the container assembly module 403 includes:

[0184] Get all corresponding container component paths from the dependency resolution module;

[0185] Use a union file system to merge the application path in the task closure with the paths of all container components to form a root file system.

[0186] Generate a default configuration for the container runtime that meets the predetermined standards, read the configuration information in the container components and task closures, modify the default configuration, and generate the final runtime configuration file;

[0187] The root file system path and runtime configuration file are passed to the local container runtime system of the execution machine module, and the container runtime system is requested to start the container instance.

[0188] In a specific embodiment of the present invention, the container assembly module 403 includes: step (1) obtaining the local paths of all required modules from the dependency resolution module; step (2) using a joint file system, including but not limited to OverlayFS, AUFS, etc., to merge the path of the application in the task closure and the paths of all container modules to form a root file system; step (3) generating a container runtime default configuration that complies with the OCI standard, and reading the configuration information in the container component and the task closure, modifying the default configuration, and generating a final runtime configuration file; step (4) passing the path of the root file system and the runtime configuration file to the container runtime system local to the execution machine, including but not limited to runc, containerd, CRI-O, gVisor, etc., requesting the container runtime system to start the container instance.

[0189] In summary, the componentized container construction method and system proposed by the inventors have the advantages of small size, fast construction, cross-platform and high sharing compared with the existing container image construction systems. In a specific quantitative comparison experiment, the task closure system was compared with the three most widely used container image construction systems (Docker, Buildah, Apptainer), and the test set was 9 real and commonly used open source applications in the field of machine learning (CLIP, LoRA, SAM2, StableBaselines 3, Stable Diffusion, Transformers, TTS, Whisper, YOLO11). In this experiment, all files to be transmitted during the construction process were cached in advance to the proxy server to ensure the stability and consistency of network conditions during the experiment.

[0190] like Figure 4As shown in the figure, the difference in network and storage: the volume of task closures is reduced by an average of 94% compared to the volume of container images, and the volume of container instances built by task closures is reduced by an average of 36% compared to the volume of container instances loaded by container images. For network transmission volume, the task closure system reduces it by an average of 97% on the development machine and 55% on the execution machine. In addition, the storage sharing rate between container instances built by task closures is 58%, while the storage sharing rate between container instances generated by images is only 20%;

[0191] like Figure 5 As shown in the figure, the difference in execution time: the time consumed by the task closure system on the development machine is reduced by 98% on average, the time consumed on the execution machine is reduced by 67% on average, and the total time is reduced by 92% on average. If only the duration of the build operation is considered, the task closure system is reduced by 87% on average compared to the container image system;

[0192] Qualitative experiments show that a single task closure supports execution machine platforms with multiple GPU models (such as multiple models of products from NVIDIA and AMD) and multiple CPU models (such as x86-64 and arm64).

[0193] Embodiment 2

[0194] like Figure 6 As shown, the embodiment of the present application provides a componentized container construction method, which is applied to the above-mentioned componentized container construction system, and the method includes:

[0195] Step 1: The development machine module reads the application, analyzes the software that the application depends on, interacts with the container component source module to confirm the container component information, and generates a list of dependent software; the application and the list of dependent software are packaged into a task closure;

[0196] Step 2: Transfer the task closure to the execution machine, or upload it from the development machine to the warehouse and then download it from the warehouse;

[0197] Step 3: The execution machine module reads the dependent software list in the task closure, interacts with the container component source module to obtain the container component information that meets the dependent software requirements, and selects the container component to be used;

[0198] Step 4: When the container component source finds that a software dependency cannot be met, it automatically accesses the upstream software source, converts the upstream software package into a container component, and stores it;

[0199] Step 5: The executor downloads all container components, uses the union file system to merge the container components and the applications in the task closure into a root file system, generates a container runtime configuration file based on the configuration information in the container components and task closure, and starts the container instance from the root file system.

[0200] Embodiment 3

[0201] like Figure 7 As shown, Figure 7 The hardware structure diagram of the computing device according to the embodiment of the present application is shown in FIG. The embodiment of the present application provides an electronic device, including a memory, a processor and the above-mentioned componentized container construction system, the componentized container construction system including: a development machine module, an execution machine module, a container component source module and an external software source module.

[0202] In some of these embodiments, the computing device may further include a communication interface 83 and a bus 80. Figure 7 As shown, the componentized container construction system 81, the memory 82, and the communication interface 83 are connected through a bus 80 and communicate with each other.

[0203] The componentized container construction method and system can be run on any computer (including servers, personal computers, IoT devices, etc.), and the system operating environment includes but is not limited to Linux systems, Windows systems, and Mac systems.

[0204] Specifically, the componentized container construction system 81 may include a development machine module, an execution machine module, a container component source module, and an external software source module;

[0205] The memory 82 may be used to store or cache various data files that need to be processed and / or used for communication, as well as possible computer program instructions executed by the componentized container construction system 81 .

[0206] The componentized container construction system 81 implements any one of the componentized container construction computing methods in the above embodiments by reading and executing computer program instructions stored in the memory 82 .

[0207] The technical features of the above-described embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above-described embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0208] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.

Claims

1. A componentized container construction system, characterized in that: The system comprises: External software source module: used to collect different external software sources and provide a unified access interface for container component sources; Container component source module: used to convert external software into container components and store the container components; Development machine module: used to read the application, analyze the software that the application depends on, interact with the container component source module to confirm the container component information, and generate a list of dependent software; package the application and the list of dependent software into a task closure; Execution machine module: used to read the list of dependent software in the task closure, interact with the container component source module to obtain container component information that meets the dependent software requirements, and select the container component to be used, use a joint file system to merge the container component and the application in the task closure into a root file system, generate a container runtime configuration file based on the configuration information in the container component and the task closure, call the container runtime, and the system starts the container instance.

2. The componentized container system according to claim 1, characterized in that: The container component source module includes: Component conversion module: used to access the external software source module according to the requirements of the dependent software, download the software and convert it into a container component, and transmit it back for storage; Component storage module: used to receive the container component sent by the component conversion module, exchange information with the execution machine module, and when encountering unmet dependent software requirements, request the component conversion module to automatically convert, wherein the container component comes from the developer's upload or from automatic conversion from multiple external software sources.

3. The componentized container construction system according to claim 1, characterized in that: The development machine module includes: Dependency analysis module: used to read the application, analyze the software that the application depends on, interact with the container component source module to confirm component information, and generate a list of dependent software; Task packaging module: packages the application and the dependent software list into a task closure, transmits the task closure to a warehouse for storage for access and download by the execution machine, or directly transmits it to the execution machine module through any data transmission method.

4. The componentized container construction system according to claim 2, characterized in that: The execution machine module comprises: Dependency parsing module: used to read the dependent software list in the task closure, interact with the component storage module, obtain container component information that can meet the dependent software requirements, and select the container component to be used; Component cache module: used to cache the container component and its information, and when the cached container component cannot meet the dependent software requirements, interact with the component storage module and obtain the container component, wherein the container component cached by the component cache module includes the container component constructed by the execution machine and the common container component from the container component source; Container assembly module: used to use a joint file system to merge the container component and the application in the task closure into a root file system, generate a container runtime configuration file based on the configuration information in the container component and the task closure, and start the container when calling the container runtime system.

5. The componentized container system according to claim 3, characterized in that: The dependency analysis module is configured to include: Read the source code file of the application and analyze the programming language type of the application; According to the programming language type, different dependent software list generation logics are called; dependency information is generated, and the component storage module is interacted with to obtain the indirect dependent components of the component, and all indirect dependencies are deleted from the dependency information; Export all direct dependency information of the application as a list of dependent software and allow users to further edit it.

6. The componentized container system according to claim 3, characterized in that: The task packaging module is configured to include: Performing a format check on the dependent software list, and if a format error occurs, prompting a user to re-edit the dependent software list; Packaging the application and the list of dependent software into an archive format to form a task closure; If you choose to upload to the warehouse, upload the task closure, otherwise, export the task closure as a file.

7. The componentized container system according to claim 4, characterized in that: The dependency parsing module includes: Read the list of dependent software in the task closure, and operate each item one by one, including: sending a dependency requirement triple to the component cache module, obtaining the path of the container component and recording it in the list, and returning an error message to the user and exiting if the component cache module reports an error, wherein the triple includes: <component type t, component name n, component version requirement s>; Read the triplet information of the obtained container component, add the dependency requirements of the container component to the list of dependent software, run the conflict resolution algorithm if a dependency conflict occurs, and return an error message to the user and exit if the dependency conflict cannot be resolved; If each of the dependent software items has been mapped to a container component, all corresponding container component paths are stored for subsequent use by the container assembly module.

8. The componentized container system according to claim 7, characterized in that: The component cache module is configured to include: Obtaining the dependency requirement triplet; Check whether there is a component of the component type t in the cache, and if not, execute the exit step: send the dependency requirement triple and the platform feature information of the current execution machine to the component storage module, wait for the return of the container component that meets the dependency requirement, cache the returned container component, return the path to the dependency resolution module, and exit the component cache module; Check whether there is a component with the component name n in the component type t in the cache, and if not, enter the exit step; Query all versions of the component type t and the component name n in the cache, and confirm whether the existing version meets the dependency requirement according to the version requirement check rule of the component type. If not, enter the exit step. If yes, select the most suitable version v based on the selection rule; Query the cache for all environment variants of the component type t, the component name n, and the version v, and confirm whether the existing environment variants meet the environment of the current execution machine. If not, enter the exit step. If yes, select the most suitable environment variant e based on the selection rule. Return the path of the container component of the component type t, the component name n, the version v and the environment variant e in the cache to the dependency resolution module, and exit the execution component cache module; If the container component source module returns an error, the error is reported to the dependency resolution module and the component cache module exits.

9. The componentized container system according to claim 4, characterized in that: The container assembly module comprises: Obtain all corresponding container component paths from the dependency resolution module; Using a union file system, merging the path of the application in the task closure and the paths of all container components to form a root file system; Generate a default configuration of the container runtime that meets the predetermined standards, read the configuration information in the container component and task closure, modify the default configuration, and generate the final runtime configuration file; The path and runtime configuration file of the root file system are passed to the local container runtime system of the execution machine module, and the container runtime system is requested to start the container instance.

10. The componentized container system according to claim 7, characterized in that: The component storage module includes: Receive the dependency requirement triplet and execution machine platform feature information requested by the execution machine module; Query whether there is a component of the component type t in the storage, and if not, enter the exit step, the exit step is: send the dependency requirement triple and the execution machine platform feature information to the component conversion module, wait for the return of the container component that meets the dependency requirement, store and return the returned container component, and exit the component storage module; Query whether there is a component with the component name n in the component type t in the storage, and if not, enter the exit step; Query all versions of the component type t and the component name n in the storage, and confirm whether the existing version meets the dependency requirement according to the version requirement check rule of the component type. If not, enter the exit step. If yes, select the most suitable version v based on the selection rule; Query all environment variants of the component type t, the component name n and the version v in the storage to confirm whether the existing environment variants meet the execution machine platform feature information. If not, enter the exit step. If yes, select the most suitable environment variant e based on the selection rule. Return the container component of the component type t, the component name n, the version v and the environment variant e in the cache, and exit the component storage module; If the component conversion module returns an error, then the error is returned and the component storage module is exited.

11. The componentized container system according to claim 10, characterized in that: The component conversion module includes: receiving the dependency requirement triplet and execution machine platform feature information requested by the component storage module; Check whether there is a conversion function for type t. If not, an error is returned. Initiate a request to the external software source of the type t to obtain the software named n, and return an error if there is no software named n; Query all versions of the name n in the external software source, and confirm whether the existing version meets the dependency requirements according to the version requirement check rule of the component type t. If not, an error is returned. If yes, the most suitable version v is selected based on the selection rule. Query all environment variants e of name n and version v in the external software source, confirm whether the existing environment variants meet the execution machine platform feature information, and return an error if not, and select the most suitable environment variant e based on the selection rule if yes; Download software with name n, version v and environment variant e from an external software source; Use the conversion logic of the type t to convert the software into a container component and return it; if an error occurs during the conversion, an error is returned.

12. A componentized container construction method, applied to the componentized container construction system according to any one of claims 1 to 11, characterized in that: The method comprises: Step 1: The development machine module reads the application, analyzes the software that the application depends on, interacts with the container component source module to confirm the container component information, and generates a list of dependent software; the application and the list of dependent software are packaged into a task closure; Step 2: Transfer the task closure to the execution machine, or upload it from the development machine to the warehouse and then download it from the warehouse; Step 3: The execution machine module reads the dependent software list in the task closure, interacts with the container component source module to obtain the container component information that meets the dependent software requirements, and selects the container component to be used; Step 4: When the container component source finds that a software dependency cannot be met, it automatically accesses the upstream software source, converts the upstream software package into a container component, and stores it; Step 5: The executor downloads all container components, uses the union file system to merge the container components and the applications in the task closure into a root file system, generates a container runtime configuration file based on the configuration information in the container components and task closure, and starts the container instance from the root file system.

13. An electronic device comprising a memory, a processor and the componentized container construction system according to any one of claims 1 to 11, characterized in that: The componentized container construction system includes: an external software source module, a container component source module, a development machine module and an execution machine module.

Citation Information

Patent Citations

  • Container-based cloud computing platform task processing method, system and application method thereof

    CN109376017A

  • Method and system for realizing containerization of application program

    CN113821219A

  • Component-based construction method and device for applet, equipment and medium

    CN114489647A

  • Software package construction method and device

    CN115639986A

  • Automatic container definition

    US9367305B1

Cited By

  • Software customization method and system in ISO mirror image of LINUX operating system

    CN120578371A