Container engines and their implementation methods, electronic devices, and storage media.

By splitting the container engine into different components, management nodes and worker nodes, and using communication protocols to interact, the problem of excessive resource consumption by worker nodes is solved, and efficient resource utilization is achieved.

CN115994014BActive Publication Date: 2026-07-17ZTE CORP

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
ZTE CORP
Filing Date
2021-10-18
Publication Date
2026-07-17

AI Technical Summary

Technical Problem

Existing container engines suffer from excessive CPU and memory consumption on worker nodes, which is particularly prominent in resource-constrained IoT clusters.

Method used

The container engine is split into a first device located on the management node and a second device located on the worker node. The first device contains the container engine core module, and the second device contains the container pad module and the container runtime module. They interact through a communication protocol to reduce resource consumption.

Benefits of technology

While integrating with the existing container engine orchestration system, it saves on the resource consumption of worker nodes and improves resource utilization efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115994014B_ABST
    Figure CN115994014B_ABST
Patent Text Reader

Abstract

This application provides a container engine and a method for implementing the container engine, an electronic device, and a computer-readable storage medium. The method for implementing a container engine applied to a first device located on a management node includes: sending a container operation request to a second device using a communication protocol; and receiving a container operation response sent by the second device using the communication protocol. The method for implementing a container engine applied to a second device located on a management node or a worker node includes: receiving a container operation request sent by the first device using a communication protocol, performing container operations; and sending a container operation response to the first device using the communication protocol.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of cloud computing container technology, and particularly to container engines and methods for implementing container engines, electronic devices, and computer-readable storage media. Background Technology

[0002] As a popular technology in the field of cloud computing, container technology provides an independent execution environment for business applications. At the same time, the deployment, startup and deletion of containers are rapid and have zero performance loss on the central processing unit (CPU), memory and input / output (IO).

[0003] In the container field, container engines such as Docker, Containerd, and CRI-O (Container Runtime Interface Open) have emerged. These container engines provide application programming interfaces (APIs) and command lines, offering container image management and container lifecycle management capabilities through these APIs and command lines. Currently, widely used container engines such as Docker, Containerd, and CRI-O are typically deployed on worker nodes along with the node agents of a container orchestration system, while the management node only deploys the API of the container orchestration system. This deployment method leads to the problem of excessive consumption of CPU and memory resources on the worker nodes by the container engine and the node agents of the container orchestration system. Summary of the Invention

[0004] This application provides a container engine and a method for implementing the container engine, an electronic device, and a computer-readable storage medium.

[0005] In a first aspect, embodiments of this application provide a method for implementing a container engine, applied to a first device located on a management node. The method includes: sending a container operation request to a second device using a communication protocol; and receiving a container operation response sent by the second device using the communication protocol.

[0006] Secondly, embodiments of this application provide a method for implementing a container engine, applied to a second device located on a management node or a worker node. The method includes: receiving a container operation request sent by the first device using a communication protocol, performing container operations; and sending a container operation response to the first device using the communication protocol.

[0007] Thirdly, embodiments of this application provide an electronic device, including: at least one processor; and a memory storing at least one program, which, when executed by the at least one processor, implements any of the above-described container engine implementation methods.

[0008] Fourthly, embodiments of this application provide a computer-readable storage medium storing a computer program, which, when executed by a processor, implements any of the above-described container engine implementation methods.

[0009] Fifthly, embodiments of this application provide a container engine, including: a first device and a second device; the first device is disposed on a management node, and the second device is disposed on a management node or a worker node; wherein, the first device includes a container engine core module, the container engine core module including: a container management submodule, used to send a container operation request to a master-end agent submodule; the master-end agent submodule is used to send a container operation request to a container operation submodule of the second device using a communication protocol; and to receive a container operation response sent by the container operation submodule of the second device using the communication protocol; wherein, the second device includes: a container pad module and a container runtime module; the container pad module includes: a container operation submodule, used to receive a container operation request sent by the master-end agent submodule of the first device using the communication protocol, and to send the container operation request to the container runtime module; the container runtime module is used to perform container operations and send a container operation response to the container operation submodule; the container operation submodule is further used to: send a container operation response to the master-end agent submodule of the first device using the communication protocol.

[0010] The container engine provided in this application embodiment is implemented by splitting the container engine into a first device and a second device. The first device is set in the management node, and the second device is set in the management node or the worker node. The core module of the container engine is retained in the first device, without changing the way the container engine orchestration system interfaces with the container engine. Furthermore, the container pad module and the container runtime module are retained in the second device. Since the container pad module and the container runtime module consume relatively few resources, while the core module of the container engine consumes relatively many resources, this application embodiment saves the resource consumption of the worker node while using the original container engine orchestration system to interface with the container engine. Attached Figure Description

[0011] Figure 1 This is a schematic diagram of the structure of a container engine in related technologies;

[0012] Figure 2 A block diagram illustrating the composition of a container engine provided in an embodiment of this application;

[0013] Figure 3 A flowchart illustrating an implementation method of a container engine applied to a management node, as provided in one embodiment of this application;

[0014] Figure 4 A flowchart illustrating an implementation method of a container engine applied to a worker node, provided as another embodiment of this application. Detailed Implementation

[0015] To enable those skilled in the art to better understand the technical solutions of this application, the container engine and its implementation method, electronic device, and computer-readable storage medium provided in this application will be described in detail below with reference to the accompanying drawings.

[0016] Exemplary embodiments will be described more fully below with reference to the accompanying drawings; however, these exemplary embodiments may be embodied in different forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided so that this application will be thorough and complete, and will enable those skilled in the art to fully understand the scope of this application.

