Container startup method, device, electronic device and storage medium

By using cloud disks to centrally store container images in the Kubernetes container cluster, the problems of storage space waste and image repository pressure during concurrent node startup are solved, and efficient container startup and image management are achieved.

CN116467046BActive Publication Date: 2025-09-16BEIJING YOUZHUJU NETWORK TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202310446150.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-04-23
Publication Date
2025-09-16
Estimated Expiration
2043-04-23

AI Technical Summary

Technical Problem

In a Kubernetes container cluster, when multiple nodes start containers concurrently, there are problems such as wasted data storage space and high concurrency pressure on the image repository.

Method used

Container images are centrally stored using cloud disks and managed by the control center. Each node obtains a snapshot disk from the cloud to start the container, reducing local image storage and image repository access.

Benefits of technology

It saves storage space, improves container startup efficiency, and reduces the concurrent pressure on the image repository.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116467046B_ABST
    Figure CN116467046B_ABST
Patent Text Reader

Abstract

The present disclosure discloses a container startup method, device, electronic device and storage medium. It includes: obtaining the container image corresponding to the container cluster from the cloud; sending a snapshot disk acquisition instruction to the service component based on the container image, wherein the snapshot disk acquisition instruction is used to obtain the snapshot disk generated using the mounting information of the container image; receiving the snapshot disk fed back by the service component based on the snapshot disk acquisition instruction, mounting the snapshot disk as a container startup program to the host machine, and triggering the container startup instruction to take effect; based on the container startup instruction, hot-plugging the snapshot disk to the virtual machine of the target container, so that the target node performs the container startup operation on the target container based on the snapshot disk. The present disclosure centrally stores container images in the container cluster by means of a cloud disk, so that each container image is saved in a copy in the cluster, which saves storage space compared to storing the container image on each node. Even when starting containers concurrently on multiple nodes, the cold start efficiency can be effectively guaranteed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technology, and in particular to a container startup method, device, electronic device, and storage medium. Background Art

[0002] Container technology, also known as container virtualization, is a lightweight virtualization technology based on Namespace and Cgroup implementation. The current main implementation is based on runc (runc is a command-line client used to run applications packaged according to the Open Container Initiative (OCI) format). For runc, multiple containers share the kernel on the host machine. In a Kubernetes container cluster (Kubernetes is an open source platform for managing containerized workloads and services) with a large number of nodes (such as thousands of nodes), when a large number of pods (pod is the smallest unit of Kubernetes, and containers are contained in pods. A pod has a pause container and several business containers. It can be understood that a pod is a container group) need to be started concurrently, and the image needs to be pulled and decompressed on each node. There are several problems: (1) The same data must be stored on each node, resulting in a waste of data storage space. (2) Multiple nodes need to pull images concurrently, which poses a great challenge to the concurrency pressure of the image repository. Summary of the Invention

[0003] In order to solve the above technical problems or at least partially solve the above technical problems, the present disclosure provides a container startup method, device, electronic device and storage medium.

[0004] According to one aspect of an embodiment of the present disclosure, a container startup method is provided, which is applied to a target node in a container cluster, where the target node is any node in the container cluster. The method includes:

[0005] Obtain the container image corresponding to the container cluster from the cloud;

[0006] Sending a snapshot disk acquisition instruction to a control center based on the container image, wherein the control center is connected to each node in the container cluster, and the snapshot disk acquisition instruction is used to acquire a snapshot disk generated using the mount information of the container image;

[0007] receiving a snapshot disk fed back by the control center based on the snapshot disk acquisition instruction, mounting the snapshot disk as a container startup program to the host machine, and triggering the container startup instruction to take effect;

[0008] Based on the container startup instruction, the snapshot disk is hot-plugged into the virtual machine of the target container, so that the target container performs a container startup operation based on the snapshot disk, wherein the target container is a container deployed in the target node.

[0009] According to another aspect of the embodiments of the present disclosure, a container startup method is provided, including:

[0010] Receive a snapshot disk acquisition instruction sent by a target node, wherein the snapshot disk acquisition instruction carries the container image of the container cluster, and the target node is any node in the container cluster;

[0011] Based on the snapshot disk acquisition instruction, read the mount information corresponding to the container image;

[0012] A snapshot disk is created based on the mount information, and the snapshot disk is sent to the target node, so that the target node performs a container startup operation based on the snapshot disk.

