Secure container startup method, device, equipment and storage medium

By creating a container template file containing the running status information of the started secure container micro-virtual machine and the memory image of the guest virtual machine, and directly using this information for startup, the problem of high CPU overhead when starting the secure container is solved, achieving fast startup and efficient resources. use.

CN114398143BActive Publication Date: 2024-10-18ALIBABA (CHINA) CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202111467271.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-02
Publication Date
2024-10-18
Estimated Expiration
2041-12-02

AI Technical Summary

Technical Problem

Security containers have high CPU overhead when starting, resulting in slow startup speed and occupying more memory resources.

Method used

By creating a container template file that contains the running status information of the started secure container micro-VM and the memory image of the guest VM, use this information directly for startup to avoid restarting the guest VM and agent.

Benefits of technology

It greatly reduces the CPU overhead when starting the secure container, shortens the startup time, and improves startup efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114398143B_ABST
    Figure CN114398143B_ABST
Patent Text Reader

Abstract

The present application proposes a method, device, equipment and storage medium for starting a secure container, the method comprising: receiving a container start request; obtaining a container template file, the container template file including the running status information of the micro-virtual machine in the started secure container and the memory image of the client virtual machine; starting the secure container according to the container template file. After the micro-virtual machine, the client virtual machine and the agent program are all started, the present application uses snapshot technology to save the running status information of the started micro-virtual machine and the memory image of the client virtual machine as a container template file. The startup results of the client virtual machine and the agent program are included in the container template file. In this way, the container template file contains a complete and successfully started micro-virtual machine. When starting the secure container based on the container template file, there is no need to restart the operating system and agent program of the client virtual machine, which greatly reduces the CPU overhead when starting the secure container and shortens the startup time of the secure container.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of computer technology, and specifically relates to a secure container startup method, device, equipment and storage medium. Background Art

[0002] Secure containers are based on hardware virtualization technology and have independent operating system kernels. Traditional containers based on operating system virtualization technology run on the host machine and need to share the kernel with other programs on the host machine. Therefore, secure containers have independent kernels, better isolation, and greater security.

[0003] However, the secure container has a large CPU overhead when starting, resulting in a slower startup speed, and also has additional memory overhead, occupying more memory resources. Summary of the invention

[0004] The present application proposes a secure container startup method, device, equipment and storage medium. The container template file includes the running status information of the started micro-VM of the secure container and the memory image of the client virtual machine. Therefore, when starting the secure container based on the container template file, the micro-VM can be directly started from the container template file, and there is no need to restart the operating system and agent program of the client virtual machine. The client virtual machine and agent program in the container template file can be directly used, which greatly reduces the CPU overhead when the secure container is started and shortens the startup time of the secure container.

[0005] The first embodiment of the present application provides a secure container startup method, including:

[0006] Receive a container start request;

[0007] Obtain a container template file, wherein the container template file includes the running status information of the micro virtual machine in the started secure container and the memory image of the client virtual machine;

[0008] Start a secure container according to the container template file.

[0009] The second embodiment of the present application provides a safety container starting device, including:

[0010] A receiving module, used for receiving a container startup request;

[0011] An acquisition module is used to acquire a container template file, wherein the container template file includes the running status information of the micro virtual machine in the started secure container and the memory image of the client virtual machine;

[0012] A startup module is used to start the secure container according to the container template file.

[0013] An embodiment of the third aspect of the present application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the method described in the first aspect above.

[0014] An embodiment of the fourth aspect of the present application provides a computer-readable storage medium on which a computer program is stored, and the program is executed by a processor to implement the method described in the first aspect above.

[0015] The technical solution provided in the embodiments of the present application has at least the following technical effects or advantages:

[0016] In the embodiment of the present application, the container template file includes the running status information of the micro-VM of the started secure container and the memory image of the client virtual machine. Therefore, the container template file contains a complete and successfully started micro-VM. When starting a secure container based on the container template file, the micro-VM can be directly started from the container template file without restarting the operating system and agent of the client virtual machine. The client virtual machine and agent in the container template file can be directly used, which greatly reduces the CPU overhead when starting the secure container and shortens the startup time of the secure container.

[0017] Additional aspects and advantages of the present application will be given in part in the description below, and in part will become apparent from the description below, or will be learned through the practice of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] By reading the detailed description of the preferred embodiment below, various other advantages and benefits will become clear to those of ordinary skill in the art. The accompanying drawings are only used for the purpose of illustrating the preferred embodiment and are not considered to be limitations of the present application. In addition, the same reference symbols are used to represent the same components throughout the accompanying drawings.

[0019] In the attached picture:

[0020] Figure 1 A flowchart of a secure container startup method provided by an embodiment of the present application is shown;

[0021] Figure 2 Another flow chart of a secure container startup method provided by an embodiment of the present application is shown;

[0022] Figure 3 A schematic structural diagram of a safety container starting device provided by an embodiment of the present application is shown;

[0023] Figure 4 A schematic diagram of the structure of an electronic device provided by an embodiment of the present application is shown;

[0024] Figure 5 A schematic diagram of a storage medium provided in an embodiment of the present application is shown. DETAILED DESCRIPTION

[0025] The exemplary embodiments of the present application will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present application are shown in the accompanying drawings, it should be understood that the present application can be implemented in various forms and should not be limited by the embodiments described herein. On the contrary, these embodiments are provided in order to enable a more thorough understanding of the present application and to fully convey the scope of the present application to those skilled in the art.

[0026] It should be noted that, unless otherwise specified, the technical terms or scientific terms used in this application should have the common meanings understood by technicians in the field to which this application belongs.

[0027] The following describes a secure container startup method, device, equipment, and storage medium proposed according to an embodiment of the present application in conjunction with the accompanying drawings.

[0028] The embodiment of the present application provides a method for starting a secure container, which creates a container template file based on a started secure container, and the container template file includes the running status information of the micro virtual machine (MicroVM) in the started secure container and the memory image of the client virtual machine (guest). Because the container template file contains a complete and successfully started micro virtual machine, when the secure container needs to be started, it is started through the container template file, and there is no need to restart the client virtual machine and the agent in the client virtual machine. This reduces the CPU overhead when the secure container is started, shortens the startup time of the secure container, and can quickly start the secure container.

[0029] Before using the container template file to start a secure container, first create a container template file by performing the following operations S1-S3, including:

[0030] S1: Receive a container template creation request.

[0031] In the embodiment of the present application, the container engine can provide two services: creating a container template file and starting a secure container. In order to distinguish between the two services, different task identifiers can be pre-configured to refer to different services, and the task identifiers can be 0, 1, 001, 010, etc. For example, the service of creating a container template file is referred to by task identifier 0, and the service of starting a secure container is referred to by task identifier 1.

[0032] When a user needs to create a container template file, a creation request is sent to the container engine. The creation request may include a task identifier for indicating the service to which the creation request is directed. After the container engine receives the user's creation request, it starts the secure container process. The user's creation request is parsed by the secure container process, the task identifier is extracted from the creation request, and the service referred to by the task identifier is determined. If it is determined that the service referred to by the task identifier is a template creation service, the creation request is determined to be a container template creation request, and the container template file is subsequently created through the operations of steps S2 and S3. If it is determined that the service referred to by the task identifier is a service for starting a secure container, the creation request is determined to be a container startup request, and the secure container is quickly started through the operations of subsequent steps 101-103.

[0033] In other embodiments, the user's creation request may not carry a task identifier. Instead, the cloud service manager configures the current task identifier in the system's configuration file. When the container engine receives the user's creation request, it reads the current task identifier from the system's configuration file. If the service referred to by the task identifier is a template creation service, the user's creation request is determined to be a container template creation request, and the container template file is subsequently created through the operations of steps S2 and S3. If it is determined that the service referred to by the task identifier is a service for starting a secure container, the user's creation request is determined to be a container startup request, and the secure container is quickly started through the operations of subsequent steps 101-103.

[0034] S2: Use snapshot technology to generate a container template file corresponding to the started secure container.

[0035] After determining that the user's creation request is a container template creation request through step S1, first determine the configuration information of the micro virtual machine to be started based on the current container configuration information. The current container configuration information is the resources required to start the micro virtual machine under the current operating environment, including storage resources and network resources. Among them, the storage resources include the backend file path of the simulated device in the micro virtual machine, the file name of the storage file, etc. The network resources include network ports, etc. According to the determined configuration information, cold start a micro virtual machine. Then wait for the client virtual machine in the micro virtual machine and the agent program in the client virtual machine to start successfully.

[0036] While waiting for the client virtual machine and the agent program to start, a polling mechanism can be used to periodically try to establish a connection between the container engine and the agent program. If the connection to the agent program is successful, it is determined that the agent program in the client virtual machine of the micro virtual machine has been successfully started.

[0037] In another implementation, the polling method may not be used to determine whether the client virtual machine and the agent program are successfully started. Instead, the agent program in the client virtual machine actively sends a notification message to the container engine after it is successfully started. After receiving the notification message, the container engine determines that the agent program in the client virtual machine of the micro virtual machine is successfully started. Then the container engine establishes a connection with the agent program in the client virtual machine.