[0017] Where there is no conflict, the various embodiments of this application and the features thereof may be combined with each other.

[0018] As used herein, the term “and / or” includes any and all combinations of at least one related enumerated entry.

[0019] The terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the application. As used herein, the singular forms “a” and “the” are also intended to include the plural forms unless the context clearly indicates otherwise. It will also be understood that when the terms “comprising” and / or “made of” are used in this specification, the presence of the stated feature, integral, step, operation, element, and / or component is specified, but the presence or addition of at least one other feature, integral, step, operation, element, component, and / or group thereof is not excluded.

[0020] Unless otherwise specified, all terms used herein (including technical and scientific terms) have the same meaning as commonly understood by one of ordinary skill in the art. It will also be understood that terms such as those defined in commonly used dictionaries should be interpreted as having a meaning consistent with their meaning in the context of the relevant art and this application, and will not be interpreted as having an idealized or overly formal meaning, unless expressly so defined herein.

[0021] In the container field, container engines such as Docker, Containerd, and CRI-O have emerged. These engines provide APIs and command lines, offering container image management and container lifecycle management capabilities. Currently, widely used container engines like Docker, Containerd, and CRI-O can be functionally divided into the following main modules: the container engine core module, the container pad module, and the container runtime module, such as... Figure 1 As shown, the core modules of the container engine specifically include: API submodule, client submodule, container management submodule, container image management submodule, node management submodule, and image storage submodule; the container pad module specifically includes: input / output forwarding submodule, container resource reclamation submodule, and container operation submodule; the container runtime module specifically includes: Open Container Initiative (OCI) runtime submodule or LXC (Linux Container) submodule.

[0022] The functions of each submodule are described below.

[0023] The API submodule is responsible for providing container engine functionality and service software interface submodules to external entities (such as container orchestration systems).

[0024] The client submodule is responsible for the command-line tools provided by the container engine for container and image operations.

[0025] The container management submodule is responsible for managing the lifecycle states of containers, including creation, running, stopping, and deletion.

[0026] The container image management submodule is responsible for managing image status and the relationships between images.

[0027] The node management submodule is responsible for managing node resources and security status information.

[0028] The image storage submodule is responsible for managing the actual files or devices of the image, as well as reading and writing the image content.

[0029] The input / output forwarding submodule is responsible for forwarding external inputs to the container and forwarding the container's outputs to the container engine.

[0030] The container resource reclamation submodule is responsible for reclaiming the system resources consumed by dead containers.

[0031] The container operation submodule is responsible for calling the container runtime module to directly initiate operations such as creating, running, stopping, deleting, and viewing the container.

[0032] The OCI runtime submodule is a container runtime tool that conforms to the OCI specification definition. It is responsible for performing specific operations such as creating, running, stopping, deleting, and viewing containers on the operating system.

[0033] The LXC submodule is provided by the open-source Linux Container project and consists of tools or dynamic libraries that enable the creation, running, stopping, deleting, and viewing of containers on Linux.

[0034] Container engines provide API or client submodules to container orchestration systems. Container orchestration systems (such as Kubernetes, K3S, etc.) use these API or client submodules to instruct the container engine to perform image management functions such as image creation, deletion, querying, importing, exporting, pulling images from repositories, and pushing images to repositories, as well as container management functions such as container creation, deletion, startup, stopping, pausing, resuming, and status querying. In current container engine implementations, functions like container creation, deletion, startup, stopping, pausing, and resuming—which are typically achieved by calling the underlying operating system—are integrated into the OCI runtime submodule or LXC submodule. Internally, the container engine maintains a container lifecycle state management mechanism, and container operations are performed by the container operation submodule by calling the OCI runtime submodule or LXC submodule. To handle resource reclamation at the exit point of internal processes and to relay standard input, standard output, and standard error of internal processes, container engines employ container padding modules.

[0035] The emergence of major container orchestration systems such as Kubernetes (K8S), K3S, and Docker Swarm has made deploying and upgrading containers in cluster environments much more convenient. This has created a cloud computing cluster with the container orchestration system as the management entry point and the container engine as the working unit. Business developers can quickly deploy business process groups as containers to nodes within the cluster through the container orchestration system. In such a cloud computing cluster, each physical device (such as a server or board) is divided into management nodes and worker nodes according to the different functional units they support. Management nodes are often servers or boards with sufficient CPU, memory, and storage resources, and the container orchestration system is deployed on the management nodes. Worker nodes are generally servers or boards with limited CPU, memory, and storage resources, and the container orchestration agent and container engine are deployed on the worker nodes, with the containers running on the container engine. Depending on the cluster design's reliability, response rate, and other indicators, one or more management nodes can be deployed in the cluster; depending on the cluster's workload indicators, one or more worker nodes can be deployed in the cluster. In extreme cases, management nodes and worker nodes may reside on the same physical device.

[0036] In a typical cloud computing cluster, the management node deploys the container orchestration system's API, while the worker nodes deploy the container orchestration system's node agents and container engines. When a user needs to create a container, they simply send a command to the container orchestration system's API on the management node. The API then instructs the container engine through the node agents to complete the actual container creation, startup, and management. However, the container engine and the container orchestration system's node agents on the worker nodes excessively consume the worker nodes' CPU and memory resources. For example, using the open-source Containerd engine, creating and starting 500 containers requires 300 megabytes (MB) of memory. This is unacceptable for resource-constrained clusters with embedded devices as worker nodes, especially in the Internet of Things (IoT) cluster field. If only the OCI runtime submodule or LXC submodule is deployed on the worker nodes, then adaptation modules need to be developed to meet the container orchestration system's requirements for calling the container engine, resulting in a large development workload and system instability.