[0013] According to another aspect of the embodiments of the present disclosure, a container starting device is provided, comprising:

[0014] The acquisition module is used to obtain the container image corresponding to the container cluster from the cloud;

[0015] A first sending module is configured to send a snapshot disk acquisition instruction to a control center based on the container image, wherein the control center is connected to each node in the container cluster, and the snapshot disk acquisition instruction is used to acquire a snapshot disk generated using the mount information of the container image;

[0016] A first receiving module is configured to receive a snapshot disk fed back by the control center based on the snapshot disk acquisition instruction, mount the snapshot disk as a container startup program to the host machine, and trigger the container startup instruction to take effect;

[0017] A processing module is used to hot-plug the snapshot disk into the virtual machine of the target container based on the container startup instruction, so that the target container performs a container startup operation based on the snapshot disk, wherein the target container is a container deployed in the target node.

[0018] According to another aspect of the embodiments of the present disclosure, a container starting device is provided, comprising:

[0019] A second receiving module is configured to receive a snapshot disk acquisition instruction sent by a target node, wherein the snapshot disk acquisition instruction carries a container image of a container cluster, and wherein the target node is any node in the container cluster;

[0020] A reading module, configured to read the mount information corresponding to the container image based on the snapshot disk acquisition instruction;

[0021] The second sending module is configured to create a snapshot disk based on the mount information, and send the snapshot disk to the target node, so that the target node performs a container startup operation based on the snapshot disk.

[0022] According to another aspect of an embodiment of the present disclosure, a storage medium is further provided. The storage medium includes a stored program, and the above steps are executed when the program is run.

[0023] According to another aspect of an embodiment of the present disclosure, an electronic device is also provided, including a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; wherein: the memory is used to store computer programs; and the processor is used to execute the steps in the above method by running the program stored in the memory.

[0024] The embodiment of the present disclosure further provides a computer program product comprising instructions, which, when executed on a computer, enables the computer to execute the steps in the above method.

[0025] The technical solutions provided by the embodiments of the present disclosure have the following advantages: The method provided by the embodiments of the present disclosure centrally stores container images in a container cluster via cloud disks, allowing each container image to be stored in the cluster. This saves storage space compared to storing container images on each node. This effectively ensures cold start efficiency even when pods are started concurrently on multiple nodes, while also reducing the concurrent pressure on image repository access. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.

[0027] In order to more clearly illustrate the embodiments of the present disclosure or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0028] Figure 1 A flowchart of a container startup method provided in an embodiment of the present disclosure;

[0029] Figure 2 A schematic diagram of a container startup process provided by another embodiment of the present disclosure;

[0030] Figure 3 A flowchart of a container startup method provided in another embodiment of the present disclosure;

[0031] Figure 4 A block diagram of a container startup device provided in an embodiment of the present disclosure;

[0032] Figure 5 A block diagram of a container starting device provided in another embodiment of the present disclosure;

[0033] Figure 6 A schematic structural diagram of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION

[0034] To make the purpose, technical solutions and advantages of the embodiments of the present disclosure clearer, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are part of the embodiments of the present disclosure, not all of the embodiments. The schematic embodiments of the present disclosure and their descriptions are used to explain the present disclosure and do not constitute an improper limitation of the present disclosure. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present disclosure.

[0035] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another similar entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or device comprising the element.

[0036] The present disclosure provides a container startup method, apparatus, electronic device, and storage medium. The methods provided in the present disclosure can be applied to any desired electronic device, such as a server, terminal, or other electronic device. For ease of description, the electronic device will be referred to as such.

[0037] According to one aspect of an embodiment of the present disclosure, a method embodiment of a container startup method is provided. Figure 1 A flowchart of a container startup method provided in an embodiment of the present disclosure is shown as follows: Figure 1 As shown, the method includes:

[0038] Step S11: Obtain the container image corresponding to the container cluster from the cloud.

[0039] The method provided in the embodiment of the present disclosure is applied to the target node in the container cluster, and the target node is any node in the container cluster. Figure 2 As shown, the container cluster includes multiple nodes, each of which is deployed with a container daemon (containerd), a first service component (CloudBlockSnapshotter component), and a pod, etc. In addition, the container cluster also includes a control center, which is deployed with a second service component (BlockSnapshotterServe component).