[0038] After determining that the agent program in the client virtual machine of the micro virtual machine is successfully started by the above method, the snapshot technology is used to save the current running state information of the micro virtual machine and the memory image of the client virtual machine to obtain the container template file. Among them, the current running state information of the micro virtual machine includes the configuration information of the micro virtual machine and the current running state of the micro virtual machine. The memory image of the client virtual machine includes the memory image of the successfully started client virtual machine and the agent program.

[0039] The embodiment of the present application uses snapshot technology to save the running status information of the started micro-virtual machine and the memory image of the client virtual machine as a container template file after the micro-virtual machine, the kernel of the client virtual machine and the agent program of the secure container are all started. Since the startup process of the operating system and the agent program of the client virtual machine of each secure container instance is almost the same, a container template file is created after the client virtual machine and the agent program are successfully started, and the startup results of the client virtual machine and the agent program are included in the container template file. In this way, the container template file contains a complete and successfully started micro-virtual machine. Therefore, when using the container template file to start the secure container, there is no need to restart the operating system and the agent program of the client virtual machine, which greatly reduces the CPU overhead when starting the secure container and shortens the startup time of the secure container.

[0040] S3: Store the container template file in a set storage medium.

[0041] The set storage medium can be any storage medium capable of storing data, such as a hard disk, a magnetic disk, or a memory.

[0042] One or more container template files are created through the operations of the above steps S1-S3. Before the created container template files are stored in a set storage medium, in order to facilitate the search of the container template files, a template identifier can also be assigned to the container template file to store the mapping relationship between the template identifier and the container template file.

[0043] After creating a container template file, you can use it to quickly start a secure container. Figure 1 The method for quickly starting a secure container provided in the embodiment of the present application specifically includes the following steps:

[0044] Step 101: Receive a container start request.

[0045] When a user needs to start a secure container, a creation request is sent to the container engine. The creation request may include a task identifier for referring to the service that starts the secure container. After receiving the creation request from the user, the container engine starts the secure container process. The secure container process parses the creation request from the user and extracts the task identifier from the creation request. If it is determined that the service referred to by the task identifier is the service that starts the secure container, the creation request is determined to be a container start request.

[0046] In other embodiments, the user's creation request may not carry a task identifier for the service that starts the secure container. Instead, the cloud service administrator configures a task identifier for the service that starts the secure container in the system configuration file. When the container engine receives the user's creation request, it reads the task identifier from the system configuration file and determines that the user's creation request is a container start request based on the task identifier.

[0047] Step 102: Obtain a container template file, which includes the running status information of the micro virtual machine in the started secure container and the memory image of the client virtual machine.

[0048] After the container engine determines that the user's creation request is a container start request, it obtains a container template file.

[0049] In one implementation, when the container engine parses the user's container startup request through the secure container process, it parses the configuration information of the container instance from the container startup request, and the configuration information of the container instance includes the container specification of the container instance, network configuration information, etc. The container specification includes the number of cores, memory size, etc. The network configuration information includes the network type, etc. The container engine can obtain the container template file according to the container specification required by the container startup request.

[0050] Specifically, the container engine obtains the container specification of the container instance from the configuration information of the container instance included in the container startup request, and obtains a container template file from all currently stored container template files according to the container specification.

[0051] Determine whether there is a container template file that meets the container specification in each currently stored container template file. Determine the container specification corresponding to each container template file according to the running status information of the micro virtual machine in each currently stored container template file. Compare the container specification corresponding to each container template file with the container specification corresponding to the container startup request. If there is a container template file whose container specification is consistent with the container specification corresponding to the container startup request, determine whether there is a container template file that meets the container specification corresponding to the container startup request in each currently stored container template file. Obtain the container template file that meets the container specification.

[0052] For example, if the container specification corresponding to the container startup request is 1 core and 500M memory, the container specification corresponding to the currently stored container template file 1 is 1 core and 500M memory, and the container specification corresponding to the currently stored container template file 2 is 2 cores and 1G memory. Then select container template file 1 to start the secure container for the user.

[0053] If it is determined that the container specifications corresponding to all currently stored container template files are inconsistent with the container specifications corresponding to the container startup request, a container template file is obtained from each currently stored container template file.

[0054] In one implementation, a container template file may be randomly obtained from each currently stored container template file. In another implementation, the container specifications corresponding to each currently stored container template file may be compared with the container specifications corresponding to the container startup request, and the specification difference between the container specifications corresponding to each container template file and the container specifications corresponding to the container startup request may be calculated. The container template file with the smallest specification difference is selected.