[0037] Figure 2 This is a block diagram illustrating the components of a container engine provided in an embodiment of this application. Figure 2 As shown, in this embodiment of the application, the deployment structure of the container engine on the cluster is modified, and the container engine is split into a first device 201 and at least one second device 202. The first device 201 and the second device 202 are completely independent.

[0038] In this configuration, the first device 201 and the second device 202 operate in a master-slave mode, such as one master and one slave, or one master and multiple slaves. Specifically, the first device 201 is the master device, located on the management node, and the second device 202 is the slave device, located on the worker nodes. In some cases, the first device 201 and the second device 202 can be simultaneously located on the management node, meaning the management node also functions as a worker node.

[0039] The first device 201 and the second device 202 can be linked using any of the following technologies: bus technology, wired network technology, and wireless network technology.

[0040] The first device 201 includes a container engine core module 2011, and the second device 202 includes a slave agent module 2021, a container pad module 2022, and a container runtime module 2023.

[0041] The container engine core module 2011 includes: API submodule, client submodule, container management submodule, container image management submodule, and master proxy submodule.

[0042] In some exemplary embodiments, the slave proxy module 2021 includes a communication submodule, a mirror storage submodule, and a node management submodule. In other exemplary embodiments, the slave proxy module 2021 includes a communication submodule and a node management submodule, while the mirror storage submodule is a separate module. In still other exemplary embodiments, the slave proxy module 2021 includes a communication submodule and a mirror storage submodule, while the node management submodule is a separate module. In still other exemplary embodiments, the slave proxy module 2021 includes a communication submodule, while the mirror storage submodule and the node management submodule are both separate modules.

[0043] The container pad module 2022 includes: an input / output forwarding submodule, a container resource recycling submodule, and a container operation submodule.

[0044] The container runtime module 2023 includes either the OCI runtime submodule or the LXC submodule.

[0045] In some exemplary embodiments, the first device 201 communicates with the second device 202 using a Remote Procedure Call Protocol (RPC), that is, it uses RPC to call the second device 202 to implement the corresponding function. For example, the master proxy submodule communicates with the slave proxy module 2021 using RPC, that is, it uses RPC to call the slave proxy module 2021 to implement the corresponding function.

[0046] In some exemplary embodiments, when the first device 201 and the second device 202 are both located on the management node, the first device 201 communicates with the second device 202 using Unix sockets (Sock) or inter-process communication (IPC). For example, the master agent submodule communicates with the slave agent module 2021 using Unix Sock or IPC.

[0047] In some exemplary embodiments, the communication between the first device 201 and the second device 202 is established using a client / server model. For example, the first device 201 acts as the client, and the second device 202 acts as the server. Thus, after the second device 202 starts up, it listens on its own address and port, while the first device 201, after powering on, obtains the address and port of the second device 202 and actively establishes a connection and registers with the second device 202 based on its address and port.

[0048] In some exemplary embodiments, when the mirror storage submodule is a standalone module, the slave agent module 2021 and the mirror storage submodule communicate using IPC. When the mirror storage submodule is a submodule of the slave agent module 2021, the mirror storage submodule and the slave agent module 2021 share the same process, thus reducing the second device 202's consumption of process resources.

[0049] In some exemplary embodiments, when the image storage submodule is a standalone module, the master proxy submodule communicates indirectly with the image storage submodule via RPC through the slave proxy module 2021. In other exemplary embodiments, when the image storage submodule is a standalone module, the master proxy submodule communicates directly with the image storage submodule via RPC.

[0050] In some exemplary embodiments, when the node management submodule is a standalone module, the slave agent module 2021 and the node management submodule communicate using IPC. When the node management submodule is a submodule of the slave agent module 2021, the node management submodule and the slave agent module 2021 share the same process, thus reducing the second device 202's consumption of process resources.

[0051] In some exemplary embodiments, when the node management submodule is a standalone module, the master proxy submodule communicates indirectly with the node management submodule via RPC through the slave proxy module 2021. In other exemplary embodiments, when the node management submodule is a standalone module, the master proxy submodule communicates directly with the node management submodule via RPC.

[0052] In some exemplary embodiments, the container pad module 2022, the container runtime module 2023, and the slave agent module 2021 are implemented using independent processes. The container pad module 2022 communicates with the slave agent module 2021 using IPC, and the container runtime module 2023 communicates with the slave agent module 2021 using IPC.

[0053] In some exemplary embodiments, the master proxy submodule communicates directly with the container pad module 2022 using ttrpc, thereby accelerating container operations. Here, ttrpc is the codename for an open-source software project, such as the GRPC implementation for low-memory environments.

[0054] In some exemplary embodiments, the master proxy submodule uses RPC to communicate indirectly with the container pad module 2022 via the slave proxy module 2021.

[0055] In some exemplary embodiments, the container pad module 2022 calls the container runtime module 2023 to perform container operations, thereby simplifying the slave agent module 2021.

[0056] The aforementioned modification to the container engine architecture will lead to changes in some of the internal implementation methods of the container engine. The following describes the internal implementation methods based on the modified container engine. It should be noted that the following description is not the complete implementation process of the container engine, but rather some implementation processes that differ from the internal implementation methods of the container engine before the modification. The described implementation methods are not intended to limit the implementation process of the modified container engine.

[0057] Figure 3 This is a flowchart illustrating an implementation method of a container engine applied to a management node, as provided in one embodiment of this application.

[0058] Firstly, referring to Figure 3 One embodiment of this application provides a method for implementing a container engine, applied to a first device set on a management node, the method comprising:

[0059] Step 300: Send a container operation request to the second device using a communication protocol.

