User working environment persistent storage method and system based on double-layer container

By adopting a two-layer container architecture in the Kubernetes cluster, and utilizing shared storage space to replicate storage blocks and incremental snapshot technology, the problem of low efficiency in container state persistence is solved, enabling fast image pulling and efficient preservation of the user's working environment.

CN121597345APending Publication Date: 2026-03-03BEIJING PARATERA TECH +1
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202511630736.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-07
Publication Date
2026-03-03

AI Technical Summary

Technical Problem

In existing technologies, the persistence of container state in Kubernetes clusters is inefficient, container startup latency is high, and the large image files result in low image retrieval efficiency, making it impossible to effectively save the user's working environment.

Method used

A two-layer container architecture is adopted. By copying storage blocks in a shared storage space and pulling public container images, two layers of containers are established. The outer container is responsible for resource scheduling, while the inner container modifies and saves the user's working environment. Incremental snapshots and tiered storage form a user image layer.

Benefits of technology

It improves the efficiency of pulling public container images, reduces the size of image files, enhances the efficiency of persistent storage of container states and user working environments, and enables fast restart and private image creation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121597345A_ABST
    Figure CN121597345A_ABST
Patent Text Reader

Abstract

The invention discloses a user working environment persistent storage method based on a double-layer container. The method comprises the steps that mirror images of all public containers in mirror image private server are pulled to a shared storage space to form a hot loading area; dividing a corresponding working space from the shared storage space, querying a target storage block corresponding to a target public container mirror image from a hot loading area based on a public container mirror image identifier in a creation request from a client, copying the target storage block to the working space to serve as a system disk, and further establishing a double-layer container and starting the double-layer container; in response to a modification request of a client, performing corresponding modification operation on the initial state inner layer container to obtain a target state inner layer container, so as to run a user working environment based on the target state inner layer container to execute a computing power task; and storing a file corresponding to the modification operation in the remaining space except the system disk in the workspace to form a user mirror image layer. According to the invention, the persistent storage efficiency of the container state and the user working environment can be improved, and the rapid restarting of the container can be realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of intelligent computing technology, and in particular to a method and system for persistently storing a user's working environment based on a two-layer container. Background Technology

[0002] Currently, the field of intelligent computing generally adopts containerization technology (such as Docker) to encapsulate computing resources (such as GPU resources) and uses Kubernetes (K8s) to achieve resource scheduling, with typical examples such as AutoDL.

[0003] In traditional Kubernetes clusters, applications run in single-layer containers. If the data or processing results generated by the application are not saved through external PVC storage or databases, the data will be lost after the Pod restarts.

[0004] Additionally, during container operation, user-installed software needs to be saved through image commit or save operations; otherwise, this software will be lost upon Pod restart. It's important to note that GPU resources deployed via Kubernetes are similar to using a "workstation." Besides pre-installed software like SSH or Jupyter, additional software is installed as needed. Furthermore, environment parameters are adjusted when performing GPU tasks (such as inference / training). In some application scenarios, users want these environment parameters to be preserved upon shutdown to maintain their working environment, which necessitates closing the Pod.

[0005] In existing technologies, the container state and user working environment are saved through the commit or save operations of the container image. However, this operation can lead to excessively large image files and is time-consuming, resulting in low efficiency in persistent storage of the container state. Furthermore, commit / save operations are equivalent to increasing the number of image layers, which is limited and cannot be increased indefinitely. In addition, excessively large image files can lead to inefficient image pulling, which in turn can cause delays in container startup.

[0006] Therefore, a persistent storage method for the user's working environment based on a two-layer container is needed to solve the problems existing in the above technical solutions. Summary of the Invention

[0007] Therefore, the present invention provides a method and system for persistently storing a user's working environment based on a two-layer container, in order to solve or at least alleviate the problems mentioned above.

[0008] According to one aspect of the present invention, a method for persistently storing a user working environment based on a two-layer container is provided, executed on a container management server, comprising: pulling various public container images from a private image repository to a shared storage space to form a hot-loading area; receiving a user working environment creation request sent by a client, the creation request including a public container image identifier; partitioning a workspace corresponding to the user working environment from the shared storage space, querying a target storage block corresponding to a target public container image from the hot-loading area based on the public container image identifier, and copying the target storage block to the workspace as a system disk; establishing a two-layer container based on the target public container image in the system disk, and starting the two-layer container, the two-layer container including an outer container and an initial state inner container deployed in the outer container; responding to a modification request from the client, performing corresponding modification operations on the initial state inner container to obtain a target state inner container, so as to run the user working environment to perform computing tasks based on the target state inner container, the modification operations including installing new software and adjusting environment parameters; and storing the files corresponding to the modification operations in the remaining space of the workspace excluding the system disk to form a user image layer.