[0055] The container template file is obtained according to the container specification corresponding to the container startup request, and the container template file consistent with the container specification is preferentially selected. The container template file consistent with the container specification is used to start the security container. The container template file contains a complete and successfully started micro virtual machine, and the container specification corresponding to the micro virtual machine is consistent with the container specification requested by the user. After starting the security container using the container template file, there is no need to adjust the container specification of the security container, which further improves the startup efficiency of the security container. When there is no container template file that is consistent with the requested container specification, the container template file with the smallest difference between the requested container specification and the requested container specification can also be selected. After the micro virtual machine is quickly started using the container template file, the container specification required by the user can be achieved by fine-tuning the micro virtual machine configuration.

[0056] In another implementation, template introduction information for each container template file may be generated, and the template introduction information may include container specifications, network types, creation time, etc. corresponding to the container template file. The template introduction information and template identifier of each currently stored container template file are provided to the user. The user selects a container template file that meets his or her usage requirements based on the template introduction information, and carries the template identifier of the selected container template file when sending a container startup request. After receiving the container startup request, the container engine obtains the container template file corresponding to the template identifier.

[0057] Users can independently select the container template file they want to use, which improves the user's participation in the process of starting the secure container, makes the adopted container template file more in line with user needs, and improves the user experience.

[0058] In an embodiment of the present application, the container engine can record the flag bit corresponding to each container template file, and the flag bit is used to identify whether it is the first time to obtain the container template file. For example, a flag bit of 00 indicates that the container template file is obtained for the first time, and a flag bit of 11 indicates that it is not the first time to obtain the container template file. After the container engine determines the container template file that needs to be obtained currently through any of the above implementation methods, it checks the flag bit corresponding to the container template file. If the flag bit indicates that the container template file is obtained for the first time, the container template file is read from the set storage medium. The obtained container template file is then stored in the cache, and the flag bit corresponding to the container template file is reset to a value indicating that it is not the first time to obtain. If the flag bit corresponding to the container template file indicates that it is not the first time to obtain the container template file, the container template file is read directly from the cache.

[0059] Alternatively, the container engine may not set the above flag corresponding to the container template file. After determining the container template file that needs to be obtained currently by any of the above methods, first query whether the container template file is stored in the cache. If so, read the container template file directly from the cache. If the container template file is not stored in the cache, read the container template file from the set storage medium, and then store the read container template file in the cache.

[0060] In the above method, the container template file is read from the set storage medium through IO (InputOutput) operation only when the container template file is used for the first time. After that, the container template file is stored in the cache, so that when the container template file is used again, it does not need to be read from the set storage medium through IO operation again, thereby saving the system's IO resources.

[0061] In an embodiment of the present application, when the acquired container template file is loaded, Linux's mmap (MAP_PRIVATE flag) technology is used to allow different secure container instances to share the memory mapping of the same container template file. The same memory pages in the operating systems of different client virtual machines can be directly shared, greatly saving memory.

[0062] In some other embodiments of the present application, after receiving the container startup request from the user, the container engine may not obtain the container template file from the generated container template file, but temporarily generate a container template file based on the currently running secure container. Specifically, a secure container is selected from at least one currently running secure container. The current running status information of the micro virtual machine in the selected secure container and the memory data of the client virtual machine are soft-copied to obtain the container template file.

[0063] Among them, a security container can be randomly selected from at least one security container currently running. Alternatively, a security container can also be selected from at least one security container currently running according to the container specification corresponding to the container startup request. First, the container specifications of each currently running security container are determined respectively, and the container specifications of each security container are compared with the container specifications corresponding to the container startup request respectively. If there is a security container whose container specification is consistent with the container specification corresponding to the container startup request in the currently running security container, the security container with the consistent container specification is selected. If there is currently no security container whose container specification is consistent with the container specification corresponding to the container startup request, a security container is randomly selected from each currently running security container. Or, from each currently running security container, select the security container whose container specification is the smallest different from the container specification corresponding to the container startup request.

[0064] A secure container is selected based on the container specification corresponding to the container startup request, and a secure container that is consistent with the container specification is preferentially selected. A container template file is temporarily generated using a secure container that is consistent with the container specification, so that the container specification corresponding to the generated container template file is consistent with the container specification requested by the user. In this way, after using the container template file to start a secure container for the user, there is no need to adjust the container specification of the secure container, which further improves the startup efficiency of the secure container. When there is currently no secure container that is consistent with the requested container specification, a secure container with the smallest difference in container specification from the requested container specification can also be selected, and a container template file is temporarily generated using the secure container with the smallest difference in container specification. After the micro virtual machine is quickly started using the container template file, the container specification required by the user can be achieved by fine-tuning the micro virtual machine configuration.

