A container management method, device, equipment and medium
By mounting the cloud storage system to the read-write layer of the root file system when the container starts and retaining incremental data when the container restarts or migrates, the problem of container data loss is solved, and the full data of the container is persistently saved, thus improving the user experience.
Patent Information
- Application Number
- CN202410311286.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-18
- Publication Date
- 2026-01-13
- Estimated Expiration
- 2044-03-18
AI Technical Summary
After a container is migrated or restarted, all data in the container except for subdirectory data is lost, affecting the user experience.
When the target container starts, the cloud storage system specified by the storage volume is mounted to the read-write layer of the root file system. In response to a deletion request, incremental data in the read-write layer and the cloud storage system is retained. After restarting, the data is remounted to the read-write layer of the root file system.
It enables persistent incremental data storage in containers, improving the user's data access experience.
Smart Images

Figure CN118132204B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of cloud computing technology, and in particular to a container management method, apparatus, device and medium. Background Technology
[0002] In container orchestration systems, container data can be stored through mounted volumes or cloud disks. However, volumes or cloud disks can only be mounted to a specific subdirectory of the container. After a container is migrated or restarted, only the data in that subdirectory can be saved, while other data in the container is lost, affecting the user experience. Summary of the Invention
[0003] To address the aforementioned technical problems, this disclosure provides a container management method, apparatus, device, and medium.
[0004] This disclosure provides a container management method, the method comprising:
[0005] When the target container starts, the cloud storage system specified by the storage volume is mounted to the read-write layer in the root file system of the target container;
[0006] In response to a deletion request for the target container, a retention operation is performed on the incremental data in the read-write layer and the cloud storage system, and the cloud storage system is remounted to the read-write layer of the root file system of the restarted target container after the target container restarts.
[0007] This disclosure also provides a container management device, the device comprising:
[0008] The mounting module is used to mount the cloud storage system specified by the storage volume to the read / write layer of the root file system of the target container when the target container starts.
[0009] The retention module is used to perform a retention operation on incremental data in the read-write layer and the cloud storage system in response to a deletion request for the target container, and to remount the cloud storage system to the read-write layer of the root file system of the restarted target container after the target container restarts.
[0010] This disclosure also provides an electronic device, the electronic device comprising: a processor; a memory for storing executable instructions of the processor; the processor being configured to read the executable instructions from the memory and execute the instructions to implement the container management method provided in this disclosure.
[0011] This disclosure also provides a computer-readable storage medium storing a computer program for executing the container management method provided in this disclosure.
[0012] This disclosure also provides a computer program product, including a computer program / instructions, characterized in that, when the computer program / instructions are executed by a processor, they implement the steps of the container management method provided in this disclosure.
[0013] Compared with the prior art, the technical solution provided in this disclosure has the following advantages: The container management solution provided in this disclosure mounts the cloud storage system specified by the storage volume to the read / write layer of the root file system of the target container when the target container starts. In response to a deletion request for the target container, a retention operation is performed on the incremental data in the read / write layer and the cloud storage system. After the target container restarts, the cloud storage system is remounted to the read / write layer of the root file system of the restarted target container. By mounting the cloud storage system specified by the storage volume to the read / write layer of the root file system, the data in the read / write layer is stored through the cloud storage system. When the target container is subsequently deleted, the incremental data in the read / write layer and the cloud storage system is retained. After the target container restarts, the cloud storage system is remounted to read the retained incremental data. The incremental data of the container is not affected by the container deletion and is persistently preserved, thereby achieving persistent preservation of all data in the container and improving the user's data access experience. Attached Figure Description
[0014] The above and other features, advantages, and aspects of the embodiments of this disclosure will become more apparent from the accompanying drawings and the following detailed description. Throughout the drawings, the same or similar reference numerals denote the same or similar elements. It should be understood that the drawings are schematic, and the originals and elements are not necessarily drawn to scale.
[0015] Figure 1 A diagram illustrating container management for related technologies;
[0016] Figure 2 A flowchart illustrating a container management method provided in some embodiments of this disclosure;
[0017] Figure 3 A schematic diagram illustrating container management provided for some embodiments of this disclosure;
[0018] Figure 4 A schematic diagram illustrating the launch of a target container provided in some embodiments of this disclosure;
[0019] Figure 5 This is a schematic diagram of the structure of a container management device provided in some embodiments of this disclosure;
[0020] Figure 6 This is a schematic diagram of the structure of an electronic device provided in some embodiments of this disclosure. Detailed Implementation
[0021] Embodiments of this disclosure will now be described in more detail with reference to the accompanying drawings. While some embodiments of this disclosure are shown in the drawings, it should be understood that this disclosure can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of this disclosure. It should be understood that the accompanying drawings and embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of protection of this disclosure.
[0022] It should be understood that the steps described in the method embodiments of this disclosure may be performed in different orders and / or in parallel. Furthermore, the method embodiments may include additional steps and / or omit the steps shown. The scope of this disclosure is not limited in this respect.
[0023] The term "comprising" and its variations as used herein are open-ended inclusion, meaning "including but not limited to". The term "based on" means "at least partially based on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Definitions of other terms will be given in the description below.
[0024] It should be noted that the concepts of "first" and "second" mentioned in this disclosure are used only to distinguish different devices, modules or units, and are not used to limit the order of functions performed by these devices, modules or units or their interdependencies.
[0025] It should be noted that the terms "a" and "a plurality of" used in this disclosure are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise expressly indicated in the context, they should be understood as "one or more".
[0026] The names of messages or information exchanged between multiple devices in the embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.
[0027] In the native implementation of container orchestration systems, container data is stored through mounted volumes or cloud disks. Figure 1 A diagram illustrating container management for related technologies, such as Figure 1 As shown, a volume or cloud disk can only be bound to a specific subdirectory of the container, replacing the original content in the subdirectory with the content from that volume or cloud disk. After container migration or restart, the data in that subdirectory is retained, but other data within the container, such as data in the writable layer, is lost, impacting user experience.
[0028] For example, in a cloud-based integrated development environment, the container's default home directory is mounted to a storage system, and all user data within the home directory is stored on the storage system. This ensures that the user data in the home directory is preserved after the container is migrated or restarted. However, other data generated by the user in the container environment, such as installation packages, is lost.
[0029] To address the aforementioned issues, this disclosure provides a container management method, which will be described below with reference to specific embodiments.
[0030] Figure 2 This is a flowchart illustrating a container management method provided in some embodiments of this disclosure. This method can be executed by a container management device, which can be implemented in software and / or hardware, and is generally integrated into an electronic device. Figure 2 As shown, the container management method includes:
[0031] Step 201: When the target container starts, mount the cloud storage system specified by the storage volume to the read / write layer in the root file system of the target container.
[0032] The target container can be any one or more containers currently being started in the container orchestration system. This embodiment does not limit the type of the target container; for example, the target container can be a standard container that meets a certain container interface specification, and the specific container interface specification is not limited.
[0033] Container orchestration systems are used to manage containerized applications across multiple hosts on a cloud platform. A container orchestration system can be understood as a container orchestration engine, used to automatically deploy, scale, and manage containerized applications. A container group is the smallest unit created or deployed within a container orchestration system; a container group encapsulates one or more containers.
[0034] The storage volume can be understood as an abstraction of the cloud storage system at the container orchestration system level. This storage volume can be used to store data in the read / write layer of the root file system, and it can be a predefined volume within the container orchestration system. The lifecycle of the storage volume can differ from the lifecycle of the target container; in fact, the lifecycle of the storage volume can be independent of the target container's lifecycle. For example, the data stored in the storage volume can still exist after the target container is deleted. This lifecycle characteristic of the storage volume creates a foundation for retaining previously stored data after the target container restarts. The cloud storage system can be a data storage system implemented based on cloud technology. Based on the cloud storage system, data can be stored in the cloud; this cloud storage system is also called a cloud disk. In some embodiments of this disclosure, the cloud storage system is a block storage cloud system. A block storage cloud system can be a cloud storage system that divides data into blocks and stores and accesses data in units of blocks; this block storage cloud system is also called a block storage cloud disk.
[0035] The root file system (RootFS) is a file system used to provide an isolated execution environment for container processes. It can be understood as a union file system. This root file system can include a read-only layer (LowerDir) and a read-write layer (UpperDir). The read-only layer has read-only access permissions and can be used to store read-only image data. The read-write layer has read and write access permissions and is also called the writable layer. It can be used to store readable and writable data and can sit above the read-only layer. This read-write layer can be used to record modifications made to files in the root file system.
[0036] In this embodiment of the disclosure, the container management method can be executed by a container orchestration system, that is, the container management device can be set in the container orchestration system.
[0037] In this embodiment of the disclosure, the container management device can respond to a user's startup request for the target container and start the target container. During the startup process, the cloud storage system corresponding to the storage volume can be mounted to the read / write layer of the root file system of the target container, and then the data in the read / write layer can be stored through the cloud storage system.
[0038] In some embodiments of this disclosure, when the target container starts, mounting the cloud storage system specified by the storage volume to the read-write layer of the root file system of the target container includes: when starting the target container by calling the container running tool, setting the directory of the read-write layer of the root file system of the target container to the mount directory of the storage volume of the specified cloud storage system.
[0039] The container runtime tool can be a lightweight container runtime tool used to create and run containers. The mount directory ( / mount-path) can be the directory to which the storage volume is mounted; this mount directory can be understood as the mount point of the storage volume.
[0040] In this embodiment, after the root file system is built, the container runtime tool is invoked based on the Open Container Initiative to start the target container. During the startup process of the target container, if the container runtime tool determines that the mount directory recorded in the annotation is a read-write layer directory, it indicates that the read-write layer directory is designated as the mount directory of the cloud storage system, and the container management device sets the read-write layer directory of the target container's root file system as the mount directory of the cloud storage system's storage volume. If the container runtime tool determines that the mount directory recorded in the mount annotation is not a read-write layer directory, the cloud storage system's storage volume is mounted according to the mount directory recorded in the mount annotation.
[0041] Figure 3 This is a schematic diagram illustrating container management provided in some embodiments of this disclosure. Figure 3 In this context, the merged directory (MergeDir) can be a directory in the root file system that the container is aware of. For example... Figure 3 As shown, the node agent in the container orchestration system mounts the storage system to the host machine and specifies the writable layer directory of the root file system of the target container as the mount directory of the cloud storage system. The container runtime tool starts the target container to mount the cloud storage system to the readable layer of the root file system.
[0042] In the above scheme, the root file system of the target container is built based on the container runtime, and the target container is started by calling the container runtime tool. Through the cooperation of the container runtime and the container runtime tool, the cloud storage system is mounted to the read-write layer when the target container starts, which creates a foundation for the retention of subsequent incremental data.
[0043] Step 202: In response to the deletion request for the target container, perform a retention operation on the incremental data in the read-write layer and the cloud storage system, and remount the cloud storage system to the read-write layer of the root file system of the restarted target container after the target container restarts.
[0044] The deletion request can be an instruction to delete the target container. In some embodiments of this disclosure, the deletion request includes a migration request or a restart request. A migration request can be an instruction to migrate the target container from one container orchestration system node to another. A restart request can be an instruction to restart the target container. In this embodiment, in response to a migration or restart request for the target container, the container management device retains the incremental data in the read / write layer and the cloud storage system, and remounts the cloud storage system to the read / write layer of the root file system of the restarted target container after restarting. In both cases of migrating or restarting the target container, the original incremental data in the read / write layer corresponding to the target container can be retained.
[0045] Incremental data can be data used to record changes during the operation of the target container. This incremental data can be data recorded in the read-write layer of the target container's root file system. Since the cloud storage system is mounted on this read-write layer, this incremental data is specifically stored in the cloud storage system. The retention operation can be an operation that does not delete the incremental data; this retention operation can be implemented by executing corresponding retention code.
[0046] In this embodiment, during the operation of the target container, since the cloud storage system is mounted on the read-write layer of the root file system, and the read-write layer records data changes during the operation of the target container through incremental data, the incremental data is synchronized to the cloud storage system, thus achieving synchronization of data changes within the target container. If a user needs to delete the target container, the user can create a corresponding deletion process. The deletion process generates a deletion request for the target container and sends the deletion request to the container management device. The container management device responds to the deletion request, executes the deletion of the target container, and intercepts the deletion of incremental data in the read-write layer and the cloud storage system, thereby achieving the retention of incremental data in the read-write layer and the cloud storage system.
[0047] Furthermore, after the target container restarts, the cloud storage system is remounted to the read-write layer of the root file system of the restarted target container. The data in this read-write layer is the data stored in the cloud storage system, which is the data recorded in the read-write layer before the target container was deleted.
[0048] In some embodiments of this disclosure, a retention operation is performed on incremental data in the read-write layer and the cloud storage system, including: obtaining the target directory of the read-write layer recorded in the annotation of the target container; if it is determined that the target directory is the same as the mount directory of the cloud storage system, then it is determined that the cloud storage system is mounted to the read-write layer, and a retention operation is performed on the incremental data in the read-write layer and the cloud storage system.
[0049] The target directory serves as the basis for determining whether to retain incremental data. This target directory can be the directory mounted by the read-write layer if incremental data is to be retained. Understandably, if the read-write layer is mounted to this target directory, the incremental data in the read-write layer is retained; if the read-write layer is not mounted to this target directory, the incremental data in the read-write layer is not retained.
[0050] In this embodiment, in response to receiving a deletion operation on a target container, the container management device parses the comments in the target container to obtain the target directory of the read-write layer recorded in the comments, and obtains the mount directory currently mounted by the cloud storage system. It determines whether the target directory and the mount directory are consistent. If they are, it means that the current cloud storage system is mounted to the read-write layer of the root file system, and the incremental data in the read-write layer and the cloud storage system is retained. If the target directory and the mount directory are inconsistent, it means that the current cloud storage system is not mounted to the read-write layer of the root file system, and the incremental data in the read-write layer is not retained; instead, the incremental data in the read-write layer is deleted.
[0051] In the above scheme, the determination of whether the cloud storage system is mounted on the read-write layer is realized based on the comparison between the target directory and the mount directory, and the incremental data in the read-write layer is retained when the cloud storage system is mounted on the read-write layer.
[0052] The container management scheme provided in this disclosure mounts the cloud storage system specified by the storage volume to the read-write layer of the root file system of the target container when the target container starts. In response to a deletion request for the target container, it performs a retention operation on the incremental data in the read-write layer and the cloud storage system. After the target container restarts, it remounts the cloud storage system to the read-write layer of the root file system of the restarted target container. By mounting the cloud storage system specified by the storage volume to the read-write layer of the root file system, the data in the read-write layer is stored through the cloud storage system. When the target container is subsequently deleted, the incremental data in the read-write layer and the cloud storage system is retained. After the target container restarts, the cloud storage system is remounted to read the retained incremental data. The incremental data of the container is not affected by the container deletion and is persistently preserved, thereby achieving persistent preservation of all data in the container and improving the user's data access experience.
[0053] In related technologies, the storage system is mounted to a subdirectory of the container, and the storage system cannot perceive the root file system, which is a union file system, nor can it perceive the read-write layer within the root file system. However, in this embodiment, operations are implemented on the root file system, mounting the container to the read-write layer of the root file system, thereby achieving the retention of incremental data in the read-write layer. If the mirror data in the read-only layer remains unchanged, this incremental data, combined with the mirror data in the read-only layer, constitutes all the data of the target container, thus achieving full preservation of the target container's data.
[0054] In some embodiments of this disclosure, before the target container is started, the container management method further includes: mounting a cloud storage system onto the host machine of the target container, and building the root file system of the target container based on the container runtime.
[0055] The container runtime is an industry-standard container runtime that can perform one or more of the following functions: managing the container lifecycle, pulling or pushing container images, managing the storage of images and container data, calling command-line tools to run containers, and managing container networks and network interfaces. The host machine can be a physical machine or a virtual machine running a container orchestration system node.
[0056] In this embodiment, the node agent in the container orchestration system can mount the cloud storage system onto the host machine of the target container and invoke the container runtime through the container runtime interface based on a pre-configured remote procedure call service to build the root file system of the target container. Specifically, an image is downloaded from a pre-configured image repository. This image includes multiple compressed files, each corresponding to a layer in the read-only layer. The compressed files are decompressed into the directory of the corresponding layer to obtain the read-only layer of the root file system. The read-write layer of the root file system is then set to an empty directory, thus obtaining the root file system. During the construction of the root file system, the container runtime records the mount directory of the cloud storage system through annotations. The mount directory recorded by these annotations can be the directory of the read-write layer.
[0057] Figure 4 This is a schematic diagram illustrating the launch target container provided in some embodiments of this disclosure, such as... Figure 4 As shown, the node agent in the container orchestration system mounts the cloud storage system to the host machine, calls the container runtime based on the pre-configured remote procedure call service through the container runtime interface, the container runtime builds the root file system of the target container, and calls the container runtime tool through the Open Container Initiative, and starts the target container through the container runtime tool.
[0058] The above solution enables the construction of a root file system, laying the foundation for the subsequent mounting of cloud storage systems.
[0059] In some embodiments of this disclosure, the container management method further includes adding retention code to the deletion code of the target container, wherein the retention code is used to prevent deletion of incremental data in the read-write layer when the deletion of the target container is determined.
[0060] The deletion code can be existing functional code for deleting the target container. This deletion code may include migration code for migrating the target container or container code for restarting the target container. The retention code can be newly added functional code for retaining incremental data. This retention code can be a logical code branch added to the deletion code to retain incremental data. This retention code can be code built based on conditional statements. The condition for the retention code can be that the mount directory of the cloud storage system is a directory in the read-write layer of the root file system, and the operation to be performed can be to not perform the deletion operation on the incremental data in the read-write layer. This embodiment does not limit the type of the conditional statement; for example, the conditional statement can be an if-then statement.
[0061] In this embodiment, retention code is added to the existing deletion code that deletes the target container. Subsequently, when the target container is deleted, the deletion code for the target container is executed, along with the retention code for incremental data within that deletion code. This ensures that incremental data in the read / write layer is retained when the target container is deleted. Thus, at the code level, a foundation is created for subsequently deleting the target container while retaining incremental data in the read / write layer.
[0062] In some embodiments of this disclosure, after mounting the cloud storage system to the read-write layer in the root file system of the target container when the target container starts, the container management method further includes: in response to a data operation request for the target container, storing incremental data corresponding to the data operation request in the read-write layer and the cloud storage system.
[0063] The data operation request can be a processing request for data in the target container. This embodiment does not limit the type of the data operation request; for example, it can be one or more of the add, delete, and modify operations. This embodiment also does not limit the layer where the data being operated on resides; for example, the data can be in a read-only layer or in a read-write layer.
[0064] In this embodiment, after mounting the cloud storage system to the read-write layer of the root file system of the target container, if a user needs to operate on the data in the target container, the user can create a corresponding operation process and send a data operation request to the container management device through this operation process. After receiving the data operation request, the container management device parses the data operation request. If the data operation request is to add or modify data in the read-only layer, the container management device can copy the data to the read-write layer and perform the add or modify operation on the data in the read-write layer according to the data operation request, generating and storing the corresponding incremental data in the read-write layer and the cloud storage system. If the data operation request is to delete data in the read-only layer, the container management device can create occlusion data for the data in the read-write layer, thereby hiding the data and using the occlusion data as incremental data.
[0065] If the data operation request is for processing existing incremental data in the read / write layer, then one or more of the operations of adding, deleting, or modifying are performed on the existing incremental data according to the data operation request to obtain the new incremental data corresponding to the data operation request.
[0066] In the above solution, incremental data is stored in the read-write layer and cloud storage system in response to data operation requests, thus realizing the processing of data operation requests. Furthermore, based on this incremental data and the read-only data in the read-only layer, the full dataset can be constructed.
[0067] The container management method in this embodiment will be further illustrated by a specific example below.
[0068] In this embodiment, the node agent in the container orchestration system mounts the cloud storage system to the host machine. Here, the cloud storage system can be a directory on the host machine. The root file system of the target container is generated during container runtime. This root file system can be understood as a union file system. The read-only layer in the root file system stores read-only image data, and the directories in the read-write layer are the directories mounted by the cloud storage system. Data changes in the target container are synchronized to the cloud storage system as incremental data in the read-write layer.
[0069] The container management scheme provided in this disclosure specifies the mount directory of the cloud storage system as the directory of the read-write layer of the root file system when the container is assembling the root file directory during runtime. Subsequently, the cloud storage system saves the data in the writable layer of the root file system. This incremental data, combined with the image data in the read-only layer, achieves full saving of the target container data.
[0070] Figure 5This is a schematic diagram of the structure of a container management device provided in some embodiments of this disclosure. This device can be implemented by software and / or hardware and is generally integrated into an electronic device. For example... Figure 5 As shown, the container management device includes:
[0071] Mounting module 501 is used to mount the cloud storage system specified by the storage volume to the read / write layer of the root file system of the target container when the target container starts.
[0072] The retention module 502 is used to perform a retention operation on the incremental data in the read-write layer and the cloud storage system in response to a deletion request for the target container, and to remount the cloud storage system to the read-write layer of the root file system of the restarted target container after the target container restarts.
[0073] In some embodiments of this disclosure, the mounting module 501 is used for:
[0074] When the target container is started by calling the container runtime tool, the directory of the read / write layer of the root file system of the target container is set to the mount directory of the storage volume of the specified cloud storage system.
[0075] In some embodiments of this disclosure, the retention module 502 is used for:
[0076] Obtain the target directory of the read / write layer as recorded in the annotation of the target container;
[0077] If it is determined that the target directory is the same as the mount directory of the cloud storage system, then the cloud storage system is mounted to the read-write layer, and a retention operation is performed on the incremental data in the read-write layer and the cloud storage system.
[0078] In some embodiments of this disclosure, the container management device further includes:
[0079] The build module is used to mount the cloud storage system onto the host machine of the target container before the target container starts, and to build the root file system of the target container based on the container runtime.
[0080] In some embodiments of this disclosure, the container management device further includes:
[0081] An additional module is added to the deletion code of the target container, wherein the reserved code is used to prevent the deletion operation from being performed on the incremental data of the read-write layer when the deletion of the target container is determined.
[0082] In some embodiments of this disclosure, the container management device further includes:
[0083] The storage module is used to mount the cloud storage system to the read-write layer of the root file system of the target container when the target container starts, and in response to the data operation request of the target container, store the incremental data corresponding to the data operation request in the read-write layer and the cloud storage system.
[0084] In some embodiments of this disclosure, the deletion request includes a migration request or a restart request, and the cloud storage system is a block storage cloud system.
[0085] The container management device provided in this disclosure can execute the container management method provided in any embodiment of this disclosure, and has the corresponding functional modules and beneficial effects of executing the method.
[0086] A computer program product includes a computer program / instructions, characterized in that, when the computer program / instructions are executed by a processor, they implement the steps of the above-described container management method.
[0087] Figure 6 This is a schematic diagram of the structure of an electronic device provided in some embodiments of this disclosure.
[0088] The following is a detailed reference. Figure 6 The diagram illustrates a structural schematic suitable for implementing the electronic device 600 in the embodiments of this disclosure. The electronic device 600 in the embodiments of this disclosure may include, but is not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and fixed terminals such as digital TVs and desktop computers. Figure 6 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of the embodiments disclosed herein.
[0089] like Figure 6 As shown, electronic device 600 may include a processing device (e.g., a central processing unit, a graphics processor, etc.) 601, which can perform various appropriate actions and processes according to a program stored in read-only memory (ROM) 602 or a program loaded from storage device 608 into random access memory (RAM) 603. RAM 603 also stores various programs and data required for the operation of electronic device 600. Processing device 601, ROM 602, and RAM 603 are interconnected via bus 604. Input / output (I / O) interface 605 is also connected to bus 604.
[0090] Typically, the following devices can be connected to I / O interface 605: input devices 606 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 607 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 608 including, for example, magnetic tapes, hard disks, etc.; and communication devices 609. Communication device 609 allows electronic device 600 to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 6 An electronic device 600 with various devices is shown; however, it should be understood that it is not required to implement or possess all of the devices shown. More or fewer devices may be implemented or possessed alternatively.
[0091] In particular, according to embodiments of this disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this disclosure include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device 609, or installed from a storage device 608, or installed from a ROM 602. When the computer program is executed by a processing device 601, it performs the functions defined in the container management method of embodiments of this disclosure.
[0092] It should be noted that the computer-readable medium described in this disclosure can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this disclosure, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in connection with an instruction execution system, apparatus, or device. In this disclosure, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium can be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wires, optical fibers, RF (radio frequency), etc., or any suitable combination thereof.
[0093] In some implementations, clients and servers can communicate using any currently known or future-developed network protocol such as HTTP (Hypertext Transfer Protocol) and can interconnect with digital data communication (e.g., communication networks) of any form or medium. Examples of communication networks include local area networks (“LANs”), wide area networks (“WANs”), the Internet (e.g., the Internet of Things), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future-developed networks.
[0094] The aforementioned computer-readable medium may be included in the aforementioned electronic device; or it may exist independently and not assembled into the electronic device.
[0095] The aforementioned computer-readable medium carries one or more programs that, when executed by the electronic device, cause the electronic device to: mount the cloud storage system specified by the storage volume to the read-write layer of the root file system of the target container when the target container starts; perform a retention operation on the incremental data in the read-write layer and the cloud storage system in response to a deletion request for the target container; and remount the cloud storage system to the read-write layer of the root file system of the restarted target container after the target container restarts.
[0096] Computer program code for performing the operations of this disclosure can be written in one or more programming languages or a combination thereof, including but not limited to object-oriented programming languages such as Java, Smalltalk, and C++, as well as conventional procedural programming languages such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0097] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0098] The units described in the embodiments of this disclosure can be implemented in software or hardware. The names of the units are not, in some cases, intended to limit the specific unit.
[0099] The functions described above in this document can be performed, at least in part, by one or more hardware logic components. For example, exemplary types of hardware logic components that can be used, without limitation, include: Field Programmable Gate Arrays (FPGAs), Application-Specific Integrated Circuits (ASICs), Application Standard Products (ASSPs), System-on-Chip (SoCs), Complex Programmable Logic Devices (CPLDs), and so on.
[0100] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0101] It is understood that before using the technical solutions disclosed in the various embodiments of this disclosure, users should be informed of the types, scope of use, and usage scenarios of the information involved in this disclosure in an appropriate manner in accordance with relevant laws and regulations, and user authorization should be obtained.
[0102] The above description is merely a preferred embodiment of this disclosure and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of this disclosure is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the above-described concept. For example, technical solutions formed by substituting the above features with (but not limited to) technical features disclosed in this disclosure that have similar functions.
[0103] Furthermore, while the operations are described in a specific order, this should not be construed as requiring these operations to be performed in the specific order shown or in a sequential order. In certain environments, multitasking and parallel processing may be advantageous. Similarly, while several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of this disclosure. Certain features described in the context of individual embodiments may also be implemented in combination in a single embodiment. Conversely, various features described in the context of a single embodiment may also be implemented individually or in any suitable sub-combination in multiple embodiments.
[0104] Although the subject matter has been described using language specific to structural features and / or methodological logic, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. Rather, the specific features and actions described above are merely illustrative examples of implementing the claims.
Claims
1. A container management method, characterized in that, include: When the target container starts, the cloud storage system specified by the storage volume is mounted to the read-write layer in the root file system of the target container; In response to a deletion request for the target container, a retention operation is performed on the incremental data in the read-write layer and the cloud storage system, and after the target container restarts, the cloud storage system is remounted to the read-write layer of the root file system of the restarted target container. Specifically, the retention operation for incremental data in the read / write layer and the cloud storage system includes: Obtain the target directory of the read / write layer as recorded in the annotation of the target container; If it is determined that the target directory is the same as the mount directory of the cloud storage system, then the cloud storage system is mounted to the read-write layer, and a retention operation is performed on the incremental data in the read-write layer and the cloud storage system.
2. The method according to claim 1, characterized in that, When the target container starts, the cloud storage system specified by the storage volume is mounted to the read-write layer in the root file system of the target container, including: When the target container is started by calling the container runtime tool, the directory of the read / write layer of the root file system of the target container is set to the mount directory of the storage volume of the specified cloud storage system.
3. The method according to claim 1, characterized in that, Before the target container starts, the method also includes: The cloud storage system is mounted onto the host machine of the target container, and the root file system of the target container is built based on the container runtime.
4. The method according to claim 1, characterized in that, The method further includes: Add a retention code to the deletion code of the target container, wherein the retention code is used to prevent the deletion operation from being performed on the incremental data of the read-write layer when the deletion of the target container is determined.
5. The method according to claim 1, characterized in that, After mounting the cloud storage system to the read-write layer of the root file system of the target container when the target container starts, the method further includes: In response to a data operation request for the target container, incremental data corresponding to the data operation request is stored in the read / write layer and the cloud storage system.
6. The method according to claim 1, characterized in that, The deletion request includes a migration request or a restart request, and the cloud storage system is a block storage cloud system.
7. A container management method, characterized in that, include: The mounting module is used to mount the cloud storage system specified by the storage volume to the read / write layer of the root file system of the target container when the target container starts. The retention module is used to perform a retention operation on incremental data in the read-write layer and the cloud storage system in response to a deletion request for the target container, and to remount the cloud storage system to the read-write layer of the root file system of the restarted target container after the target container restarts. Specifically, the retention operation for incremental data in the read / write layer and the cloud storage system includes: Obtain the target directory of the read / write layer as recorded in the annotation of the target container; If it is determined that the target directory is the same as the mount directory of the cloud storage system, then the cloud storage system is mounted to the read-write layer, and a retention operation is performed on the incremental data in the read-write layer and the cloud storage system.
8. An electronic device, characterized in that, The electronic device includes: processor; Memory used to store the processor's executable instructions; The processor is configured to read the executable instructions from the memory and execute the instructions to implement the container management method according to any one of claims 1-6.
9. A computer-readable storage medium, characterized in that, The storage medium stores a computer program for executing the container management method according to any one of claims 1-6.
10. A computer program product comprising a computer program / instructions, characterized in that, When the computer program / instructions are executed by the processor, they implement the steps of the container management method according to any one of claims 1-6.
Citation Information
Patent Citations
Information processing method and device based on cloud platform, equipment and medium
CN116339920A
Container starting method and device, electronic equipment and storage medium
CN116483514A