[0009] Optionally, the persistent storage method for user working environment based on a two-layer container according to the present invention further includes: responding to a request sent by the client to create a private container image, superimposing the user image layer in the remaining space on the system disk to form a private container image; and storing the user image layer in the private container image in the image private server.

[0010] Optionally, the persistent storage method for user working environment based on a two-layer container according to the present invention further includes: pre-establishing a shared storage space based on CephFS or JuiceFS.

[0011] Optionally, in the user working environment persistence method based on a two-layer container according to the present invention, the container management server is used for a K8s cluster, the K8s cluster includes multiple nodes and is adapted to deploy computing resources, each node is adapted to deploy multiple Pods, and the outer container of the two-layer container is adapted to be deployed in the Pods; wherein, starting the two-layer container includes: deploying the outer container and its Pod to a target node for operation through the scheduler of the K8s cluster, and allocating computing resources to the outer container; starting and running the initial state inner container through the outer container, and mounting a shared storage space, the outer container being adapted to inject the computing resources into the initial state inner container.

[0012] Optionally, according to the user working environment persistence method based on a two-layer container of the present invention, after the target state inner container is closed, the target state inner container is restarted; restarting the target state inner container includes: starting and running the initial state inner container through the outer container, and mounting the shared storage space; loading the user image layer from the remaining space through the initial state inner container, and running the target state inner container based on the user image layer.

[0013] Optionally, according to the user working environment persistence method based on a two-layer container of the present invention, running the initial state inner container includes: running the initial state inner container as a non-rool user.

[0014] Optionally, according to the user working environment persistence method based on a two-layer container of the present invention, the outer container and its Pod are deployed to the target node for operation through the scheduler of the K8s cluster, and computing resources are allocated to the outer container, including: obtaining computing resource demand information selected by the client; and deploying the outer container and its Pod to the target node for operation through the scheduler of the K8s cluster, based on the computing resource demand information and the computing resource usage status of each node, and allocating computing resources to the outer container.

[0015] Optionally, according to the user working environment persistence method based on a two-layer container of the present invention, in response to a client's modification request, a corresponding modification operation is performed in the inner container of the initial state to obtain a target state inner container, including: in response to the client's modification request, forwarding the modification request to the inner container of the initial state through the outer container, so that the inner container of the initial state performs a corresponding modification operation according to the modification request to obtain a target state inner container.

[0016] Optionally, according to the method for persistent storage of user working environment based on a two-layer container according to the present invention, the method further includes: monitoring the health status of the outer layer container, and restarting the two-layer container when a failure is detected in the outer layer container.

[0017] Optionally, in the user working environment persistence method based on a two-layer container according to the present invention, the computing resources include GPU resources, CPU resources, and memory resources.

[0018] According to one aspect of the present invention, a persistent storage system for a user's working environment is provided, comprising: a private image repository storing multiple public container images; a container management server communicatively connected to an image pull service module and a Pod management service module, and communicatively connected to the private image repository via the image pull service module, adapted to execute the method described above; and a client communicatively connected to the container management server, adapted to send a user working environment creation request to the container management server.

[0019] According to one aspect of the present invention, a computing device is provided, comprising: at least one processor; and a memory storing program instructions, wherein the program instructions are configured to be executed by the at least one processor, the program instructions including instructions for performing the user working environment persistence method based on a two-layer container as described above.

[0020] According to one aspect of the present invention, a computer program product is provided, comprising computer program instructions, wherein the computer program instructions, when executed by a processor, implement the method as described above.

[0021] According to one aspect of the present invention, a readable storage medium storing program instructions is provided, which, when read and executed by a computing device, causes the computing device to perform the user working environment persistence method based on a two-layer container as described above.

[0022] According to the technical solution of the present invention, a method for persistently saving a user working environment based on a two-layer container is provided. The method involves pre-pulling various public container images from a private image repository to a shared storage space to form a hot-loading area. When a user working environment creation request is received from a client, a corresponding workspace is allocated from the shared storage space. Based on the public container image identifier in the creation request, the target storage block corresponding to the target public container image is queried from the hot-loading area, and the target storage block is copied to the workspace as a system disk. A two-layer container can then be established and started based on the target public container image in the system disk. Subsequently, according to the client's modification request, corresponding modification operations can be performed on the inner container in the initial state to obtain the inner container in the target state. The user working environment can run based on the inner container in the target state, and the files corresponding to the modification operations can be stored in the remaining space in the workspace excluding the system disk, forming a user image layer. Based on this, on the one hand, pulling public container images by copying storage blocks in the shared storage space is fast, thereby improving the efficiency of pulling public container images; on the other hand, incremental snapshots and hierarchical incremental storage are performed when persistently saving the inner container state, eliminating the need to repeatedly store public container images, thereby improving the efficiency of persistently saving container states and the user working environment.

[0023] Furthermore, according to the technical solution of the present invention, the inner container can be dynamically started and stopped. When restarting the inner container in the target state, only the user image layer needs to be loaded layer by layer, which reduces the image pull time and enables fast container restart.