[0065] After selecting a secure container from the currently running secure containers in the above manner, a soft copy is made of the current running status information of the micro virtual machine in the running secure container and the memory data of the client virtual machine to obtain a container template file. After temporarily generating a container template file in this manner, the container template file is also stored in a set storage medium or cache so that the container template file can be used again to quickly start the secure container later.

[0066] The current operating status information of the running secure container's micro-virtual machine and the memory data of the client virtual machine are saved as a container template file through soft copy, thereby realizing the sharing of the memory of the running secure container. The generated container template file contains the running secure container's micro-virtual machine and the successfully started client virtual machine and agent program. Therefore, when using the container template file to start the secure container, there is no need to restart the client virtual machine's operating system and agent program, which greatly reduces the CPU overhead when starting the secure container and shortens the startup time of the secure container.

[0067] After obtaining the container template file by any method in step 102, the obtained secure container template file is used to quickly start the secure container through the operation of step 103.

[0068] Step 103: Start the secure container according to the obtained container template file.

[0069] Since the configuration information of the micro-virtual machine in each secure container instance may be different, after obtaining the container template file, first modify the configuration information of the micro-virtual machine included in the running status information of the micro-virtual machine in the container template file according to the current container configuration information. Among them, the current container configuration information is the resources that the micro-virtual machine relies on in the current running environment, including storage resources and network resources. Among them, the storage resources include the backend file path of the simulated device in the micro-virtual machine, the file name of the storage file, etc. The network resources include network ports, etc.

[0070] The configuration information of the micro-VM in the container template file is determined when the container template file is created based on the resources that the micro-VM depends on when starting the micro-VM in the current operating environment. Therefore, when using the container template file to start the secure container, it is necessary to modify the configuration information of the micro-VM in the container template file using the resources that the micro-VM depends on in the current operating environment. For example, the configuration information of the micro-VM includes the file name of the storage file, the network port, and the backend file path of the simulated device in the micro-VM.

[0071] After completing the modification of the configuration information of the micro virtual machine included in the running state information of the micro virtual machine in the container template file, the micro virtual machine is started based on the modified running state information of the micro virtual machine. Since the container template file contains the started micro virtual machine, the micro virtual machine can be directly started according to the modified running state information of the micro virtual machine, which greatly shortens the time spent on starting the micro virtual machine.

[0072] After starting the micro-VM, the container engine connects to the agent in the client virtual machine according to the memory image of the client virtual machine in the container template file. Since the container template file stores the successfully started client virtual machines and agents, and the startup process of the client virtual machines and agents of each secure container instance is almost the same, there is no need to restart the operating system and agent of the client virtual machine. The client virtual machines and agents started in the container template file can be used directly, which greatly reduces the CPU overhead required to start the client virtual machines and agents, improves the startup speed of the secure container, and enables the startup speed of the secure container to meet the needs of cloud native services.

[0073] After the container engine is connected to the proxy program, it modifies the configuration information of the client virtual machine through the proxy program. The configuration information of the client virtual machine includes the user's IP address, the MAC address of the network card, the timestamp of starting the secure container, and so on. The container engine obtains the user's IP address, the MAC address of the network card and other network addresses from the user's container startup request, and modifies the network address in the configuration information of the client virtual machine to the corresponding network address in the container startup request through the proxy program, and modifies the timestamp of starting the secure container in the client virtual machine to the current time through the proxy program. In addition to the network address and timestamp, the container engine can also modify other information in the configuration information of the client virtual machine through the proxy program, which will not be explained one by one here.

[0074] By quickly starting the micro virtual machine, client virtual machine and agent program based on the container template file in the above manner, and modifying the configuration information of the client virtual machine through the agent program, a secure container is successfully started for the user. Then, the agent program of the client virtual machine in the secure container is used to create the user's workload to process the user program.

[0075] The embodiments of the present application can provide greater flexibility by using snapshot technology to create a container template file, quickly starting a secure container based on the container template file, changing the configuration information of the micro virtual machine before starting, and changing the configuration information of the client virtual machine after starting, thereby achieving the effect of quickly creating a secure container instance without reserving resources in advance.

[0076] Before creating a user's workload, if the container specifications of the container template file used to start the secure container are inconsistent with the container specifications corresponding to the container start request, you need to adjust the specifications of the started secure container to the container specifications corresponding to the container start request. After adjusting the container specifications, use the secure container to create the user's workload.