[0060] In some exemplary embodiments, the communication protocol includes any one of the following: RPC, socket, and IPC. Specifically, if both the first device and the second device are located on the management node, the communication protocol used may be socket or IPC; if the first device is located on the management node and the second device is located on the worker node, the communication protocol used may be RPC.

[0061] In some exemplary embodiments, upon receiving an API request from the container orchestration system, a container operation request can be sent to the second device using a communication protocol based on the content requested by the API request. If the API request requests a container operation, the container operation request can be sent directly to the second device using the communication protocol to implement the container operation; alternatively, a container image operation request can be sent to the second device first using the communication protocol to implement the container image operation, and then a container operation request can be sent to the second device using the communication protocol to implement the container operation. For example, when creating a container, it is necessary to create a container image first and then create the container. Therefore, when it is necessary to create the container, an API request can be sent first to create the container image, and then another API request can be sent to create the container; alternatively, only one API request can be sent to create both the container image and the container.

[0062] In some exemplary embodiments, API requests can be listened for in a Unix socket file or a specified network port.

[0063] In some exemplary embodiments, container operations include at least one of the following: container creation, container deletion, container running, container stopping, container pausing, container resumption, creating a new process in the container, querying container information, etc.

[0064] In some exemplary embodiments, container image operations include at least one of the following: container image creation, container image deletion, querying container image information, format conversion, creating a container read-write layer, etc.

[0065] Step 301: Receive the container operation response sent by the second device using the communication protocol.

[0066] In some exemplary embodiments, before sending a container operation request to the second device using a communication protocol, the method further includes at least one of the following:

[0067] A node status query request is sent to the second device using a communication protocol, and a node status query response is received from the second device using the same communication protocol; wherein, the node status query response includes: node status information;

[0068] The system uses a communication protocol to send a first node resource request to the second device and uses a communication protocol to receive a first node resource request response from the second device.

[0069] The system uses a communication protocol to send a second node resource request to the second device and uses a communication protocol to receive a second node resource request response from the second device.

[0070] The system uses a communication protocol to send a container image operation request to the second device and uses a communication protocol to receive a container image operation response from the second device.

[0071] In some exemplary embodiments, upon receiving an API request from a container orchestration system, a container image operation request may be sent to a second device using a communication protocol based on the content requested by the API request.

[0072] In some exemplary embodiments, the method further includes:

[0073] Receives a console type parameter, which indicates the link type for standard input, standard error, and standard output;

[0074] The console type parameter is included in the container creation request or process creation request and sent to the second device using a communication protocol.

[0075] In some exemplary embodiments, the linking types for standard input, standard error, and standard output include: linking standard input, standard error, and standard output to a specified console, linking standard input, standard error, and standard output to a specified file, and not linking.

[0076] In some exemplary embodiments, the console type parameter may be sent to the first device by a container orchestration system or other external system.

[0077] In some exemplary embodiments, where the console type parameter is used to indicate linking standard input, standard error, and standard output to a specified console, the method further includes:

[0078] The port of the first device is included in the container creation request or process creation request and sent to the second device using a communication protocol;

[0079] The standard input of the container is transmitted to the second device through the port of the first device using a communication protocol.

[0080] The communication protocol is used to listen to the port of the first device to receive the standard output and standard error of the container sent by the second device, and output the standard output and standard error of the container to the specified console.

[0081] In some exemplary embodiments, where the console type parameter is used to indicate linking standard input, standard error, and standard output to a specified file, the method further includes:

[0082] The communication protocol is used to include the filename of the specified file in the container creation request or process creation request and send it to the second device.

[0083] In some exemplary embodiments, when the first device communicates with the second device using a client / server model, the first device and the second device need to establish a link, and the first device, acting as a client, needs to register with the second device. Specifically, before sending a container operation request to the second device using a communication protocol, the method further includes: sending a link establishment request to the second device using a communication protocol based on the pre-configured address and port of the second device; receiving a link establishment response from the second device using a communication protocol to complete the link establishment; sending a registration command to the second device using a communication protocol; and receiving a registration response from the second device using a communication protocol to complete the registration.

[0084] In some exemplary embodiments, the address and port of the second device can be pre-configured in a configuration file.

[0085] If there are two or more second devices, the configuration file will specify the address and port of each second device, and the first device will establish a link with each second device and register with each second device.

[0086] In some exemplary embodiments, after receiving the registration response sent by the second device using a communication protocol, the method further includes: periodically sending keep-alive messages to the second device using a communication protocol to implement a health check mechanism.

[0087] In some exemplary embodiments, before sending a first node resource request to the second device, the method further includes:

[0088] A container gasket module creation request is sent to the second device using a communication protocol, and a container gasket module creation response is received from the second device using the same communication protocol.

[0089] In some exemplary embodiments, the container pad module creates a response including: a port of the container pad module.

[0090] Figure 4 A flowchart illustrating an implementation method of a container engine applied to a worker node, provided as another embodiment of this application.

[0091] Secondly, referring to Figure 4 Another embodiment of this application provides a method for implementing a container engine, applied to a second device disposed on a management node or a worker node, the method comprising:

[0092] Step 400: Receive the container operation request sent by the first device using the communication protocol, and perform container operation.

[0093] In some exemplary embodiments, the communication protocol includes any one of the following: RPC, socket, and IPC. Specifically, if both the first device and the second device are located on the management node, the communication protocol used may be socket or IPC; if the first device is located on the management node and the second device is located on the worker node, the communication protocol used may be RPC.

[0094] In some exemplary embodiments, container operations include at least one of the following: container creation, container deletion, container running, container stopping, container pausing, container resumption, creating a new process in the container, querying container information, etc.