[0024] Furthermore, according to the technical solution of the present invention, when creating a private container image, it is only necessary to overlay and store the user image layer on the basis of the target public container image. Based on this, the efficiency of creating a private container image is improved by reusing the public container image.

[0025] Furthermore, according to the technical solution of the present invention, running the inner container in the initial state as a non-rool can ensure the security of the host machine.

[0026] The above description is merely an overview of the technical solution of the present invention. In order to better understand the technical means of the present invention and to implement it in accordance with the contents of the specification, and in order to make the above and other objects, features and advantages of the present invention more apparent and understandable, specific embodiments of the present invention are described below. Attached Figure Description

[0027] To achieve the foregoing and related objectives, certain illustrative aspects are described herein in conjunction with the following description and accompanying drawings. These aspects indicate various ways in which the principles disclosed herein may be practiced, and all aspects and their equivalents are intended to fall within the scope of the claimed subject matter. The foregoing and other objectives, features, and advantages of this disclosure will become more apparent from the following detailed description, taken in conjunction with the accompanying drawings. Throughout this disclosure, the same reference numerals generally refer to the same parts or elements.

[0028] Figure 1 A schematic diagram of a persistent storage system 100 for a user's working environment provided according to an embodiment of the present invention is shown; Figure 2 A schematic diagram of a computing device 200 provided according to an embodiment of the present invention is shown; Figure 3 A flowchart illustrating a method 300 for persistent storage of a user's working environment based on a two-layer container, according to an embodiment of the present invention, is shown. Figure 4 A schematic diagram of the structure of a double-layer container 400 according to some embodiments of the present invention is shown. Detailed Implementation

[0029] Exemplary embodiments of the present disclosure will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.

[0030] To address the issues of low efficiency in persistent storage of container states and container startup delays in existing Kubernetes clusters, this invention provides a method for persistent storage of the user's working environment based on a two-layer container architecture. First, a common container image is pulled by copying storage blocks within a shared storage space, resulting in fast copying and improved efficiency in pulling the common container image. Second, incremental snapshots and hierarchical incremental storage are performed when persistently storing the inner container state, eliminating the need to repeatedly store the common container image, thus improving the efficiency of persistent storage of both the container state and the user's working environment. Furthermore, restarting the inner container only requires loading the difference layer, improving container startup speed.

[0031] The persistent storage method for user working environments based on a two-layer container provided by embodiments of the present invention can be implemented in a persistent storage system for user working environments. The persistent storage system for user working environments of the present invention is described below.

[0032] Figure 1 A schematic diagram of a persistent storage system 100 for a user's working environment provided according to an embodiment of the present invention is shown.

[0033] like Figure 1 As shown, the user working environment persistent storage system 100 includes a container management server 120, an image private repository 130, and one or more clients 110. The container management server 120 can communicate with one or more clients 110 and the image private repository 130. The container management server 120 can provide user working environment creation and persistent storage services for each client 110. The image private repository 130 stores multiple public container images.

[0034] In this embodiment of the invention, the user working environment persistent storage system 100 further includes an image pull service module 121 (img-pull-service) and a pod management service module 122 (pod-mgt-service). The image pull service module 121 provides image pull and caching services to the container management server 120. Specifically, the image pull service module 121 can pull various public container images from the private image repository 130 to a shared storage space to form a hot-loading area. The pod management service module 122 is used to establish a two-layer container.

[0035] The container management server 120 communicates with the image pull service module 121 and the Pod management service module 122 respectively, so as to cooperate with the image pull service module 121 and the Pod management service module 122 to create the user's working environment and to persistently save the user's working environment.

[0036] In this embodiment of the invention, the container management server 120 can pre-establish a shared storage space based on CephFS or JuiceFS. Furthermore, the container management server 120 communicates with the private image server 130 via the image pull service module 121, and can pre-pull each public container image from the private image server 130 to the shared storage space to form a hot-loading area.

[0037] In this embodiment of the invention, the container management server 120 can receive a user working environment (business instance) creation request sent by the client 110. The creation request sent by the client 110 may include a public container image identifier to request the container management server 120 to create a user working environment based on the public container image corresponding to the public container image identifier. Subsequently, the container management server 120 can query the target storage block corresponding to the target public container image from the hot-loading area of ​​the public storage space based on the public container image identifier through the Pod management service module 122, and copy the target storage block (i.e., the target storage block storing the target public container image) to the working space as the system disk. Here, the remaining space in the working space other than the system disk can be used as the home directory ( / home) for the user. Next, the container management server 120 can establish a two-layer container based on the target public container image in the system disk through the Pod management service module 122, and then start the two-layer container.