[0077] For example, if the container specification corresponding to the container startup request is 1 core and 500M memory, and a container template file with 2 cores and 1G memory is used to start a secure container for the user, then after the secure container is started, the container specification of the secure container is adjusted to 1 core and 500M memory.

[0078] By adjusting the specifications of the launched secure container to the container specifications corresponding to the container launch request, it is possible to ensure that the container specifications of the secure container meet user needs and allocate system resources on demand to avoid wasting resources.

[0079] In other embodiments of the present application, in order to further improve the response speed of responding to the user's use of the secure container, the solution of quickly starting the secure container based on the container template file can also be combined with the solution of providing a resource pool. Specifically, one or more container template files are created through the operations of steps S1-S3, and a certain number of secure container instances are quickly started through the operations of steps 101-103 based on the created container template files, and the started secure container instances are stored in the resource pool. When the container engine receives the user's container start request, a secure container instance is obtained from the resource pool, and the obtained secure container instance is allocated to the user for use. In this process, the number of remaining secure container instances in the resource pool is monitored in real time. When it is detected that the number of secure container instances included in the resource pool is less than the preset threshold, the preset number of secure container instances are quickly started again based on the created container template file through the operations of steps 101-103, and the started preset number of secure container instances are added to the resource pool.

[0080] By providing a certain number of secure container instances in the resource pool in the above manner, when a user requests to use a secure container, the secure container instance in the resource pool is directly allocated to the user, so that the user's use request can be responded to in a timely manner, greatly reducing the user's waiting time. When the number of secure container instances in the resource pool is less than the threshold, the secure container instance is quickly started based on the container template file, and the started secure container instance is stored in the resource pool, so that the resource pool can be quickly replenished.

[0081] To facilitate understanding of the method for starting a secure container provided in an embodiment of the present application, a description is provided below with reference to the accompanying drawings. Figure 2 A schematic flowchart for starting a secure container is shown. A1: The container engine receives a user's creation request. A2: Start the secure container process, and parse the creation request through the secure container process. A3: According to the parsing result of the creation request, determine whether the creation request is a container template creation request or a container startup request. If it is a container template creation request, execute step A4, and if it is a container startup request, execute step A7. A4: Cold start the micro virtual machine. A5: Wait for the agent program in the client virtual machine of the micro virtual machine to start successfully. A6: Use snapshot technology to save the current running status information of the micro virtual machine and the memory image of the client virtual machine to obtain a container template file. A7: Obtain the container template file. A8: According to the current container configuration information, modify the configuration information of the micro virtual machine included in the running status information of the micro virtual machine in the container template file. A9: Start the micro virtual machine based on the running status information of the micro virtual machine in the modified container template file. A10: The container engine connects to the agent program in the client virtual machine according to the memory image of the client virtual machine in the container template file. A11: Modify the configuration information of the client virtual machine through the agent program. A12: Create user workloads through the agent.

[0082] In an embodiment of the present application, after the micro-VM, client virtual machine and agent program are all started, the snapshot technology is used to save the running status information of the started micro-VM and the memory image of the client virtual machine as a container template file. After the client virtual machine and the agent program are successfully started, a container template file is created, and the startup results of the client virtual machine and the agent program are included in the container template file. In this way, the container template file contains a complete and successfully started micro-VM. Therefore, when starting a secure container based on the container template file, there is no need to restart the operating system and agent program of the client virtual machine, which greatly reduces the CPU overhead when starting the secure container and shortens the startup time of the secure container.

[0083] The present application also provides a secure container startup device, which is used to execute the secure container startup method provided in any of the above embodiments. Figure 3 As shown, the device comprises:

[0084] Receiving module 201, used to receive a container startup request;

[0085] An acquisition module 202 is used to acquire a container template file, wherein the container template file includes the running status information of the micro virtual machine in the started secure container and the memory image of the client virtual machine;

[0086] The startup module 203 is used to start the secure container according to the container template file.

[0087] Before the acquisition module 202 acquires the container template file, the device also includes: a template creation module, which is used to receive a container template creation request; use snapshot technology to generate a container template file corresponding to the started security container; and store the container template file in a set storage medium.

[0088] The template creation module is specifically used for cold starting the micro virtual machine; determining the startup of the agent program in the client virtual machine of the micro virtual machine; using snapshot technology to save the current running status information of the micro virtual machine and the memory image of the client virtual machine to obtain a container template file.

[0089] The acquisition module 202 is used to acquire the container specification of the container instance from the configuration information of the container instance included in the container startup request; and acquire a container template file from all currently stored container template files according to the container specification.