[0095] Step 401: Send the container operation response to the first device using the communication protocol.

[0096] In some exemplary embodiments, before receiving the container operation request sent by the first device using a communication protocol, the method further includes at least one of the following:

[0097] The system uses a communication protocol to receive a node status query request sent by the first device, queries the node status information, and sends a node status query response to the first device using the same communication protocol. The node status query response includes node status information.

[0098] The system uses a communication protocol to receive a first node resource request sent by a first device, allocates first node resources to the first device, and sends a first node resource request response to the first device using the communication protocol.

[0099] The system uses a communication protocol to receive a second node resource request sent by the first device, allocates second node resources to the first device, and sends a second node resource request response to the first device using the communication protocol.

[0100] The system uses a communication protocol to receive container image operation requests sent by the first device, performs container image operations, and sends container image operation responses to the first device using the same communication protocol.

[0101] In some exemplary embodiments, container image operations include at least one of the following: container image creation, container image deletion, querying container image information, format conversion, creating a container read-write layer, etc.

[0102] In some exemplary embodiments, the method further includes:

[0103] The system uses a communication protocol to receive console type parameters sent by the first device. The console type parameters are used to indicate the link types for standard input, standard error, and standard output.

[0104] In some exemplary embodiments, where the console type parameter is used to indicate linking standard input, standard error, and standard output to a specified console, the method further includes:

[0105] The first device receives the port data sent by the first device using a communication protocol.

[0106] The standard input of the container is received by the first device through the port of the first device using a communication protocol, and the standard input of the container is input into the container.

[0107] Receive the container's standard output and standard error, and use a communication protocol to send the container's standard output and standard error to the first device through the port of the first device.

[0108] In some exemplary embodiments, where the console type parameter is used to indicate linking standard input, standard error, and standard output to a specified file, the method further includes:

[0109] The filename of the specified file sent by the first device is received using a communication protocol;

[0110] Creates a file named after the received file and writes the container's standard input and standard error to the specified file.

[0111] In some exemplary embodiments, when the first device communicates with the second device using a client / server model, the first device and the second device need to establish a link, and the first device, acting as a client, needs to register with the second device. Specifically, before receiving a container operation request sent by the first device using a communication protocol, the method further includes: using a communication protocol to listen to the pre-configured address and port of the second device to receive a link establishment request sent by the first device; using a communication protocol to send a link establishment response to the first device to complete the link establishment; using a communication protocol to receive a registration command sent by the first device, execute the registration command, and using a communication protocol to send a registration response to the first device to complete the registration.

[0112] In some exemplary embodiments, the address and port of the second device can be pre-configured. The specific configuration method is not limited; for example, it can be configured in a configuration file.

[0113] If there are two or more second devices, the configuration file will specify the address and port of each second device, and the first device will establish a link with each second device and register with each second device.

[0114] In some exemplary embodiments, after sending a registration response to the first device using a communication protocol, the method further includes: periodically receiving keep-alive messages sent by the first device using a communication protocol to implement a health check mechanism.

[0115] In some exemplary embodiments, before receiving a first node resource request sent by the first device, the method further includes:

[0116] The system receives a container gasket module creation request from the first device using a communication protocol, creates a container gasket module, and sends a container gasket module creation response to the first device using the same communication protocol.

[0117] In some exemplary embodiments, the container pad module creates a response including: a port of the container pad module.

[0118] Thirdly, another embodiment of this application provides an electronic device, including: at least one processor; and a memory storing at least one program, which, when executed by at least one processor, implements any of the above-described container engine implementation methods.

[0119] Among them, the processor is a device with data processing capabilities, including but not limited to the central processing unit (CPU); the memory is a device with data storage capabilities, including but not limited to random access memory (RAM, more specifically such as SDRAM, DDR, etc.), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), and flash memory (FLASH).

[0120] In some embodiments, the processor and memory are interconnected via a bus, and thus connected to other components of the computing device.

[0121] Fourthly, another embodiment of this application provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements any of the above-described container engine implementation methods.

[0122] like Figure 2 As shown in the fifth aspect, another embodiment of this application provides a container engine, including: a first device 201 and a second device 202; the first device is disposed on a management node, and the second device is disposed on a management node or a worker node.

[0123] The first device includes a container engine core module 2011, which includes: a container management submodule for sending container operation requests to a main agent submodule; a main agent submodule for sending container operation requests to a container operation submodule of the second device using a communication protocol; and receiving container operation responses sent by the container operation submodule of the second device using a communication protocol.

[0124] The second device 202 includes a container pad module 2022 and a container runtime module 2023. The container pad module 2022 includes a container operation submodule, which is used to receive a container operation request sent by the master-end agent submodule of the first device 201 using a communication protocol, and send the container operation request to the container runtime module 2023. The container runtime module 2023 is used to perform container operations and send a container operation response to the container operation submodule. The container operation submodule is also used to send a container operation response to the master-end agent submodule of the first device 201 using a communication protocol.

[0125] In some exemplary embodiments, the master proxy submodule communicates directly with the container pad module 2022 via ttrpc, thereby speeding up container operations.

[0126] In some other exemplary embodiments, the master proxy submodule uses RPC to communicate indirectly with the container pad module 2022 via the slave proxy module 2021. In this case, the second device 202 further includes a slave proxy module 2021, which includes a communication submodule for communicating with the master proxy submodule using a communication protocol.