[0038] When the container management server 120 receives a modification request from the client 110 for the initial state inner container, it can respond to the client 110's modification request and perform corresponding modification operations on the initial state inner container (changing the state of the inner container) to obtain the target state inner container. Based on the target state inner container, the user's working environment can be run to execute computing tasks. Furthermore, the container management server 120 stores the files corresponding to the above modification operations (i.e., the files used to form the target state inner container) in the remaining space (home directory) of the workspace excluding the system disk, forming a user image layer (i.e., a difference layer relative to the public container image). Here, modification operations may include, for example, installing new software or adjusting environment parameters.

[0039] Based on this, it can not only persistently save the inner container state and the user's working environment, but also perform incremental snapshots and hierarchical incremental storage of the inner container state and the user's working environment. This eliminates the need to repeatedly store the public container image, thereby greatly reducing the size of the image file and improving the efficiency of persistent storage of the container state.

[0040] In this embodiment of the invention, the container management server 120 is used for a Kubernetes (K8s) cluster. The K8s cluster includes multiple nodes and can deploy computing resources. Each node can deploy multiple Pods. Specifically, the multiple nodes in the K8s cluster may include one or more master nodes and multiple worker nodes, wherein each worker node can deploy multiple Pods.

[0041] Each Pod in a K8s cluster can deploy one or more two-layer containers; that is, the containers in the K8s cluster of this invention are two-layer containers.

[0042] Figure 4 A structural schematic diagram of a double-layered container 400 according to some embodiments of the present invention is shown. For example... Figure 4 As shown, the two-layer container 400 includes an outer container and an inner container deployed within the outer container. The outer container can be deployed in a Pod and is responsible for interacting with the K8s cluster to achieve resource scheduling in the K8s cluster and allocate computing resources to the outer container.

[0043] In some embodiments, the container management server 120 can be implemented as an API service in a K8s cluster (specifically, scc-k8s-v2), providing services to the outside world in a RESTful manner.

[0044] In some embodiments, computing resources may include GPU resources, CPU resources, and memory resources, but are not limited to these.

[0045] In some embodiments, the outer container in the two-layer container 400 can be implemented as Containerd. It should be noted that Containerd is a lightweight, high-performance container runtime that, as an implementation of Kubernetes' CRI (Container Runtime Interface), is responsible for managing the lifecycle of containers (creation, startup, shutdown, etc.), and its core functions include image pulling, storage management, and container execution.

[0046] The inner container in a two-layer container 400 can be implemented as Podman. It should be noted that Podman is a daemonless container engine that supports rootless operation.

[0047] In some embodiments, inner containers can utilize fuse-overlayfs to implement tiered storage functionality, thereby reducing the need for root operations while maintaining high performance. It should be noted that fuse-overlayfs is an OverlayFS implementation based on FUSE (userspace file system) used to provide OverlayFS-like tiered storage functionality in unprivileged containers (non-root users) or environments where the kernel does not support OverlayFS.

[0048] In this embodiment of the invention, the container management server 120 can be configured to execute a two-layer container-based persistent storage method 300 for user working environment, which will be described in detail below.

[0049] In some embodiments, the container management server 120 described above can be implemented as a computing device as described below, so that the user working environment persistence method 300 based on two-layer containers of the present invention can be executed in the computing device.

[0050] Figure 2 A schematic diagram of a computing device 200 according to an embodiment of the present invention is shown. Figure 2 As shown, in a basic configuration, computing device 200 includes at least one processing unit 202 and system memory 204. According to one aspect, depending on the configuration and type of the computing device, the processing unit 202 may be implemented as a processor. System memory 204 includes, but is not limited to, volatile memory (e.g., random access memory), non-volatile memory (e.g., read-only memory), flash memory, or any combination of such memories. According to one aspect, system memory 204 includes an operating system 205.

[0051] According to one aspect, operating system 205 is, for example, suitable for controlling the operation of computing device 200. Furthermore, examples are practiced in conjunction with graphics libraries, other operating systems, or any other applications, and are not limited to any particular application or system. Figure 2 The basic configuration is illustrated by the components within the dashed lines. According to one aspect, the computing device 200 has additional features or functions. For example, according to one aspect, the computing device 200 includes additional data storage devices (removable and / or non-removable), such as disks, optical discs, or magnetic tapes. This additional storage... Figure 2 The middle part is shown by removable storage device 209 and non-removable storage device 210.

[0052] As stated above, according to one aspect, program module 203 is stored in system memory 204. According to one aspect, program module 203 may include one or more applications. The present invention does not limit the type of application; for example, applications may include: email and contact applications, word processing applications, spreadsheet applications, database applications, slideshow applications, drawing or computer-aided applications, web browser applications, etc.

[0053] In an embodiment of the present invention, program module 203 includes multiple program instructions for executing the user working environment persistence method 300 based on a two-layer container of the present invention.