[0040] It should be noted that the CloudBlockSnapshotter component is based on the snapshotter implementation of containerd. Snapshotter is an external plug-in for containerd that enables containerd to use the image acceleration service. One is deployed on each node in the container cluster to implement the image service interface (ImageService interface) and the external plug-in interface (snapshotter interface), which enables the ability to pull container images and prepare the container rootfs.

[0041] The BlockSnapshotterServer component is deployed in the control center, and only one is deployed. There is a one-to-many relationship between this component and the CloudBlockSnapshotter component. This component can be understood as the server of the CloudBlockSnapshotter component. This component is used to connect to the image repository (image repository) to pull images, and to connect to the cloud (Cloud storage, such as ceph rbd) to implement image storage and container rootfs storage. The container rootfs is the container startup program.

[0042] In the embodiment of the present disclosure, obtaining the container image corresponding to the container cluster from the cloud includes the following steps A1-A3:

[0043] Step A1: Receive a container startup event that occurs in a container cluster, and send a query request to a control center based on the container startup event.

[0044] Step A2: Obtain cloud disk information of the target cloud disk corresponding to the container image fed back by the service component based on the query request.

[0045] Step A3: Use the cloud disk information to download the container image.

[0046] In the embodiment of the present disclosure, when the container cluster starts the Pod of the target node through CRI, it first uses the gRPC interface to call the CloudBlockSnapshotter component to pull the image. At this time, the CloudBlockSnapshotter component receives the container start event that occurs in the container cluster. Then, the CloudBlockSnapshottr component responds to the container start event of the container cluster and uses the ImageService component in the CloudBlockSnapshottr component to send a query request to the BlockSnapshotterServer component deployed in the control center.

[0047] In the disclosed embodiment, after receiving a query request, the BlockSnapshotterServer component queries the cloud for the target cloud disk where the container image corresponding to the container cluster is located, and feeds the cloud disk information of the queried target cloud disk back to the CloudBlockSnapshottr component. After receiving the cloud disk information, the CloudBlockSnapshottr component uses the cloud disk information to download the container image, where the cloud disk information includes the cloud disk ID (i.e., the location of the cloud disk) of the target cloud disk where the container image is located.

[0048] In the embodiment of the present disclosure, a cloud disk is used to store the container image of the container cluster, so that when the container on a node of the container cluster is started, the container image can be directly obtained from the cloud without having to pull the image from the image repository, thereby improving the container startup speed.

[0049] It should be noted that the native containerd snapshotter stores the container image and container rootfs locally, while the embodiment of the present disclosure stores the image in the cloud through cloud disk storage (the image repository and container cluster are deployed in the same computer room), and all containers share a set of storage devices. The bottom layer can be provided by block device storage that supports snapshot capabilities, such as Ceph RBD. Based on this, the embodiment of the present disclosure adopts the method of centrally storing container images on cloud disks, which eliminates the need for each host machine to repeatedly save image data, reduces the host machine image storage space, and reduces the pressure on the image repository compared to concurrently requesting the image repository when starting containers in batches.

[0050] Step S12: Send a snapshot disk acquisition instruction to the service component based on the container image, wherein the snapshot disk acquisition instruction is used to acquire a snapshot disk generated using the mounting information of the container image.

[0051] In the disclosed embodiment, after the CloudBlockSnapshottr component successfully downloads a container image, containerd calls the Snapshottrt interface in the CloudBlockSnapshottr component to send a snapshot disk acquisition instruction to the service component (BlockSnapshotterServer component). After receiving the snapshot disk acquisition instruction, the service component searches for the mount information corresponding to the container image, creates a snapshot disk of the target cloud disk based on the mount information, and finally feeds the snapshot disk back to the CloudBlockSnapshottr component.

[0052] Step S13: receiving the snapshot disk fed back by the service component based on the snapshot disk acquisition instruction, mounting the snapshot disk as a container startup program to the host machine, and triggering the container startup instruction to take effect.

[0053] In the disclosed embodiment, the CloudBlockSnapshotter component obtains the snapshot disk through the Snapshotter interface and mounts it on the host as a container startup program. This confirms that the container startup preparations are complete and triggers the container startup instructions to take effect. It should be noted that the host node does not need to store the image data; only the snapshot disk needs to be mounted, saving storage space on the host.

[0054] Step S14: based on the container startup instruction, hot-plug the snapshot disk into the virtual machine of the target container, so that the target container performs a container startup operation based on the snapshot disk, wherein the target container is a container deployed in the target node.