[0127] In some exemplary embodiments, when the first device communicates with the second device using a client / server model, the first device and the second device need to establish a link, and the first device, acting as a client, needs to register with the second device. Specifically, the master proxy submodule is further configured to: send a link establishment request to the slave proxy module 2021 using a communication protocol based on the pre-configured address and port of the slave proxy module 2021; receive a link establishment response from the slave proxy module 2021 using a communication protocol to complete the link establishment; send a registration command to the slave proxy module 2021 using a communication protocol; and receive a registration response from the slave proxy module 2021 using a communication protocol to complete the registration.

[0128] The second device 202 further includes: a slave agent module 2021, used to listen to the pre-configured address and port of the slave agent module 2021 using a communication protocol to receive a link establishment request sent by the master agent submodule, and send a link establishment response to the master agent submodule using a communication protocol to complete the link establishment; and to receive a registration command sent by the master agent submodule using a communication protocol, execute the registration command, and send a registration response to the master agent submodule using a communication protocol to complete the registration.

[0129] In some exemplary embodiments, the address and port of the slave agent module 2021 can be pre-configured in a configuration file.

[0130] If there are two or more second devices, the configuration file will specify the address and port of each second device, and the first device will establish a link with each second device and register with each second device.

[0131] In some exemplary embodiments, the master proxy submodule is further configured to: periodically send keep-alive messages to the slave proxy module 2021 using a communication protocol to implement a health check mechanism; the slave proxy module 2021 is further configured to: periodically receive keep-alive messages sent by the master proxy submodule of the first device using a communication protocol to implement a health check mechanism.

[0132] In some exemplary embodiments, the container engine core module 2011 of the first device 201 further includes: an API submodule, configured to receive API requests sent by the container orchestration system, and send a container operation request to the container management submodule or a container image operation request to the container image management submodule according to the content requested by the API request; a container image management submodule, configured to receive the container image operation request sent by the API submodule, send the container image operation request to the image storage submodule of the second device using a communication protocol, and receive the container image operation response sent by the image storage submodule of the second device using a communication protocol; the container management submodule is further configured to: receive the container operation request sent by the API submodule, send the container operation request to the container operation submodule of the second device using a communication protocol, and receive the container operation response sent by the container operation submodule of the second device using a communication protocol;

[0133] The second device 202 further includes a slave proxy module 2021, which includes: an image storage submodule, used to receive a container image operation request sent by the container image management submodule of the first device using a communication protocol, perform container image operations, and send a container image operation response to the container image management submodule of the first device using a communication protocol; the container operation submodule is further used to: receive a container operation request sent by the container management submodule of the first device using a communication protocol, perform container operations, and send a container operation response to the container management submodule of the first device using a communication protocol.

[0134] In some exemplary embodiments, the container management submodule is further configured to: send a node status query request to the master proxy submodule; the master proxy submodule is further configured to: send a node status query request to the node management submodule of the second device using a communication protocol, and receive a node status query response sent by the node management submodule of the second device using a communication protocol; wherein the node status query response includes: node status information; and send the node status query response to the container management submodule.

[0135] The second device 202 further includes a slave agent module 2021, which includes a node management submodule for receiving a node status query request sent by the master agent submodule of the first device using a communication protocol, querying node status information, and sending a node status query response to the master agent submodule of the first device using a communication protocol; wherein the node status query response includes node status information.

[0136] In some exemplary embodiments, the container management submodule is further configured to: send a first node resource request to the master proxy submodule; the master proxy submodule is further configured to: send the first node resource request to the node management submodule of the second device using a communication protocol, receive the first node resource request response sent by the node management submodule of the second device using a communication protocol, and send the first node resource request response to the container management submodule.

[0137] The second device 202 also includes a slave agent module 2021, which includes a node management submodule, used to receive a first node resource request sent by the master agent submodule of the first device using a communication protocol, allocate first node resources to the first device, and send a first node resource request response to the master agent submodule of the first device using a communication protocol.

[0138] In some exemplary embodiments, the container management submodule is further configured to: send a second node resource request to the master proxy submodule; the master proxy submodule is further configured to: send the second node resource request to the node management submodule of the second device using a communication protocol, receive the second node resource request response sent by the node management submodule of the second device using a communication protocol, and send the second node resource request response to the container management submodule.

[0139] The second device 202 further includes a slave agent module 2021, which includes a node management submodule, used to receive a second node resource request sent by the master agent submodule of the first device using a communication protocol, allocate second node resources to the first device, and send a second node resource request response to the master agent submodule of the first device using a communication protocol.

[0140] In some exemplary embodiments, the container engine core module 2011 further includes: a client submodule, configured to receive a console type parameter, the console type parameter indicating the link type of standard input, standard error, and standard output; and send the console type parameter to a container management submodule; the container management submodule is further configured to: send the console type parameter to a master agent submodule; the master agent submodule is further configured to: include the console type parameter in a container creation request or process creation request and send it to an input / output forwarding submodule of a second device using a communication protocol.

[0141] The Container Pad Module 2022 also includes an Input / Output Forwarding Submodule, which receives console-type parameters and sends them to the Container Operations Submodule.

[0142] In some exemplary embodiments, the container management submodule is further configured to: send the container management submodule's port to the master agent submodule when the console type parameter indicates that standard input, standard error, and standard output are linked to a specified console; the master agent submodule is further configured to: include the container management submodule's port in a container creation request or process creation request and send it to the input / output forwarding submodule of the second device using a communication protocol; send the container's standard input through the container management submodule's port to the input / output forwarding submodule of the second device using a communication protocol; listen to the container management submodule's port using a communication protocol to receive the container's standard output and standard error sent by the second device's input / output forwarding submodule, and send the container's standard output and standard error back to the container management submodule; the container management submodule is further configured to: output the container's standard output and standard error to a specified console.