[0054] According to one aspect, examples can be practiced on circuits including discrete electronic components, packaged or integrated electronic chips containing logic gates, circuits utilizing microprocessors, or on a single chip containing electronic components or a microprocessor. For example, it can be practiced via wherein... Figure 2 Each or many of the components shown can be implemented as an example by integrating a System-on-a-Chip (SOC) on a single integrated circuit. According to one aspect, such an SOC device may include one or more processing units, graphics units, communication units, system virtualization units, and various application functions, all integrated (or “burned in”) as a single integrated circuit onto a chip substrate. When operating via the SOC, the functions described herein can be operated via dedicated logic integrated on a single integrated circuit (chip) with other components of the computing device 200. Embodiments of the invention can also be implemented using other techniques capable of performing logical operations (e.g., AND, OR, and NOT), including but not limited to mechanical, optical, fluid, and quantum technologies. Additionally, embodiments of the invention can be implemented within a general-purpose computer or in any other circuit or system.

[0055] According to one aspect, computing device 200 may also have one or more input devices 212, such as a keyboard, mouse, pen, voice input device, touch input device, etc. It may also include output devices 214, such as a display, speaker, printer, etc. The foregoing devices are examples and other devices may also be used. Computing device 200 may include one or more communication connections 216 that allow communication with other computing devices 218. Examples of suitable communication connections 216 include, but are not limited to: RF transmitter, receiver and / or transceiver circuitry; Universal Serial Bus (USB), parallel and / or serial ports.

[0056] As used herein, the term computer-readable medium includes computer storage medium. Computer storage medium can include volatile and non-volatile, removable and non-removable media implemented using any method or technology for storing information (e.g., computer-readable instructions, data structures, or program modules). System memory 204, removable storage device 209, and non-removable storage device 210 are examples of computer storage media (i.e., memory storage). Computer storage media can include random access memory (RAM), read-only memory (ROM), electrically erasable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital universal disc (DVD) or other optical storage, magnetic tape, magnetic tape, disk storage or other magnetic storage devices, or any other article of manufacture that can be used to store information and is accessible by computing device 200. According to one aspect, any such computer storage medium can be part of computing device 200. Computer storage media does not include carrier waves or other transmitted data signals.

[0057] According to one aspect, a communication medium is implemented by computer-readable instructions, data structures, program modules, or other data in a modulated data signal (e.g., a carrier wave or other transmission mechanism), and includes any information transmission medium. According to one aspect, the term "modulated data signal" describes a signal having one or more sets of characteristics or altered in a manner that encodes information in the signal. By way of example and not limitation, a communication medium includes wired media such as wired networks or direct wired connections, and wireless media such as acoustic, radio frequency (RF), infrared, and other wireless media.

[0058] In an embodiment of the present invention, a computing device 200 is configured to execute a two-layer container-based persistent storage method 300 for user working environment. The computing device 200 includes one or more processors and one or more readable storage media storing program instructions. When the program instructions are configured to be executed by one or more processors, the computing device is able to execute the two-layer container-based persistent storage method 300 of the present invention to improve the efficiency of persistent storage of container states and user working environments.

[0059] The following is a detailed description of the persistent storage method 300 for user working environment based on a two-layer container in an embodiment of the present invention.

[0060] Figure 3 A flowchart illustrating a method 300 for persistently storing a user's working environment based on a two-layer container, according to an embodiment of the present invention, is shown. The method 300 for persistently storing a user's working environment based on a two-layer container can be executed in the aforementioned container management server 120 (computing device 200). Figure 3 As shown, the persistent storage method 300 for user working environment based on a two-layer container includes the following steps 310-360.

[0061] Step 310: The container management server 120 pre-pulls each public container image (public base image) from the image private repository 130 to the shared storage space to form a hot-loading area in the shared storage space. It should be understood that the hot-loading area is the storage area in the shared storage space where each public container image is stored.

[0062] In this embodiment of the invention, the container management server 120 can send a preload request to the image pull service module 121 so that the image pull service module 121 can preload each public container image in the private image server 130 to the shared storage space so as to form a hot loading area in the shared storage space.

[0063] It should be noted that, in this embodiment of the invention, a shared storage space can be pre-established based on CephFS (a distributed file system) or JuiceFS (a high-performance distributed file system). This shared storage space is independent of the dual-layer container in this invention, and the data written to it will not be lost when the dual-layer container is closed.

[0064] In some embodiments, a public container image may pre-install an operating system, computing resource drivers, and one or more software programs from Ubuntu, PyTorch, SSH, Jupyter, LLM (such as DeepSeek-7B).

[0065] Step 320: Container management server 120 receives a user working environment (business instance) creation request sent by client 110. The creation request sent by client 110 may include a public container image identifier to request the creation of the user working environment based on the public container image corresponding to the public container image identifier.

[0066] Step 330: The container management server 120 allocates the workspace corresponding to the user's working environment from the shared storage space, queries the target storage block corresponding to the target public container image from the hot-loading area based on the public container image identifier, and copies the target storage block (i.e., the target storage block that stores the target public container image) to the workspace as the system disk.