[0055] In the embodiment of the present disclosure, hot-plugging the snapshot disk into the virtual machine of the target container based on the container startup instruction includes the following steps B1-B2:

[0056] Step B1: Based on the container startup instruction, call the service process to start the virtual machine startup program;

[0057] In step B2, the snapshot disk is hot-plugged into the virtual machine of the target container through a preset protocol using the virtual machine startup program, and the snapshot disk is mounted as a container startup program in the target container.

[0058] In the disclosed embodiment, containerd uses the containerd-shim-kata-v2 process (a service process) to start qemu, hot-plugs the snapshot disk into the target container's virtual machine, katavm, via the virtio-blk protocol (a default protocol), and mounts the snapshot disk as a container startup program within the target container. Finally, containerd uses the containerd-shim-kata-v2 process to call kata-agent via the vsock interface to start the target container.

[0059] The method provided by the embodiments of the present disclosure centrally stores container images in a container cluster via cloud disks. This saves storage space compared to storing container images on each node and eliminates the need to access the image repository for each startup. Even when starting containers concurrently on multiple nodes in a container cluster, cold start efficiency is effectively guaranteed while also reducing the concurrency pressure on image repository access. For example, for a 1000-node cluster, concurrent requests will be reduced to 1 / 1000 of the original number.

[0060] According to another aspect of the present disclosure, a container startup method is provided. Figure 3 A flowchart of a container startup method provided in an embodiment of the present disclosure is shown as follows: Figure 3 As shown, the method includes:

[0061] Step S21: Receive a snapshot disk acquisition instruction sent by a target node, wherein the snapshot disk acquisition instruction carries a container image of a container cluster, and the target node is any node in the container cluster.

[0062] The method provided by the embodiment of the present disclosure is applied to a control center, where a second service component (BlockSnapshotterServer component) is deployed. The BlockSnapshotterServer component is connected to the CloudBlockSnapshotter components in multiple nodes in the container cluster.

[0063] In the embodiment of the present disclosure, before receiving the snapshot disk acquisition instruction sent by the target node, the method further includes the following steps C1-C2:

[0064] Step C1: Receive a query request sent by a target node, and obtain cloud disk information of the container image corresponding to the container cluster from the cloud based on the query request, wherein the target node is any node in the container cluster.

[0065] In the disclosed embodiment, upon receiving a query request from the CloudBlockSnapshotter component in the target node, the BlockSnapshotterServer component in the control center queries the cloud for the existence of a container image corresponding to the container cluster based on the query request, and obtains a query result. If the query result indicates that the container image exists, the cloud disk information of the target cloud disk where the container image is located is obtained.

[0066] It should be noted that when the first node that starts a container in any container cluster obtains the container image from the cloud, it needs to first pull the container image from the image repository to the cloud, so that other nodes in the subsequent container cluster can directly obtain the container image from the cloud when starting the container. Therefore, if the query result shows that the container image exists, it means that other nodes in the container cluster where the target node is located have already pulled the container image from the cloud. At this time, the cloud disk information of the target cloud disk where the container image is located can be directly read.

[0067] Step C2: Send the cloud disk information to the target node, so that the target node downloads the container image based on the cloud disk information.

[0068] In the disclosed embodiment, the method further includes: if the query result indicates that the container image does not exist, it means that the target node is the first node in the container cluster where it is located to start a container, and at this time, the cloud does not have a container image corresponding to the container cluster. Therefore, the BlockSnapshotterServer component first creates an initial cloud disk in the cloud, and uses the image authentication information of the container cluster to pull the container image corresponding to the container cluster from the image repository; then mounts the initial cloud disk and the container image to the specified directory to obtain the target cloud disk and its cloud disk information.

[0069] Step S22: Based on the snapshot disk acquisition instruction, read the mount information corresponding to the container image.

[0070] In the disclosed embodiment, upon receiving a snapshot disk acquisition instruction, the service component searches for the mount information corresponding to the container image. This mount information includes the cloud disk ID of the target cloud disk where the container image resides, the target to which the target cloud disk is mounted, and the image files in the directory. Based on this mount information, the service component then creates a snapshot disk of the target cloud disk and ultimately returns the snapshot disk to the CloudBlockSnapshottr component.

[0071] Step S23: Create a snapshot disk based on the mount information, and send the snapshot disk to the target node, so that the target node performs a container startup operation based on the snapshot disk.

