Realization method and system of renewable container, medium and equipment
By copying and saving copies of the container layer when the container is destroyed, and copying or transmitting these copies in a new container, the problem of not being able to maintain and migrate stateful application states in container technology is solved, and the regeneration and state continuity of containers is achieved .
Patent Information
- Application Number
- CN202411673485.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-21
- Publication Date
- 2025-02-18
AI Technical Summary
The existing container technology lacks support for stateful applications and cannot maintain and migrate the state of applications between containers, causing users to lose modified and configured data when migrating or restarting the container.
Regeneration and migration of container state is achieved by copying and saving copies of container layers when containers are destroyed and copying or transferring these copies in a new container.
The renewable capability of the container is realized, allowing users to completely destroy the container when they are not using the container, free up resources, and restore to the previous state when needed, maintaining the continuity of the container state.
Smart Images

Figure CN119473509A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of container-based cloud computing, and in particular to a method, system, medium and device for implementing a renewable container. Background Art
[0002] The statements in this section merely provide background information related to the present invention and do not necessarily constitute prior art.
[0003] Cloud computing is an Internet-based computing method that allows shared hardware and software resources and information to be provided to various computer terminals and other devices on demand. Early cloud computing was based on virtual machine technology, which used virtualization technology to divide CPU, memory and storage resources from physical hosts to form virtual hosts, and installed independent operating systems and application software to run independently. Virtual machine technology improves the utilization rate of physical hosts and improves the security of different applications through isolation between virtual machines.
[0004] In order to solve the problems of low utilization of host resources and slow loading speed of virtual machine technology, container technology has been further developed. Container is a lightweight, portable, self-contained software packaging technology that allows applications to run in the same way anywhere. Similar to the functions of virtual machine technology, containers use namespace and cgroup (control group) technology to provide encapsulation and isolation capabilities for applications. The container consists of the application itself and its dependencies, such as libraries or other software and environment variables required by the application. The container shares the kernel of the host operating system, runs in the user space of the host operating system, and is isolated from other processes to obtain a relatively independent operating environment.
[0005] Compared with virtual machines, which need to build a complete operating system to run applications, containers share the operating system kernel and only require the application itself and its dependencies, significantly reducing storage and running space. Virtual machines need to allocate CPU, memory and other resources in advance. Even if the utilization rate is low during operation, it is difficult to schedule them to other virtual machines. The host operating system uniformly schedules the CPU, memory and other resources of the container, significantly enhancing resource utilization. This makes the number of containers carried by the host with the same hardware resources far exceed that of virtual machines. In addition, the essence of container operation is process loading, and the loading or restarting time is in the order of seconds, while the virtual machine needs to complete the startup of the operating system, which takes minutes. Therefore, in cloud computing, containers are more efficient than virtual machine technology and have become the main implementation technology of cloud computing services.
[0006] The design goal of containers is to be stateless, so that applications can be restarted and migrated, and multiple container copies can be established based on the same image to provide concurrent services. For this reason, the running data of the container is stored in an external database, mapped to external persistent storage, etc., and the restarted container or different copies can respond to processing requests in the same way. In this way, when the user does not need the application, the container can be stopped to release the running and storage resources. When it is needed again, the container can be quickly loaded to continue to provide services.
[0007] However, for some special container applications, such as interactive container services for individual users, users often modify the internal operation of the container according to their changing needs during use, forming the state of the container runtime, such as installing new software packages, modifying environment variables, etc. It is difficult to store all of these states in persistent storage mapped to the outside. Users often use such interactive containers intermittently for a long time, so the container can only be kept when the user is not using it. Although it can be in the PAUSED or STOPED state, it continues to occupy the host memory and storage space respectively.
[0008] Moreover, when the container operation requires more computing, memory, or network bandwidth resources, if the server on which it is running does not have enough free resources, it is necessary to re-run the container based on its image on a server with sufficient resources; or when the server needs to be maintained and upgraded, it is also necessary to re-run the container based on its image on other servers. However, the container running based on its image does not have the modification results of the container generated by the previous user operation, that is, the state mentioned above, such as installing new software packages, modifying environment variables, etc. In other words, the current container technology does not have the ability to migrate states, and once migrated between hosts, it will be in the original state. Summary of the invention
[0009] In order to solve the above problems, the present invention provides a method, system, medium and device for realizing a renewable container, which realizes the renewable capability of a stateful container, and can not only maintain the continuity of the container state, but also enable the renewable container to be completely destroyed when the user is not using the container, and no longer occupy the operation and storage resources of the host.
[0010] In order to achieve the above object, the present invention adopts the following technical solution: A first aspect of the present invention provides a method for implementing a regenerable container, comprising: In response to the container destroy command, stopping the container; The container layer is copied and saved as a copy, so that the content of the container layer copy covers the content of the container layer of the new container; or the container layer is packaged and sent, so that the container layer data is copied to the container layer of the new container; Destroy the container.
[0011] Furthermore, the copy records all modifications made by the user to the container when the container is finished running.
[0012] Furthermore, after a new container is created on the destination host, the received container layer data is copied to the container layer of the new container, and the destination host then starts the new container, thereby achieving the regeneration of the container on the source host on the destination host.
[0013] Furthermore, a new container is created, and the container layer content of the new container is overwritten with the container layer copy content, and the new container is started to run, thereby achieving container data regeneration.
[0014] Furthermore, when the replica is saved, container-layer replica storage management based on user and application images is adopted.
[0015] A second aspect of the present invention provides a system for implementing a regenerable container, comprising: A container stopping module, configured to: stop the container in response to a container destroy command; The regeneration module is configured to: copy the container layer and save it as a copy, so that the content of the container layer copy covers the content of the container layer of the new container; or package and send the container layer, so that the container layer data is copied to the container layer of the new container; The container destroying module is configured to: destroy the container.
[0016] A third aspect of the present invention provides a computer-readable storage medium having a computer program stored thereon. The program is executed by a processor, and when the program is executed by the processor, the steps in the method for realizing a renewable container as described above are implemented.
[0017] A fourth aspect of the present invention provides a computer device, comprising a memory, a processor, and a computer program stored in the memory and running on the processor, wherein the processor implements the steps in the method for implementing a renewable container as described above when executing the program.
[0018] Compared with the prior art, the present invention has the following beneficial effects: The present invention provides a method for implementing a renewable container, which adds state preservation and recovery functions to the original stateless container technology, realizes the renewable capability of the stateful container, and satisfies the requirement of maintaining the continuity of the container state when individual users use the container intermittently.
[0019] The present invention provides a method for implementing a renewable container. The renewable container implemented by the method enables the container to be completely destroyed when the user does not use the container, and no longer occupies the operation and storage resources of the host.
[0020] The present invention provides a method for implementing a reproducible container, which stores only the container layer for user status storage and does not store the read-only layer of the image, thereby reducing the storage data and improving the system storage efficiency.
[0021] The present invention provides a method for implementing a regenerative container, which adds a function of inheriting the original state when migrating between servers to the original stateless container technology, realizes the host-to-host migration function of the stateful container, satisfies the requirement of maintaining the continuity of the container state when the container is scheduled for migration between servers, enables the container to be regenerated in the original state of the target host, and enables the user's work to maintain continuity.
[0022] The present invention provides a method for implementing a reproducible container, which implements the migration capability including the runtime state of the container, so that the user can reproduce the software installation, configuration adjustment, etc. of the container before migration on a new server. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] The accompanying drawings, which constitute a part of the specification of the present invention, are used to provide a further understanding of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention, but do not constitute limitations of the present invention.
[0024] Figure 1 It is a flowchart of local regeneration of a method for implementing a regenerable container according to the first embodiment of the present invention; Figure 2 is a flow chart of migration of a method for implementing a regenerable container according to the first embodiment of the present invention; Figure 3 It is a mirror structure diagram of an application of the first embodiment of the present invention; Figure 4 is a state diagram of each layer of a container according to the first embodiment of the present invention; Figure 5 It is a schematic diagram of the Copy-on-Write technology of the first embodiment of the present invention. DETAILED DESCRIPTION
[0025] The present invention will be further described below in conjunction with the accompanying drawings and embodiments.
[0026] It should be noted that the following detailed descriptions are exemplary and are intended to provide further explanation of the present invention. Unless otherwise specified, all technical and scientific terms used herein have the same meanings as those commonly understood by those skilled in the art to which the present invention belongs.
[0027] In the absence of conflict, the embodiments of the present invention and the features in the embodiments may be combined with each other. The present invention is further described below with reference to the accompanying drawings and embodiments.
[0028] Terminology explanation: cgroup (control group) is a mechanism that can limit, record, and isolate the physical resources used by process groups.
[0029] Python: An object-oriented interpreted computer programming language.
[0030] Linux: Unix-like operating system.
[0031] Embodiment 1 The purpose of this first embodiment is to provide a method for implementing a regenerable container.
[0032] In order to facilitate environmental reproduction, more and more scientific research projects now publish their systems in the form of container images, including operating environments, codes and programs, data sets, etc. For example, the single-cell RNA (ribonucleic acid) sequencing research project released by the Sanger Institute was published as a container image on the image service website (https: / / quay.io). Other researchers can use the image download command (docker pull quay.io / cellgeni / scrna-seq-course:latest) to download the image, run it as a container, and continue research on it. During the research process, users often customize and install more operating systems, development tool software packages, modify published programs, etc. according to their needs. Once the container is closed and reloaded from the image, all these user-customized operating and development environments will be lost.
[0033] In scientific research, debugging work is often carried out continuously in the container, and software packages are constantly installed and updated, as well as configuration changes. For example, after a container is run for a user based on the official python image on a server, the user installs the editing software (vim) and other Linux operating system software packages in the container according to work needs, changes the python package download source to the domestic source, and then installs numpy (open source numerical calculation extension package), matplotlib (two-dimensional drawing library), opencv-python (image processing and computer vision library), opencv-python-headless (image processing and computer vision library without graphical interface version) and other python packages in the research process. When the container needs to be adjusted to run on other servers, it is necessary to re-run a new container from the official python image on the target server. Although the python programs and documents written by the user can be stored on external persistent storage through storage mapping, this new container does not have the vim installed by the user, the adjusted domestic source configuration, and the subsequently installed python packages, which makes the programs and operations in the original container unable to run. In this way, unless the original container and its dependent images are saved as a new image through the image creation command (docker commit) and transmitted to the target server, the advantages of lightweight and easy migration of the container will be lost.
[0034] For this purpose, we take the Docker (mainstream container engine) system as an example to analyze the operating characteristics of the container. The container is the runtime of the image, and the image is a read-only template for the container runtime. An application image consists of a series of layers in order, which store the files of the application in the order of construction, such as Figure 3 .
[0035] When starting a container based on an application image, a new readable and writable layer is created as the highest layer. It is mounted together with the layers of the container in order based on the Union File System (UnionFS) technology to form a unified file system. The layers of the container are read-only. Figure 4 The file system uses Copy-on-Write technology to access the file system. All changes to the container (adding, deleting, and modifying files) will only occur in the container layer. If you modify files in each image layer, the file system will first copy the file to the container layer and then modify it. Figure 5 ; If you delete files in each image layer, the file deletion mark will be recorded in the container layer; all new files added are written to the container layer. Therefore, the state of the container runtime, including file modifications, software installation, and other file changes to the image layer, are all saved in the container layer.
[0036] During the life cycle of a container, the container layer is created in the file system when the container is created. The container layer always exists when the container is running, paused, and stopped. Only when the container is destroyed, its container layer is deleted synchronously.
[0037] The present embodiment provides a method for implementing a regenerable container, the purpose of which is to save the running status data when the container exits based on the current container technology, so that when the container needs to be rebuilt, the last running status data can be loaded, and the new container can inherit the status of the previous container, thereby realizing the regeneration of the container. And based on the current container technology, when a container needs to be adjusted to another server, the original container is first stopped, and a new container is created on the target server, and the running status data of the original container at the container layer is transferred to the container layer of the new container on the target server. When the new container is started, the running status data of the original container can be loaded, and the new container can inherit the status of the original container, thereby realizing the migration of the container-containing status between servers.
[0038] This embodiment provides a method for implementing a regenerable container, such as Figure 1 and Figure 2 As shown, it includes: stopping the container in response to a container destruction command; copying the container layer and saving it as a copy so that the container layer copy content covers the container layer content of the new container; or, packaging the container layer and sending it to the target server so that the target server copies the received container layer data to the container layer of the new container; destroying the container.
[0039] For containers for individual users, based on the existing container operation and exit mechanism, we increase the process of copying and saving a copy of the container layer before the container is destroyed and restoring the container with the saved copy when the container is created. We also increase the process of transferring the data of the container layer to the container layer of the newly created container on the target server, thereby achieving local and remote regeneration (migration) of the container, and solving the problem of traditional container technology's lack of support for stateful applications.
[0040] like Figure 1 As shown, a copy of the user's container layer is added to record all the changes made by the user to the container when the container ends. The specific solution is to stop the container when a destruction command is received, first copy its container layer, and save it as a copy according to the user's identity, so as to retain all the state changes made by the user in the container, and then continue to execute the operation of destroying the container to release all resources occupied by the container.
[0041] When the user needs to use the container of the application again, in response to the container regeneration command, after creating a container based on the application image, the stored container layer copy content is added to overwrite the newly created container layer content, thereby regenerating the last user container data, and then starting the container to provide the user with the same container status as when the container was last exited.
[0042] This further enables the migration of containers including states between hosts. Figure 2 As shown, first stop the container on the source host (server A); create a new container based on the image corresponding to the container on the target server (server B); then package the container layer content and send it to the destination host; then the destination host copies the received container layer data to the container layer of the new container, and then starts the new container on the target server, so as to realize the regeneration of the container on the source host on the destination host and completely reproduce the original container; then destroy the container on the original server that is in a stopped state.
[0043] In order to support the implementation of stateful container regeneration, container layer replica storage management based on user and application images is implemented on the host. The storage of the container layer is named according to "user ID (address) + image ID" and can be compressed to reduce storage space.
[0044] The method of this embodiment is described by taking a user who conducts deep learning and image recognition research based on the tensorflow (deep learning framework) image released by Nvidia as an example. It should be noted that the container layer storage directory is generated at runtime and is different for each run.
[0045] The operating system (Ubuntu Server 22.04) is run on a host with an Nvidia GPU (Graphics Processing Unit) accelerator card. Docker and Nvidia containers have been installed on the host. The tensorflow image released by Nvidia is downloaded using the image download command (docker pull nvcr.io / nvidia / tensorflow:22.09-tf2-py3), where nvcr.io / nvidia / tensorflow represents the image name and 22.09-tf2-py3 represents the tag. The following is referred to as the tensorflow image (full name, nvcr.io / nvidia / tensorflow:22.09-tf2-py3). User-written programs and image data are stored in the local directory ( / home / dock / data) and mapped to the container as persistent storage during runtime.
[0046] (1) The first startup is to start a container for the user based on the tensorflow image (nvcr.io / nvidia / tensorflow:22.09-tf2-py3) and use the command to create and start the container (docker run). Specifically, docker run -it --name mycontainer --gpus all -v / home / dock / data: / workspace / mynvcr.io / nvidia / tensorflow:22.09-tf2-py3, that is, use the docker run command to construct a container for a user based on the tensorflow image with the tag 22.09-tf2-py3 released by NVIDIA. Among them, mycontainer is the name of the container; -it indicates that the container is used in an interactive terminal; --name mycontainer indicates that the container is named mycontainer; --gpus all indicates that the user is allowed to use all GPUs; -v / home / dock / data: / workspace / my indicates that the local directory ( / home / dock / data) is mapped to the directory ( / workspace / my) of the file system in the container to achieve persistent storage of user code and data.
[0047] (2) After the container is running, the image processing and computer vision library Python package (opencv-python) is not installed in the tensorflow image (nvcr.io / nvidia / tensorflow:22.09-tf2-py3). Therefore, after entering the container, it is found that the image processing and computer vision library (opencv) of Python is missing. Therefore, the python package management tool (pip3) is used to install the opencv-python package in the container. Specifically: pip install opencv-python, that is, use the pip install (third-party library installation) command to install the opencv-python package for Python.
[0048] (3) Add the corresponding support package (libgl1-mesa-glx) under the Linux operating system. Specifically, use the following commands to install: apt update; apt install libgl1-mesa-glx –y. Among them, apt update means that the container operating system updates the list of available software packages; apt install libgl1-mesa-glx –y means that the container operating system installs the support library.
[0049] The files modified and added by these operations are not in the external persistent storage mapped when the container is created, but are stored in the directories in the container ( / lib and / usr / bin / python3.8). Since this is in the container, these directories are stored in the read-only image layer and cannot be modified. Instead, the container's Copy-on-Write mechanism is used to save all modified and newly added files in the container layer.
[0050] (4) By getting the metadata command of the container (docker inspect mycontainer), you can get the directory where the container layer is stored on the host ( / var / lib / docker / overlay2 / a3ff060894567c16ac66c2c20aaa80d2d0edcebc4b7deee3a64b53874822a2ea / diff). The directory here is created by Docker when creating the container. Each creation will use a different directory name. Looking at the directory, you can see that the files modified and added to the image layer are saved in the corresponding directories, with a total storage capacity of 424MB.
[0051] (5) The container can now use the opencv-python package: Enter the python entry command (python3) to enter the python interactive running environment, enter the cv2 loading command (import cv2) statement, if the system does not report an error, the user can continue programming and debugging. Among them, cv2 represents opencv and opencv-python.
[0052] (6) When the user does not use the container for a long time, in order to release resources such as GPU, CPU, and memory, the container should be stopped and destroyed. To do this, first stop the container and use the stop container command (docker stop mycontainer) to stop the container.
[0053] (7) After stopping, you can see that the container layer directory still exists. In order to save the system status modified by the user before, use the copy command (cp –r) to copy and save the container layer directory as a copy. Specifically: cp –r / var / lib / docker / overlay2 / a3ff060894567c16ac66c2c20aaa80d2d0edcebc4b7deee3a64b53874822a2ea / diff / * / home / dock / tensorflow, that is, back up the container layer files of the container to the directory ( / home / dock / tensorflow) of the host file system for storage. The files saved here mainly include the files added and modified to the container by running the third-party library installation command (pip install) and the software package installation command (apt install) in the container.
[0054] (8) Then destroy the container and use the container destruction command (docker rm mycontianer) to completely destroy the container. The corresponding container layer storage directory ( / var / lib / docker / overlay2 / a3ff060894567c16ac66c2c20aaa80d2d0edcebc4b7deee3a64b53874822a2ea / ) will be completely deleted.
[0055] At this point, you can see that the container layer directory and other runtime directories of the container on the host have all been deleted by Docker. If a copy is not retained above, all the container system states modified by the user will be lost.
[0056] When the user needs to continue using the container for research, use the following steps to regenerate the container and restore the system status previously modified by the user: 1. Create a container named mycontainer based on the tensorflow image (nvcr.io / nvidia / tensorflow:22.09-tf2-py3) and use the container creation (docker create) command. Specifically, docker create -it--name mycontainer --gpus all -v / home / dock / data: / workspace / my nvcr.io / nvidia / tensorflow:22.09-tf2-py3. That is, when the user needs to reuse the container, use the docker create command to create the container, but do not start it yet.
[0057] 2. Restore the container layer of the new container to the copy of the image layer previously stored for the user: Use the command to obtain the metadata of the container (docker inspect mycontainer) to obtain the directory where the container layer of the container created this time is stored ( / var / lib / docker / overlay2 / 224ae774aa48ba2655bab224900d3c50c4f3a2693aa9304bd2a5d9edcaa1baf9 / diff).
[0058] Copy the container layer copy of the previous container to this directory: cp -r / home / dock / tensorflow / * / var / lib / docker / overlay2 / 224ae774aa48ba2655bab224900d3c50c4f3a2693aa9304bd2a5d9edcaa1baf9 / diff, that is, copy the previously backed up files added and modified to the container to the container layer of the re-established container.
[0059] 3. Start a new container and use the container start (docker start) command, specifically: docker start -imycontainer, that is, use the docker start command to start the rebuilt container. At this time, the Python and operating system libraries installed in the last container can continue to be used without reinstalling. Among them, -i means connecting to the container terminal.
[0060] At this time, the container is running and the system environment is the same as when the user exited before. The user can continue the previous work. For example, run the python3 command in the container to enter the Python interactive environment, enter the import cv2 statement and the result is normal, indicating that the previously installed computer vision package opencv-python and the Linux support library libgl1-mesa-glx are working properly.
[0061] Taking a user's research and development based on the official python image released by docker as an example, the method of this embodiment is explained. In order to highlight the state retention of container migration between servers, conventional user program and document data are mapped to remote storage to achieve persistent storage, network port mapping, etc. are no longer reflected.
[0062] Docker has been installed on servers A and B running the operating system (Ubuntu Server 22.04), and the Python image released by Docker has been downloaded.
[0063] (1) When user C needs a Python development environment, a container named mycontainer is started for the user on server A based on the Python image: docker run -it --name mycontainer python bash, that is, the docker run command is used to construct a container for a user based on the Python image released by docker. Among them, -it means that the interactive terminal uses the container; --name mycontainer means that the container is named mycontainer.
[0064] (2) After the container is running, the user installs basic Linux tools such as vim, specifically: apt update; aptinstall vim –y. Among them, apt update means that the container operating system updates the list of available software packages; apt installvim –y means that the container operating system installs the vim software package.
[0065] (3) During use, continuously install the packages required for Python development as needed. Run the following commands respectively to use Python's package management tool (pip) to install the scientific computing package (numpy), data analysis package (pandas), and computer vision package without a graphical interface (opencv-python-headless). Specifically: pip install numpy; pipinstall pandas; pip install opencv-python-headless.
[0066] The files modified and added by these operations are not in the external persistent storage mapped when the container is created, but in the directories ( / lib and / usr / bin / python3.11). Since this is in the container, these directories are stored in the read-only image layer and cannot be modified. Instead, the container's Copy-on-Write mechanism is used to save all modified and newly added files in the container layer.
[0067] (4) On server A, by obtaining the container metadata (docker inspect mycontainer) command, you can obtain the directory where the container layer is stored on the host ( / var / lib / docker / overlay2 / a0edaca9cb2e8e8d5f2143471d415fdf32e049010b932926981848875eba070f / diff). By looking at the directory, you can see that the files modified and added to the image layer are saved in the corresponding directories.
[0068] (5) When the user needs to run a program that requires huge CPU and memory resources, but server A where the container is located does not have enough free resources, the container needs to be migrated to server B with sufficient resources. To do this, first stop the container on server A: docker stop mycontainer, that is, stop the container.
[0069] (6) Create a new container on server B based on the python image released by docker. The command is as follows: dockercreate -it --name mycontainer python. This means that the container is created on server B using the docker create command for this user, but it is not started yet. The docker inspect mycontainer command (which obtains the container's metadata) can be used to obtain the directory where the container layer of the newly created container is stored in the host file system of server B ( / var / lib / docker / overlay2 / fe1d987f2855efab85bda09938785c14a21d0b8709bb3f6c638d6f6eb579f3a5 / diff).
[0070] (7) Copy the container layer contents of the original container on server A to the container layer of the new container on server B via network transmission using the file copy command (scp –r). Specifically: scp –r / var / lib / docker / overlay2 / a0edaca9cb2e8e8d5f2143471d415fdf32e049010b932926981848875eba070f / diff / * serverb: / var / lib / docker / overlay2 / fe1d987f2855efab85bda09938785c14a21d0b8709bb3f6c638d6f6eb579f3a5 / diff / . The usage status data of the original container on server A is copied to the new container on server B.
[0071] (8) Then start the new container on server B with the following command: docker start -i mycontainer.
[0072] At this time, the user can use the new container on server B, and the software previously installed during the use of server A can continue to be used.
[0073] (9) Destroy the original container on server A and use the container destruction command (docker rm mycontianer) to release the occupied storage resources, that is, completely destroy the container and delete all the directories in the host file system ( / var / lib / docker / overlay2 / a0edaca9cb2e8e8d5f2143471d415fdf32e049010b932926981848875eba070f / ) that store the container layer data.
[0074] Embodiment 2 The purpose of the second embodiment is to provide a system for implementing a regenerable container, including: A container stopping module, configured to: stop the container in response to a container destroy command; The regeneration module is configured to: copy the container layer and save it as a copy, so that the content of the container layer copy covers the content of the container layer of the new container; or package and send the container layer, so that the container layer data is copied to the container layer of the new container; The container destroying module is configured to: destroy the container.
[0075] The copy records all modifications made to the container by the user when the container ends.
[0076] When the replica is saved, container-layer replica storage management based on user and application images is adopted.
[0077] It should be noted here that each module in this embodiment corresponds to each step in Example 1 one by one, and the specific implementation process is the same, which will not be repeated here.
[0078] Embodiment 3 This embodiment provides a computer-readable storage medium on which a computer program is stored. The program is executed by a processor. When the program is executed by the processor, the steps in the method for implementing a regenerable container as described in the first embodiment are implemented.
[0079] Embodiment 4 This embodiment provides a computer device, including a memory, a processor, and a computer program stored in the memory and running on the processor. When the processor executes the program, the steps in the method for implementing a renewable container as described in the first embodiment are implemented.
[0080] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
[0081] Although the above describes the specific implementation mode of the present invention in conjunction with the accompanying drawings, it is not intended to limit the scope of protection of the present invention. Those skilled in the art should understand that various modifications or variations that can be made by those skilled in the art on the basis of the technical solution of the present invention without creative work are still within the scope of protection of the present invention.
Claims
1. A method for realizing a renewable container, characterized in that: include: In response to the container destroy command, stopping the container; The container layer is copied and saved as a copy, so that the content of the container layer copy covers the content of the container layer of the new container; or the container layer is packaged and sent, so that the container layer data is copied to the container layer of the new container; Destroy the container.
2. A method for realizing a regenerable container according to claim 1, characterized in that: The copy records all modifications made to the container by the user when the container is finished running.
3. The method for realizing a regenerable container according to claim 1, characterized in that: After a new container is created on the destination host, the received container layer data is copied to the container layer of the new container. The destination host then starts the new container, thereby regenerating the container on the source host on the destination host.
4. The method for realizing a regenerable container according to claim 1, characterized in that: Create a new container, use the container layer copy content to overwrite the container layer content of the new container, start the new container, and then you can achieve container data regeneration.
5. The method for realizing a regenerable container according to claim 1, characterized in that: When the replica is saved, container layer replica storage management based on user and application images is adopted.
6. A system for implementing a renewable container, characterized in that: include: A container stopping module, configured to: stop the container in response to a container destroy command; The regeneration module is configured to: copy the container layer and save it as a copy, so that the content of the container layer copy covers the content of the container layer of the new container; or package and send the container layer, so that the container layer data is copied to the container layer of the new container; The container destroying module is configured to: destroy the container.
7. A system for realizing a renewable container as claimed in claim 6, characterized in that: The copy records all modifications made to the container by the user when the container is finished running.
8. A system for realizing a renewable container as claimed in claim 6, characterized in that: When the replica is saved, container layer replica storage management based on user and application images is adopted.
9. A computer-readable storage medium having a computer program stored thereon, the program being executed by a processor, characterized in that: When the program is executed by a processor, the steps in the method for implementing a renewable container as described in any one of claims 1 to 5 are implemented.
10. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the steps in the method for implementing a renewable container according to any one of claims 1 to 5 are implemented.