[0067] In this embodiment of the invention, the container management server 120 can send a query request to the Pod management service module 122 to query the target storage block corresponding to the target public container image from the hot-loading area of ​​the public storage space based on the public container image identifier, and copy the target storage block (i.e., the target storage block containing the target public container image) to the workspace as the system disk. Here, the remaining space in the workspace other than the system disk can be used as the home directory ( / home) for users.

[0068] It should be noted that in existing technologies, container images are stored in private image repositories (such as Harbor) for sharing. If container images are pulled directly from the private image repository every time, it will be subject to network resource constraints, making the private image repository a single point of bottleneck.

[0069] According to steps 310-330 in the embodiments of the present invention, the pulling of a public container image can be transformed into copying between storage blocks in the shared storage space. Since the shared storage space uses CephFS or JuiceFS object storage, the copying speed is very fast. Thus, the present invention pulls a public container image by copying storage blocks in the shared storage space, which is very fast and thus improves the efficiency of pulling a public container image.

[0070] In some embodiments, the workspace size corresponding to the user's work environment can be, for example, 300G.

[0071] Step 340: Container management server 120 creates a two-layer container based on the target public container image in the system disk and starts the two-layer container.

[0072] In this embodiment of the invention, the container management server 120 can establish a two-layer container based on the target public container image in the system disk through the Pod management service module 122.

[0073] In this embodiment of the invention, the two-layer container built based on the target public container image includes an outer container (Containerd) and an initial-state inner container (Podman) deployed within the outer container. Here, starting the two-layer container is equivalent to initializing the user's working environment.

[0074] Step 350: When the container management server 120 receives a modification request from the client 110 (user) for the inner container in its initial state, it can respond to the client 110 (user) by performing corresponding modification operations on the inner container in its initial state (changing the state of the inner container) to obtain the inner container in its target state. This allows the user's working environment to run and perform computing tasks based on the inner container in its target state. Here, the modification operations may include, for example, installing new software or adjusting environment parameters.

[0075] It can be understood that the target state inner container obtained by modifying the inner container in the initial state is equivalent to creating a user working environment (business instance). The user working environment can be used to execute computing tasks, providing an isolated execution environment for the execution of computing tasks.

[0076] Step 360: The container management server 120 stores the files corresponding to the above modification operations (i.e., the relevant files used to form the inner container of the target state) in the remaining space (home directory) of the workspace other than the system disk, forming the user image layer (i.e., the difference layer relative to the public container image).

[0077] Based on this, it can not only persistently save the inner container state and the user's working environment (even if the inner container is closed, the new software installed by the user will be retained and will not be lost), but also realize incremental snapshots and hierarchical incremental storage of the inner container state and the user's working environment. This eliminates the need to repeatedly store the public container image, thereby greatly reducing the size of the image file and improving the efficiency of persistent storage of the container state.

[0078] Furthermore, the persistent storage method 300 for user working environments based on a two-layer container, as described in this embodiment of the invention, can quickly create a user's private container image. Specifically, the container management server 120 can also receive a request from the client 110 to create a private container image, and then, in response to the request from the client 110, can overlay a user image layer from the remaining space (home directory) onto the system disk (containing the target public container image) to form a private container image. Subsequently, the user image layer in the private container image is stored in the image private server 130 so that the user's working environment can be shared with other users.

[0079] It should be noted that, according to the embodiments of the present invention, when creating a private container image, since the target public container image is still stored in the private image repository 130, it is only necessary to add a storage layer for the user image on top of it. Based on this, the present invention improves the efficiency of creating private container images by reusing public container images.

[0080] In this embodiment of the invention, the container management server 120 is used for a Kubernetes (K8s) cluster. The K8s cluster includes multiple nodes and can deploy computing resources (e.g., GPU resources, CPU resources, and memory resources). Each node can deploy multiple Pods. Specifically, the multiple nodes in the K8s cluster may include one or more master nodes and multiple worker nodes, wherein each worker node can deploy multiple Pods.

[0081] In this embodiment of the invention, the outer container of the two-layer container can be deployed in a Pod. The outer container deployed in the Pod is responsible for interacting with the Kubernetes cluster to achieve resource scheduling within the Kubernetes cluster and allocate computing resources to the outer container.

[0082] In some embodiments, the specific method for starting the two-layer container in step 340 is as follows: First, the container management server 120 can deploy the outer container and its associated Pod to the target node for execution (the outer container runs resident) through the Kubernetes cluster scheduler (kube-scheduler), and allocate computing resources (such as GPU resources, CPU resources, and memory resources) to the outer container. In some embodiments, the container management server 120 can obtain the computing resource requirements information selected by the client 110 (such as GPU card information, memory resource information, etc.), and then, through the Kubernetes cluster scheduler, deploy (schedule) the outer container and its associated Pod to the target node for execution based on the computing resource requirements information and the computing resource usage status of each node, and allocate computing resources to the outer container. In some embodiments, the outer container and its associated Pod can be deployed to the target node via deployment, so that the deployed node can be quickly switched in the event of a failure.