[0090] The acquisition module 202 is specifically used to determine whether there is a container template file that meets the container specifications in each currently stored container template file; if yes, obtain the container template file that meets the container specifications; if not, randomly obtain a container template file from each container template file.

[0091] The device also includes: a specification adjustment module, which is used to adjust the specification of the started security container to the container specification after starting the security container based on the randomly obtained container template file.

[0092] The acquisition module 202 is used to acquire the container template file corresponding to the template identifier according to the template identifier included in the container startup request.

[0093] The acquisition module 202 is specifically used to select a security container from at least one currently running security container; soft copy the current running status information of the micro virtual machine and the memory data of the client virtual machine in the selected security container to obtain a container template file.

[0094] The device also includes: a storage module, which is used to store the container template file obtained by soft copy in a set storage medium.

[0095] The startup module 203 is used to modify the configuration information of the micro virtual machine included in the running status information according to the current container configuration information; start the micro virtual machine based on the modified running status information; connect to the agent program in the client virtual machine according to the memory image of the client virtual machine; and modify the configuration information of the client virtual machine through the agent program.

[0096] The startup module 203 is also used to start a preset number of secure container instances according to the container template file when the number of secure container instances included in the resource pool is less than a preset threshold; and store the preset number of secure container instances in the resource pool.

[0097] The secure container startup device provided in the above-mentioned embodiment of the present application and the secure container startup method provided in the embodiment of the present application are based on the same inventive concept and have the same beneficial effects as the methods adopted, run or implemented by the application programs stored therein.

[0098] The present application also provides an electronic device to execute the above-mentioned secure container startup method. Figure 4 , which shows a schematic diagram of an electronic device provided by some embodiments of the present application. Figure 4 As shown, the electronic device 4 includes: a processor 400, a memory 401, a bus 402 and a communication interface 403, and the processor 400, the communication interface 403 and the memory 401 are connected via the bus 402; the memory 401 stores a computer program that can be run on the processor 400, and when the processor 400 runs the computer program, it executes the secure container startup method provided in any of the aforementioned embodiments of the present application.

[0099] The memory 401 may include a high-speed random access memory (RAM), and may also include a non-volatile memory, such as at least one disk storage. The communication connection between the device network element and at least one other network element is realized through at least one communication interface 403 (which may be wired or wireless), and the Internet, wide area network, local area network, metropolitan area network, etc. may be used.

[0100] The bus 402 may be an ISA bus, a PCI bus, or an EISA bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. Among them, the memory 401 is used to store programs, and the processor 400 executes the program after receiving the execution instruction. The secure container startup method disclosed in any implementation of the embodiment of the present application may be applied to the processor 400, or implemented by the processor 400.