[0072] The CloudBlockSnapshotter component of the method provided in the embodiment of the present disclosure realizes the centralized pulling and decompression operations of the container images of the container cluster by linking with the BlockSnapshotterServer component of the control center, and saves both the container images and the container startup programs in the cloud.

[0073] In the embodiment of the present disclosure, when the control center encounters the first node to start a container in the container cluster, it pulls the image of the container cluster from the image repository through the BlockSnapshotterServer component and stores it in the cloud. In this way, as long as any node in the container cluster downloads the container image from the cloud once, the container cluster does not need to download the image from the image repository again when starting the container again on any node subsequently, thereby speeding up the cold start speed of the container.

[0074] As an example, an embodiment of the present disclosure further provides a container startup method, the method comprising:

[0075] In step (1), when Kubelet starts the Pod through CRI, it first calls the ImageService interface of the CloudBlockSnapshotter component through the gRPC interface to pull the image.

[0076] In step (2), the ImageService in the CloudBlockSnapshotter component calls the BlockSnapshotterServer component to check whether the image is already available in the cloud storage.

[0077] In step (3), if the image in step (2) does not exist in the cloud storage, the BlockSnapshotterServer component calls the CloudStorage interface to create a block device, format the file system, and mount it to the specified directory.

[0078] In step (4), the BlockSnapshotterServer component obtains the image authentication information. The image authentication information is obtained according to the ImageService interface. The image authentication information is used to pull the image manifests and all layers of the image to the specified directory in step (3).

[0079] In step (5), after BlockSnapshotterServer successfully pulls the image, it returns the information of the cloud disk block device (cloud disk ID) corresponding to the image to CloudBlockSnapshotter ImageService.

[0080] Step (6) If the image in step (2) exists in the cloud storage, the information of the cloud disk block device corresponding to the image is directly returned to CloudBlockSnapshotter ImageService.

[0081] Step (7) Containerd calls the Snapshotter interface in CloudBlockSnapshotter to prepare the container rootfs.

[0082] Step (8) Snapshotter calls the BlockSnapshotterServer related interface to obtain the cloud disk mounting information corresponding to the image.

[0083] Step (9) After receiving the request, BlockSnapshotterServer searches for the cloud disk information corresponding to the image, calls the cloud storage interface to create a snapshot disk of the cloud disk, and returns the snapshot disk to Snapshotter.

[0084] Step (10) After the Snapshotter in CloudBlockSnapshotter obtains the cloud disk mounting information (snapshot disk), it mounts the snapshot disk as a container roofts on the host machine.

[0085] In step (11), containerd-shim-kata-v2 starts qemu, hotplugs the snapshot disk into the kata vm through the virtio-blk protocol, and mounts it as the container rootfs.

[0086] In step (12), containerd-shim-kata-v2 calls kata-agent through the vsock interface to start the container.

[0087] Figure 4 This is a block diagram of a container startup device provided by an embodiment of the present disclosure. The device can be implemented as part or all of an electronic device through software, hardware, or a combination of both. Figure 4 As shown, the device includes:

[0088] The acquisition module 41 is used to obtain the container image corresponding to the container cluster from the cloud;

[0089] A first sending module 42 is configured to send a snapshot disk acquisition instruction to a control center based on the container image, wherein the control center is connected to each node in the container cluster, and the snapshot disk acquisition instruction is used to acquire a snapshot disk generated using the mount information of the container image;

[0090] The first receiving module 43 is configured to receive the snapshot disk fed back by the control center based on the snapshot disk acquisition instruction, mount the snapshot disk as a container startup program to the host machine, and trigger the container startup instruction to take effect;

[0091] The processing module 44 is configured to hot-plug the snapshot disk into the virtual machine of the target container based on the container startup instruction, so that the target container performs a container startup operation based on the snapshot disk, wherein the target container is a container deployed in the target node.

[0092] In the embodiment of the present disclosure, the acquisition module 41 is used to receive a container startup event that occurs in the container cluster, and send a query request to the control center based on the container startup event; obtain the cloud disk information of the target cloud disk corresponding to the container image fed back by the service component based on the query request; and use the cloud disk information to download the container image.

[0093] In the embodiment of the present disclosure, the processing module 44 is used to call the service process to start the virtual machine startup program based on the container startup instruction; use the virtual machine startup program to hot-plug the snapshot disk into the virtual machine of the target container through a preset protocol, and mount the snapshot disk as a container startup program in the target container.