[0083] Furthermore, the container management server 120 can start the initial state inner container through the outer container (based on various startup parameters) and run the initial state inner container, as well as mount the shared storage space through the outer container. The outer container can inject computing resources into the initial state inner container so that the inner container can execute computing tasks based on the computing resources.

[0084] In some embodiments, the inner container in its initial state can be run with a non-rool user. That is, the inner container in this invention can run in a non-privileged mode. By running the inner container with a non-rool user, the user cannot modify the system disk and can only perform modification operations (such as installing new software) in the remaining space (home directory). Even if the container escapes, the attacker cannot obtain host machine privileges, thereby ensuring the security of the host machine.

[0085] In some embodiments, in step 350, according to the two-layer container structure, the container management server 120 may respond to the modification request of the client 110 by forwarding the modification request of the client 110 to the initial state inner container through the outer container, so that the initial state inner container can perform the corresponding modification operation according to the modification request to obtain the target state inner container.

[0086] According to the dual-layer container of this embodiment, the outer container runs continuously while the inner container can be dynamically started and stopped. When it is necessary to restart the inner container in the target state, only the user image layer (difference layer) needs to be loaded layer by layer, thereby reducing the image pull time and enabling a fast container restart.

[0087] In some embodiments, after the target state inner container is shut down due to various circumstances, the container management server 120 can restart the target state inner container (via the Pod management service module 122). Specifically, the target state inner container can be restarted as follows: First, the initial state inner container is started and run through the outer container, and the shared storage space is mounted. Then, the user image layer can be loaded from the remaining space (home directory) of the aforementioned workspace through the initial state inner container, and the target state inner container can then be run based on the user image layer. In this way, when restarting the target state inner container, only the difference layer (typically less than 100MB) needs to be loaded layer by layer, reducing the startup time from minutes to seconds, thus achieving dynamic and fast startup of the target state inner container (user working environment).

[0088] In some embodiments, the container management server 120 can also monitor the health status of the outer container and restart the dual-layer container when a failure is detected in the outer container (see the specific method of starting the dual-layer container in the above embodiments).

[0089] According to the user working environment persistence method 300 based on a two-layer container of the present invention, each public container image in the private image repository is pre-pulled to a shared storage space to form a hot-loading area. When a user working environment creation request is received from a client, a corresponding working space is allocated from the shared storage space. Based on the public container image identifier in the creation request, the target storage block corresponding to the target public container image is queried from the hot-loading area, and the target storage block is copied to the working space as the system disk. Then, a two-layer container can be established and started based on the target public container image in the system disk. Afterwards, according to the client's modification request, corresponding modification operations can be performed on the inner container in the initial state to obtain the inner container in the target state. The user working environment can be run based on the inner container in the target state, and the files corresponding to the modification operations can be stored in the remaining space in the working space other than the system disk to form a user image layer. Based on this, on the one hand, pulling the public container image by copying the storage block in the shared storage space is fast, thereby improving the efficiency of pulling the public container image; on the other hand, incremental snapshots and hierarchical incremental storage are performed when persistently saving the inner container state, eliminating the need to repeatedly store the public container image, thereby improving the efficiency of persistent saving of the container state and the user working environment.

[0090] Secondly, according to the technical solution of the present invention, the inner container can be dynamically started and stopped. When restarting the inner container in the target state, only the user image layer needs to be loaded layer by layer, which reduces the image pull time and enables the container to be restarted quickly.

[0091] Furthermore, according to the technical solution of the present invention, when creating a private container image, it is only necessary to overlay and store the user image layer on the basis of the target public container image. Based on this, the efficiency of creating a private container image is improved by reusing the public container image.

[0092] Furthermore, according to the technical solution of the present invention, running the inner container in the initial state as a non-rool can ensure the security of the host machine.

[0093] The various techniques described herein can be implemented in combination with hardware or software, or a combination thereof. Thus, the methods and apparatus of the present invention, or certain aspects or portions thereof, can take the form of program code (i.e., instructions) embedded in a tangible medium, such as a removable hard disk, USB flash drive, floppy disk, CD-ROM, or any other machine-readable storage medium, wherein when the program is loaded into and executed by a machine such as a computer, the machine becomes an apparatus for practicing the present invention.

[0094] When the program code is executed on a programmable computer, the mobile terminal generally includes a processor, a processor-readable storage medium (including volatile and non-volatile memory and / or storage elements), at least one input device, and at least one output device. The memory is configured to store program code; the processor is configured to execute the user working environment persistence method based on a two-layer container according to instructions in the program code stored in the memory.