[0143] The input / output forwarding submodule is also used to: receive the container management submodule's port sent by the master agent submodule of the first device using a communication protocol, when the console type parameter indicates that standard input, standard error, and standard output are linked to a specified console; receive the container's standard input sent by the master agent submodule of the first device through the container management submodule's port using a communication protocol; send the container's standard input to the container operation submodule; and send the container's standard output and standard error to the container management submodule through the container management submodule's port.

[0144] The container operation submodule is also used to: input the container's standard input into the container; receive the container's standard output and standard error, and send the container's standard output and standard error to the input / output forwarding submodule.

[0145] In some exemplary embodiments, the container management submodule is further configured to: send the console type parameter to the master agent submodule when the console type parameter is used to indicate that standard input, standard error, and standard output are linked to a specified file; the master agent submodule is further configured to: include the filename of the specified file in the container creation request or process creation request and send it to the input / output forwarding submodule of the second device using a communication protocol.

[0146] The input / output forwarding submodule is also used to: receive the filename of the specified file sent by the first device using a communication protocol when the console type parameter indicates that standard input, standard error, and standard output are linked to a specified file; create a specified file with the filename of the received specified file; and send the filename of the specified file to the container operation submodule; the container operation submodule is also used to: write the container's standard input and standard error to the specified file.

[0147] The container engine provided in this application embodiment is implemented by splitting the container engine into a first device and a second device. The first device is set in the management node, and the second device is set in the management node or the worker node. The core module of the container engine is retained in the first device, without changing the way the container engine orchestration system interfaces with the container engine. Furthermore, the container pad module and the container runtime module are retained in the second device. Since the container pad module and the container runtime module consume relatively few resources, while the core module of the container engine consumes relatively many resources, this application embodiment saves the resource consumption of the worker node while using the original container engine orchestration system to interface with the container engine.

[0148] In some exemplary embodiments, the master proxy submodule is further configured to: send a container pad module creation request to the communication submodule of the second device using a communication protocol, and receive a container pad module creation response sent by the communication submodule of the second device using a communication protocol.

[0149] The slave agent module 2021 also includes: a communication submodule, used to receive a container pad module creation request sent by the first device using a communication protocol, create a container pad module, and send a container pad module creation response to the first device using a communication protocol.

[0150] It will be understood by those skilled in the art that all or some of the steps, systems, or apparatuses disclosed above, and their functional modules / units, can be implemented as software, firmware, hardware, or suitable combinations thereof. In hardware implementations, the division between functional modules / units mentioned above does not necessarily correspond to the division of physical components; for example, a physical component may have multiple functions, or a function or step may be performed collaboratively by several physical components. Some or all physical components may be implemented as software executed by a processor, such as a central processing unit, digital signal processor, or microprocessor, or as hardware, or as an integrated circuit, such as an application-specific integrated circuit (ASIC). Such software may be distributed on a computer-readable medium, which may include computer storage media (or non-transitory media) and communication media (or transient media). As is known to those skilled in the art, the term computer storage media includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules, or other data). Computer storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technologies, CD-ROM, digital versatile disc (DVD) or other optical disc storage, magnetic cartridges, magnetic tape, disk storage or other magnetic storage, or any other medium that can be used to store desired information and can be accessed by a computer. Furthermore, it is well known to those skilled in the art that communication media typically contain computer-readable instructions, data structures, program modules, or other data in modulated data signals such as carrier waves or other transmission mechanisms, and may include any information delivery medium.

[0151] Example embodiments have been disclosed herein, and while specific terminology has been used, it is for illustrative purposes only and should be construed as such, and is not intended to be limiting. In some instances, it will be apparent to those skilled in the art that features, characteristics, and / or elements described in connection with particular embodiments may be used alone, or in combination with features, characteristics, and / or elements described in connection with other embodiments, unless otherwise expressly indicated. Therefore, those skilled in the art will understand that various changes in form and detail may be made without departing from the scope of this application as set forth by the appended claims.

Claims

1. A method for implementing a container engine, applied to a container engine core module in a first device set up in a management node, the method comprising: A container operation request is sent to the second device using a communication protocol. The container operation request is used to operate the container. The container operation response sent by the second device is received using the communication protocol. The second device includes a container pad module and a container runtime module of the container engine. The container operation response is obtained by the container runtime module through container operation and sent to the container engine core module through the container pad module.

2. The method for implementing a container engine according to claim 1, before sending the container operation request to the second device using a communication protocol, the method further includes at least one of the following: The communication protocol is used to send a node status query request to the second device, and the communication protocol is used to receive a node status query response from the second device; wherein, The node status query response includes: node status information; The first node resource request is sent to the second device using the communication protocol, and the first node resource request response is received from the second device using the communication protocol. The communication protocol is used to send a second node resource request to the second device, and the communication protocol is used to receive a second node resource request response sent by the second device. The container image operation request is sent to the second device using the aforementioned communication protocol, and the container image operation response sent by the second device is received using the aforementioned communication protocol.

3. The method for implementing a container engine according to claim 1, further comprising: Receive console type parameter, which indicates the link type for standard input, standard error, and standard output; The console type parameter is included in the container creation request or process creation request and sent to the second device using the communication protocol.

4. The method for implementing a container engine according to claim 3, wherein the console type parameter is used to indicate linking the standard input, standard error, and standard output to a specified console, the method further includes: The port of the first device is included in the container creation request or process creation request and sent to the second device using the communication protocol. The standard input of the container is sent to the second device through the port of the first device using the communication protocol described above; The communication protocol is used to listen to the port of the first device to receive the standard output and standard error of the container sent by the second device, and the standard output and standard error of the container are output to the designated console.