[0094] Figure 5 This is a block diagram of a container startup device provided by an embodiment of the present disclosure. The device can be implemented as part or all of an electronic device through software, hardware, or a combination of both. Figure 5 As shown, the device includes:

[0095] The second receiving module 51 is configured to receive a snapshot disk acquisition instruction sent by a target node, wherein the snapshot disk acquisition instruction carries a container image of a container cluster, wherein the target node is any node in the container cluster;

[0096] A reading module 52 is configured to read the mount information corresponding to the container image based on the snapshot disk acquisition instruction;

[0097] The second sending module 53 is configured to create a snapshot disk based on the mount information, and send the snapshot disk to the target node, so that the target node performs a container startup operation based on the snapshot disk.

[0098] In an embodiment of the present disclosure, the container startup device also includes: a query module, which is used to receive a query request sent by a target node, and obtain cloud disk information of the container image corresponding to the container cluster from the cloud based on the query request, wherein the target node is any node in the container cluster; send the cloud disk information to the target node so that the target node downloads the container image based on the cloud disk information.

[0099] In the embodiment of the present disclosure, the query module is used to query from the cloud whether there is a container image corresponding to the container cluster based on the query request, and obtain the query result; if the query result shows that the container image exists, obtain the cloud disk information of the target cloud disk where the container image is located;

[0100] In an embodiment of the present disclosure, the container startup device also includes: a creation module, which is used to create an initial cloud disk in the cloud when the query result shows that the container image does not exist, and use the image authentication information of the container cluster to pull the container image corresponding to the container cluster from the image repository; mount the initial cloud disk and the container image to a specified directory to obtain the target cloud disk and the cloud disk information of the target cloud disk.

[0101] The present disclosure also provides an electronic device, such as Figure 6 As shown, the electronic device may include: a processor 1501 , a communication interface 1502 , a memory 1503 and a communication bus 1504 , wherein the processor 1501 , the communication interface 1502 , and the memory 1503 communicate with each other via the communication bus 1504 .

[0102] Memory 1503, used for storing computer programs;

[0103] The processor 1501 is configured to implement the steps of the above embodiment when executing the computer program stored in the memory 1503 .

[0104] The communication bus mentioned in the terminal can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. This communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is used in the figure, but this does not mean that there is only one bus or only one type of bus.

[0105] The communication interface is used for communication between the above terminal and other devices.

[0106] The memory may include random access memory (RAM) or non-volatile memory, such as at least one disk storage. Alternatively, the memory may be at least one storage device located away from the processor.

[0107] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, and discrete hardware components.

[0108] In another embodiment provided by the present disclosure, a computer-readable storage medium is further provided. The computer-readable storage medium stores instructions, which, when executed on a computer, enable the computer to execute the container startup method described in any one of the above embodiments.

[0109] In another embodiment provided by the present disclosure, a computer program product including instructions is further provided, which, when executed on a computer, enables the computer to execute the container startup method described in any one of the above embodiments.

[0110] In the above embodiments, all or part of the embodiments can be implemented by software, hardware, firmware or any combination thereof. When implemented using software, all or part of the embodiments can be implemented in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of the present disclosure are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from one website, computer, server or data center to another website, computer, server or data center via a wired (e.g., coaxial cable, optical fiber, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) method. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive SolidState Disk).

[0111] The above description is only a preferred embodiment of the present disclosure and is not intended to limit the scope of protection of the present disclosure. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present disclosure are included in the scope of protection of the present disclosure.

[0112] The foregoing description is intended only to provide specific embodiments of the present disclosure, intended to enable those skilled in the art to understand and implement the present disclosure. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present disclosure. Therefore, the present disclosure is not to be limited to the embodiments shown herein, but is to be construed in the broadest manner consistent with the principles and novel features claimed herein.

Claims

1. A container startup method, characterized in that: Applied to a target node in a container cluster, the target node being any node in the container cluster, the method includes: Obtain the container image corresponding to the container cluster from the cloud; Sending a snapshot disk acquisition instruction to a control center based on the container image, wherein the control center is connected to each node in the container cluster, and the snapshot disk acquisition instruction is used to acquire a snapshot disk generated using the mount information of the container image; receiving a snapshot disk fed back by the control center based on the snapshot disk acquisition instruction, mounting the snapshot disk as a container startup program to the host machine, and triggering the container startup instruction to take effect; Based on the container startup instruction, hot-plugging the snapshot disk into a virtual machine of a target container, so that the target container performs a container startup operation based on the snapshot disk, wherein the target container is a container deployed in the target node; The method of obtaining the container image corresponding to the container cluster from the cloud includes: receiving a container startup event occurring in the container cluster, and sending a query request to a control center based on the container startup event; obtaining cloud disk information of the target cloud disk corresponding to the container image fed back by the control center based on the query request; and downloading the container image using the cloud disk information.