[0095] By way of example, and not limitation, readable media include readable storage media and communication media. Readable storage media stores information such as computer-readable instructions, data structures, program modules, or other data. Communication media generally embodies computer-readable instructions, data structures, program modules, or other data in the form of modulated data signals such as carrier waves or other transmission mechanisms, and includes any information delivery medium. Any combination of the above is also included within the scope of readable media.

[0096] In the specification provided herein, the algorithms and displays are not inherently related to any particular computer, virtual system, or other device. Various general-purpose systems can also be used with the examples of this invention. The required structure for constructing such systems is apparent from the above description. Furthermore, this invention is not directed to any particular programming language. It should be understood that the contents of the invention described herein can be implemented using various programming languages, and the above description of specific languages ​​is for the purpose of disclosing the best mode of implementation of the invention.

[0097] Numerous specific details are set forth in the specification provided herein. However, it will be understood that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures, and techniques have not been shown in detail so as not to obscure the understanding of this specification.

[0098] Similarly, it should be understood that, in order to streamline this disclosure and aid in understanding one or more of the various aspects of the invention, in the above description of exemplary embodiments of the invention, various features of the invention are sometimes grouped together in a single embodiment, figure, or description thereof.

[0099] Those skilled in the art will understand that modules, units, or components of the devices disclosed in the examples herein can be arranged in the devices described in this embodiment, or alternatively, can be located in one or more devices different from the devices in this example. The modules in the foregoing examples can be combined into a single module or, in addition, can be divided into multiple sub-modules.

[0100] Unless otherwise specified, the use of ordinal numbers such as “first,” “second,” “third,” etc., to describe ordinary objects merely indicates different instances of similar objects and is not intended to imply that the objects being described must have a given order in time, space, ordering, or any other manner.

Claims

1. A method for persistently storing a user's working environment based on a two-layer container, executed on a container management server, comprising: Pull the various public container images from the private image repository to the shared storage space to form a hot-loading area; Receive a user working environment creation request sent by the client, wherein the creation request contains a public container image identifier; The user's workspace is partitioned from the shared storage space. The target storage block corresponding to the target public container image is queried from the hot-loading area based on the public container image identifier. The target storage block is then copied to the workspace as the system disk. A two-layer container is established based on the target public container image in the system disk, and the two-layer container is started. The two-layer container includes an outer container and an initial state inner container deployed in the outer container. In response to a client's modification request, the inner container in the initial state is modified accordingly to obtain the inner container in the target state, so that the user's working environment can be run based on the inner container in the target state to perform computing tasks. The modification operations include installing new software and adjusting environmental parameters. as well as The files corresponding to the modification operations are stored in the remaining space of the workspace excluding the system disk, forming a user image layer.

2. The method as described in claim 1, wherein, Also includes: In response to a client's request to create a private container image, a private container image is formed by overlaying a user image layer from the remaining space onto the system disk. The user image layer in the private container image is stored in the image private repository.

3. The method as described in claim 1 or 2, wherein, Also includes: Pre-establish shared storage space based on CephFS or JuiceFS.

4. The method according to any one of claims 1-3, wherein, The container management server is used for a K8s cluster, which includes multiple nodes and is suitable for deploying computing resources. Each node is suitable for deploying multiple Pods, and the outer container of the two-layer container is suitable for deployment in the Pod. The activation of the two-layer container includes: The scheduler of the K8s cluster deploys the outer container and its associated Pod to the target node for execution, and allocates computing resources to the outer container. The outer container is used to start and run the initial state inner container and mount the shared storage space. The outer container is adapted to inject the computing resources into the initial state inner container.

5. The method of claim 4, wherein, Also includes: After the inner container of the target state is closed, the inner container of the target state is restarted. Restarting the inner container of the target state includes: The outer container is used to start and run the inner container in its initial state, and to mount the shared storage space. The user image layer is loaded from the remaining space through the initial state inner container, and the target state inner container is run based on the user image layer.

6. The method as described in claim 4 or 5, wherein, Running the inner container in the initial state includes: Run the inner container in the initial state as a non-rool.

7. A persistent storage system for a user's working environment, comprising: A private container repository that stores multiple public container images; A container management server, which is communicatively connected to an image pull service module and a Pod management service module, and is communicatively connected to the image private server via the image pull service module, is adapted to perform the method as described in any one of claims 1-6; The client communicates with the container management server and is adapted to send a user working environment creation request to the container management server.

8. A computing device, comprising: At least one processor; and A memory storing program instructions, wherein the program instructions are configured to be processed by the at least one processor, the program instructions including instructions for processing the method as described in any one of claims 1-6.

9. A computer program product comprising computer program instructions, wherein, When the computer program instructions are executed by the processor, they implement the method as described in any one of claims 1-6.

10. A readable storage medium storing program instructions that, when read and processed by a computing device, cause the computing device to perform the method as described in any one of claims 1-6.

Citation Information

Cited By

  • Cloud service deployment method and device, electronic equipment, storage medium and program

    CN121462580A