[0101] The processor 400 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit or software instructions in the processor 400. The above processor 400 can be a general-purpose processor, including a processor (Central Processing Unit, referred to as CPU), a network processor (Network Processor, referred to as NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a readily available programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present application can be implemented or executed. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in the embodiments of the present application can be directly embodied as a hardware decoding processor to be executed, or the hardware and software modules in the decoding processor can be executed. The software module can be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 401, and the processor 400 reads the information in the memory 401 and completes the steps of the above method in combination with its hardware.

[0102] The electronic device provided in the embodiment of the present application and the secure container startup method provided in the embodiment of the present application are based on the same inventive concept and have the same beneficial effects as the methods adopted, operated or implemented therein.

[0103] The present application also provides a computer-readable storage medium corresponding to the secure container startup method provided in the above embodiment. Figure 5 The computer-readable storage medium shown is a CD 30 on which a computer program (i.e., a program product) is stored. When the computer program is run by a processor, it will execute the secure container startup method provided by any of the aforementioned embodiments.

[0104] It should be noted that examples of the computer-readable storage medium may also include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other optical or magnetic storage media, which are not listed here one by one.

[0105] The computer-readable storage medium provided in the above-mentioned embodiments of the present application and the secure container startup method provided in the embodiments of the present application are based on the same inventive concept and have the same beneficial effects as the methods adopted, run or implemented by the application programs stored therein.

[0106] It should be noted that:

[0107] In the description provided herein, a large number of specific details are described. However, it is understood that the embodiments of the present application can be practiced without these specific details. In some instances, well-known structures and technologies are not shown in detail so as not to obscure the understanding of this description.

[0108] Similarly, it should be understood that in order to streamline the present application and help understand one or more of the various inventive aspects, in the above description of the exemplary embodiments of the present application, the various features of the present application are sometimes grouped together into a single embodiment, figure, or description thereof. However, the disclosed method should not be interpreted as reflecting the following schematic diagram: the claimed application requires more features than the features clearly stated in each claim. More specifically, as reflected in the claims below, the inventive aspects are less than all the features of the single embodiment disclosed above. Therefore, the claims following the specific embodiment are hereby expressly incorporated into the specific embodiment, wherein each claim itself serves as a separate embodiment of the present application.

[0109] In addition, those skilled in the art will appreciate that, although some embodiments described herein include certain features included in other embodiments but not other features, the combination of features of different embodiments is meant to be within the scope of the present application and form different embodiments. For example, in the claims below, any one of the claimed embodiments may be used in any combination.

[0110] The above is only a preferred specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed in the present application should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.

Claims

1. A secure container startup method, characterized in that: The method comprises: Receiving a container startup request, wherein the container startup request includes a container specification of a container instance requested to be started; According to the container specification, a container template file is obtained, wherein the container template file includes the running status information of the micro virtual machine in the started secure container and the memory image of the client virtual machine; Start a secure container according to the container template file; If there is currently no container template file that meets the container specification, after starting the secure container based on the obtained container template file, the specification of the started secure container is adjusted to the container specification through the container engine; The step of obtaining a container template file according to the container specification includes: Determine whether there is a container template file that meets the container specification among each currently stored container template file; If yes, obtaining a container template file that meets the container specification; If not, compare the container specifications corresponding to each currently stored container template file with the container specifications corresponding to the container startup request, calculate the specification difference between the container specifications corresponding to each container template file and the container specifications corresponding to the container startup request, and select the container template file with the smallest specification difference.

2. The method according to claim 1, characterized in that Before obtaining the container template file, the method further includes: Receive a container template creation request; Use snapshot technology to generate container template files corresponding to the started secure container; The container template file is stored in a set storage medium.

3. The method according to claim 2, characterized in that The method of using snapshot technology to generate a container template file corresponding to the started secure container includes: Cold start the micro virtual machine; Determine that the agent program in the client virtual machine of the micro virtual machine is started; The snapshot technology is used to save the current running status information of the micro virtual machine and the memory image of the client virtual machine to obtain a container template file.

4. The method according to claim 1, characterized in that: The step of obtaining the container template file includes: Acquire a container specification of the container instance from configuration information of the container instance included in the container startup request; According to the container specification, a container template file is obtained from all currently stored container template files.

5. The method according to claim 1, characterized in that: The step of obtaining the container template file includes: According to the template identifier included in the container startup request, a container template file corresponding to the template identifier is acquired.

6. The method according to claim 1, characterized in that The step of obtaining the container template file includes: Select a security container from at least one currently running security container; A soft copy is made of the current running status information of the micro virtual machine and the memory data of the client virtual machine in the selected secure container to obtain a container template file.

7. The method according to claim 6, characterized in that The method further comprises: The container template file obtained by soft copy is stored in a set storage medium.

8. The method according to claim 1, characterized in that The starting the secure container according to the container template file includes: Modify the configuration information of the micro virtual machine included in the running status information according to the current container configuration information; Starting the micro virtual machine based on the modified running status information; Connecting to the agent program in the client virtual machine according to the memory image of the client virtual machine; The configuration information of the client virtual machine is modified through the agent program.

9. The method according to any one of claims 1 to 8, characterized in that: The method further comprises: When the number of secure container instances included in the resource pool is less than a preset threshold, starting a preset number of secure container instances according to the container template file; The preset number of secure container instances are stored in the resource pool.

10. A safety container starting device, characterized in that: The device comprises: A receiving module, configured to receive a container startup request, wherein the container startup request includes a container specification of a container instance requested to be started; An acquisition module, used to acquire a container template file according to the container specification, wherein the container template file includes the running status information of the micro virtual machine in the started secure container and the memory image of the client virtual machine; A startup module, used to start a secure container according to the container template file; if there is currently no container template file that meets the container specification, after starting the secure container based on the obtained container template file, the specification of the started secure container is adjusted to the container specification through the container engine; The acquisition module is used to determine whether there is a container template file that meets the container specification in each currently stored container template file; if so, obtain the container template file that meets the container specification; if not, compare the container specification corresponding to each currently stored container template file with the container specification corresponding to the container startup request, calculate the specification difference between the container specification corresponding to each container template file and the container specification corresponding to the container startup request, and select the container template file with the smallest specification difference.

11. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: The processor runs the computer program to implement the method according to any one of claims 1 to 9.

12. A computer-readable storage medium having a computer program stored thereon, characterized in that: The program is executed by a processor to implement the method according to any one of claims 1 to 9.

Citation Information

Patent Citations

  • Virtual machine starting method and device

    CN111506389A