2. The method according to claim 1, characterized in that Hot-plugging the snapshot disk into the virtual machine of the target container based on the container startup instruction includes: Based on the container startup instruction, calling the service process to start the virtual machine startup program; The virtual machine startup program is used to hot-plug the snapshot disk into the virtual machine of the target container through a preset protocol, and the snapshot disk is mounted as a container startup program in the target container.

3. A container startup method, characterized in that: Applied to a control center connected to each node in a container cluster, the method includes: Receive a snapshot disk acquisition instruction sent by a target node, wherein the snapshot disk acquisition instruction carries the container image of the container cluster, and the target node is any node in the container cluster; Based on the snapshot disk acquisition instruction, read the mount information corresponding to the container image; Creating a snapshot disk based on the mount information, and sending the snapshot disk to the target node, so that the target node performs a container startup operation based on the snapshot disk; Before receiving the snapshot disk acquisition instruction sent by the target node, the method also includes: receiving a query request sent by the target node, and obtaining cloud disk information of the container image corresponding to the container cluster from the cloud based on the query request; sending the cloud disk information to the target node, so that the target node downloads the container image based on the cloud disk information.

4. The method according to claim 3, characterized in that The obtaining, from the cloud, cloud disk information of the container image corresponding to the container cluster based on the query request includes: Based on the query request, query from the cloud whether there is a container image corresponding to the container cluster, and obtain a query result; If the query result indicates that the container image exists, cloud disk information of the target cloud disk where the container image is located is obtained.

5. The method according to claim 4, characterized in that The method further comprises: If the query result indicates that the container image does not exist, creating an initial cloud disk in the cloud, and using the image authentication information of the container cluster to pull the container image corresponding to the container cluster from the image repository; The initial cloud disk and the container image are mounted to a specified directory to obtain the target cloud disk and the cloud disk information of the target cloud disk.

6. A container starting device, characterized in that: include: The acquisition module is used to obtain the container image corresponding to the container cluster from the cloud; A first sending module is configured to send a snapshot disk acquisition instruction to a control center based on the container image, wherein the control center is connected to each node in the container cluster, and the snapshot disk acquisition instruction is used to acquire a snapshot disk generated using the mount information of the container image; A first receiving module is configured to receive a snapshot disk fed back by the control center based on the snapshot disk acquisition instruction, mount the snapshot disk as a container startup program to the host machine, and trigger the container startup instruction to take effect; a processing module, configured to hot-plug the snapshot disk into a virtual machine of a target container based on the container startup instruction, so that the target container performs a container startup operation based on the snapshot disk, wherein the target container is a container deployed in a target node; The acquisition module is used to receive a container startup event that occurs in the container cluster, and send a query request to the control center based on the container startup event; obtain the cloud disk information of the target cloud disk corresponding to the container image fed back by the control center based on the query request; and use the cloud disk information to download the container image.

7. A container starting device, characterized in that: include: A second receiving module is configured to receive a snapshot disk acquisition instruction sent by a target node, wherein the snapshot disk acquisition instruction carries a container image of a container cluster, and the target node is any node in the container cluster; A reading module, configured to read the mount information corresponding to the container image based on the snapshot disk acquisition instruction; A second sending module is configured to create a snapshot disk based on the mount information, and send the snapshot disk to the target node, so that the target node performs a container startup operation based on the snapshot disk; The container startup device also includes: a query module, which is used to receive a query request sent by a target node, and obtain cloud disk information of the container image corresponding to the container cluster from the cloud based on the query request; and send the cloud disk information to the target node so that the target node downloads the container image based on the cloud disk information.

8. A storage medium, characterized in that: The storage medium includes a stored program, wherein the program executes the method steps of any one of claims 1 to 5 when running.

9. An electronic device, characterized in that: The system comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus; wherein: Memory for storing computer programs; A processor, configured to execute the method steps according to any one of claims 1 to 5 by running a program stored in a memory.

Citation Information

Patent Citations

  • Method and device for sharing container mirror image by physical machine, equipment and storage medium

    CN110704162A