5. The method for implementing a container engine according to claim 3, wherein the console type parameter is used to indicate linking the standard input, standard error, and standard output to a specified file, the method further includes: The filename of the specified file is included in the container creation request or process creation request and sent to the second device using the communication protocol.

6. The method for implementing a container engine according to any one of claims 1-5, wherein before sending the container operation request to the second device using a communication protocol, the method further comprises: According to the pre-configured address and port of the second device, a link establishment request is sent to the second device using the communication protocol, and a link establishment response sent by the second device is received using the communication protocol; The registration command is sent to the second device using the aforementioned communication protocol, and the registration response sent by the second device is received using the aforementioned communication protocol.

7. The method for implementing a container engine according to claim 2, wherein before sending a first node resource request to the second device using the communication protocol, the method further includes: The device sends a container gasket module creation request to the second device using the aforementioned communication protocol, and receives a container gasket module creation response from the second device using the same communication protocol.

8. The method for implementing a container engine according to claim 7, wherein, The container pad module creates a response including: the port of the container pad module.

9. The method for implementing a container engine according to any one of claims 1-5, wherein, The communication protocol includes any one of the following: Remote Procedure Call Protocol (RPC), sockets, and Inter-Process Communication (IPC).

10. A method for implementing a container engine, applied to a second device disposed on a management node or a worker node, the second device comprising a container pad module and a container runtime module, the method comprising: The container operation request sent by the container engine core module of the container engine in the first device is received using a communication protocol, and the container operation is performed. The container operation response is sent to the first device using the communication protocol, wherein the container operation response is obtained by the container runtime module through container operation and sent through the container pad module.

11. The method for implementing a container engine according to claim 10, prior to receiving the container operation request sent by the first device using a communication protocol, the method further includes at least one of the following: The system uses the aforementioned communication protocol to receive a node status query request sent by the first device, queries node status information, and then uses the same communication protocol to send a node status query response back to the first device; wherein... The node status query response includes: the node status information; The communication protocol is used to receive a first node resource request sent by a first device, allocate first node resources to the first device, and send a first node resource request response to the first device using the communication protocol. The system uses the communication protocol to receive a second node resource request sent by the first device, allocates second node resources to the first device, and sends a second node resource request response to the first device using the communication protocol. The system uses the communication protocol to receive container image operation requests sent by the first device, performs container image operations, and sends container image operation responses to the first device using the communication protocol.

12. The method for implementing a container engine according to claim 10, further comprising: The communication protocol is used to receive the console type parameter sent by the first device, which is used to indicate the link type of standard input, standard error, and characterization output.

13. The method for implementing a container engine according to claim 12, wherein the console type parameter is used to indicate linking the standard input, standard error, and standard output to a specified console, the method further comprises: The communication protocol is used to receive the port of the first device sent by the first device; The standard input of the container sent by the first device through the port of the first device is received using the communication protocol, and the standard input of the container is input into the container. Receive the container's standard output and standard error, and use the communication protocol to send the container's standard output and standard error to the first device through the port of the first device.

14. The method for implementing a container engine according to claim 12, wherein the console type parameter is used to indicate linking the standard input, standard error, and standard output to a specified file, the method further comprises: The filename of the specified file sent by the first device is received using the communication protocol described above; Create the specified file with the same filename as the received specified file, and write the container's standard input and standard error into the specified file.

15. The method for implementing a container engine according to any one of claims 10-14, wherein before receiving the container operation request sent by the first device using a communication protocol, the method further comprises: The communication protocol is used to listen to the pre-configured address and port of the second device to receive the link establishment request sent by the first device, and the communication protocol is used to send the link establishment response to the first device. The system receives the registration command sent by the first device using the communication protocol, executes the registration command, and sends a registration response to the first device using the communication protocol.

16. The method for implementing a container engine according to claim 11, prior to receiving the first node resource request sent by the first device using the communication protocol, the method further includes: The system receives a container gasket module creation request sent by the first device using the communication protocol, creates a container gasket module, and sends a container gasket module creation response to the first device using the communication protocol.

17. The method for implementing a container engine according to claim 16, wherein, The container pad module creates a response including: the port of the container pad module.

18. The method for implementing a container engine according to any one of claims 10-14, wherein, The communication protocol includes any one of the following: Remote Procedure Call Protocol (RPC), sockets, and Inter-Process Communication (IPC).

19. An electronic device comprising: At least one processor; A memory storing at least one program, which, when executed by the at least one processor, implements the container engine implementation method according to any one of claims 1-9, or the container engine implementation method according to any one of claims 10-18.

20. A computer-readable storage medium storing a computer program that, when executed by a processor, implements the method of implementing a container engine according to any one of claims 1-9, or the method of implementing a container engine according to any one of claims 10-18.

21. A container engine, comprising: A first device and a second device; the first device is located at the management node, and the second device is located at either the management node or the working node; The first device includes a container engine core module, which includes: The container management submodule is used to send container operation requests to the main agent submodule; The master proxy submodule is used to send a container operation request to the container operation submodule of the second device using a communication protocol; and to receive a container operation response sent by the container operation submodule of the second device using the communication protocol. The second device includes: a container gasket module and a container runtime module; The container pad module includes: a container operation submodule, used to receive a container operation request sent by the master proxy submodule of the first device using the communication protocol, and send the container operation request to the container runtime module; The container runtime module is used to perform container operations and send container operation responses to the container operation submodule. The container operation submodule is further configured to: send a container operation response to the master agent submodule of the first device using the communication protocol.

22. The container engine of claim 21, wherein, The first device and the second device are connected by any one of bus technology, wired network technology, or wireless network technology.