Container implementation method and system based on double container layers, medium, equipment and product

By adopting a dual container layer structure in a renewable container, it is reconstructed into a read-only container curing layer and a read-write container working layer, and data merge and save data, it solves the performance degradation and inability to reproduce due to data accumulation in the container layer. The startup problem has achieved stable recovery of containers and reduced data replication.

CN119473511APending Publication Date: 2025-02-18HOTDIGIT TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411674926.9
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

Technical Problem

During the long-term use of renewable containers, the container layer data accumulation is too large, resulting in system performance degradation and user operations may cause the container to be unable to be regenerated and started.

Method used

Using a dual container layer structure, the container layer is reconstructed into a read-only container curing layer and a read-write container working layer. Data is merged and saved through a joint file system, and the container working layer is cleared to reduce the amount of data replication.

Benefits of technology

It provides the ability to resume operation in errors of containers, and reduces the amount of container status data replication during regeneration operation and exit of renewable containers, improving system performance and container stability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119473511A_ABST
    Figure CN119473511A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of cloud computing based on containers, and discloses a container implementation method and system based on double container layers, a medium, equipment and a product, and the method comprises the steps: reconstructing a container layer on which a renewable container depends into a read-only container curing layer and a read-write container working layer, the container curing layer and the container working layer jointly store the modification content of the regenerable container to the file system since the first creation; and in response to a data updating instruction, merging the data of the container curing layer and the container working layer according to a mode of a joint file system so as to update the container curing layer, and emptying the container working layer at the same time. In the long-term intermittent use process of the renewable container, the capability of recovering operation when errors occur is provided, and the copy quantity of the container state data when the renewable container operates in a regeneration mode and exits is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of container-based cloud computing, and in particular to a container implementation method, system, medium, device and product based on a double container layer. 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] Renewable containers are an extension of traditional container technology. At each stage of use, they can inherit the state of the container used last time.

[0004] However, the following problems may occur during the long-term use of recyclable containers: (1) Users will continuously install new software packages, upgrade software versions and system patches, and modify system configurations in the container, which will cause the container layer data to accumulate more and more. When the renewable container is loaded and exited, the amount of data transmitted to achieve container layer data recovery and preservation is too large, causing the system performance to degrade.

[0005] (2) User operations on the container may disrupt the operation of the container, such as failure to install or upgrade software, installation of a Trojan or virus, incorrect deletion of software or files, etc., which may cause errors in the container layer data and make the container unable to be regenerated and started in the future. Summary of the invention

[0006] In order to solve the above-mentioned problems, the present invention provides a container implementation method, system, medium, device and product based on a double container layer, which provides the ability for renewable containers to recover from errors during long-term intermittent use, and reduces the amount of copying of container status data when the renewable container is regenerated and exited.

[0007] In order to achieve the above object, the present invention adopts the following technical solution: A first aspect of the present invention provides a container implementation method based on a double container layer, comprising: Reconstructing the container layer on which the reproducible container depends for operation into a read-only container solidification layer and a readable and writable container working layer, wherein the container solidification layer and the container working layer jointly store the modification content of the file system made by the reproducible container since the first creation; In response to the data update instruction, the data of the container solidification layer and the container working layer are merged in a united file system manner to update the container solidification layer and clear the container working layer.

[0008] Further, the step of updating the container solidification layer includes: In response to the data update instruction, the operation of the reproducible container is stopped, and the union file system of the reproducible container is unmounted; The container working layer is used as an upper layer and the container solidification layer is used as a lower layer, and mounted as a joint file system; A blank directory is created as a new container solidification layer, and the content of the union file system is copied to the new container solidification layer, and the container solidification layer is replaced with the new container solidification layer.

[0009] Furthermore, the step of clearing the container working layer includes: unloading the union file system of the regenerable container, deleting the container working layer, and clearing the packaged data of the saved container working layer.

[0010] Furthermore, when the regenerable container cannot be regenerated and resumed, the blank container working layer, the container solidification layer and each mirror layer are mounted as a joint file system as the file system of the regenerable container.

[0011] Furthermore, when the reproducible container exits operation and the joint file system of the reproducible container is uninstalled, the container solidification layer remains unchanged, and the data of the container working layer is packaged and saved to obtain the packaged data of the container working layer.

[0012] Furthermore, when the renewable container is regenerated and resumed, a new blank container working layer is created, and the packaged data of the container working layer saved when the renewable container last exited is read. After unpacking to the new blank container working layer, each image layer and container solidification layer are used as read-only layers, and the container working layer is used as a readable and writable layer, which are mounted as a joint file system as the file system of the renewable container.

[0013] A second aspect of the present invention provides a container implementation system based on a double container layer, comprising: A dual container layer creation module, which is configured to: reconstruct the container layer on which the reproducible container depends for operation into a read-only container solidification layer and a readable and writable container working layer, wherein the container solidification layer and the container working layer jointly store the modification content of the file system made by the reproducible container since the first creation; The data merging module is configured to: in response to a data update instruction, merge the data of the container solidification layer and the container working layer in a united file system manner to update the container solidification layer and clear the container working layer.

[0014] A third aspect of the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps in the above-mentioned method for realizing a container based on a double container layer.

[0015] 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 executable on the processor, wherein when the processor executes the program, the steps in the container implementation method based on a double container layer as described above are implemented.

[0016] A fifth aspect of the present invention provides a computer program product, which is a computer program product containing a computer program. When a processor executes the computer program, the steps in the container implementation method based on a double container layer as described above are implemented.

[0017] Compared with the prior art, the present invention has the following beneficial effects: The present invention reconstructs the container layer on which the operation of the renewable container depends into a lower read-only container solidification layer and an upper readable and writable container working layer. During the use of the renewable container, modifications to the container data will be reflected in the topmost container working layer, and the entire container layer data will be merged and saved to the container solidification layer in stages for persistent storage, so that the container layer data can be saved in a read-only manner, thereby being able to save the correct container layer data and prevent it from being modified, providing the ability to resume operation in the event of an error.

[0018] The present invention merges and saves the entire container layer data to the container solidification layer, and at the same time, clears the container working layer. The data that needs to be saved for container regeneration and exit is only the data changes modified to the renewable container after the last merger, which are saved in the container working layer. The data volume is small, which reduces the amount of copying of container status data during the regeneration operation and exit of the renewable container. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] 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.

[0020] Figure 1 is a schematic diagram of a double container layer according to a first embodiment of the present invention; Figure 2 is a flow chart of re-operating a regenerable container according to the first embodiment of the present invention; Figure 3 It is a schematic diagram of the merging operation of the first embodiment of the present invention. DETAILED DESCRIPTION

[0021] The present invention will be further described below in conjunction with the accompanying drawings and embodiments.

[0022] 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.

[0023] 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.

[0024] Embodiment 1 The purpose of the first embodiment is to provide a container implementation method based on a double container layer.

[0025] The present embodiment provides a container implementation method based on a double container layer, which supports solidifying the container state of a renewable container during use and reduces the amount of container state data stored.

[0026] This embodiment provides a container implementation method based on a double container layer, which increases the preservation of the correct container state and reduces the amount of duplicated data in the container layer.

[0027] By utilizing the hierarchical structure of the joint file system adopted by the container, this embodiment provides a container implementation method based on a dual container layer, which divides the original container layer into two layers: a lower read-only container solidification layer and an upper readable and writable container working layer. The entire container layer data is merged and saved to the container solidification layer in stages for persistent storage, so that the container layer data can be saved in a read-only manner, thereby saving the correct container layer data and preventing it from being modified. Subsequently, modifications to the container data during the use of the container will be reflected in the topmost container working layer, which needs to be specially saved when the container is destroyed and restored to the container working layer when the container is regenerated.

[0028] This embodiment provides a container implementation method based on a dual container layer, in which the container layer adopts a two-layer structure implementation method: for the container layer that the container operation depends on, it is reconstructed into a two-layer implementation, including a lower read-only container solidification layer and an upper readable and writable container working layer, which jointly save the modified content of the file system in the container since the creation of the reproducible container. In this way, when the container is running, a joint file system is constructed by the read-only layers of the dependent image, the read-only container solidification layer and the top readable and writable container working layer as the file system that the container operation depends on.

[0029] This embodiment provides a container implementation method based on dual container layers, and a method for updating data of a container solidification layer and a container working layer: during the long-term use of a renewable container, at each stage, the data of the container solidification layer and the container working layer can be merged in a joint file system manner, and the merged data can be used to replace the original container solidification layer, thereby solidifying the correct working state of the current container and clearing the container working layer at the same time. In this way, the container solidification layer provides the container state data at the time of the last merge operation in a read-only manner, and the container working layer implements the container state data change after the last merge operation in a readable and writable state.

[0030] This embodiment provides a container implementation method based on dual container layers, and an operation method of a container solidification layer and a container working layer when a container is regenerated and exited: when a regenerable container exits operation and is destroyed, after its joint file system is umounted, the container solidification layer cannot be destroyed, and is persistently stored in a manner similar to that of an image layer, while the data of the container working layer is packaged and saved and then destroyed; when the regenerable container is regenerated and resumed, a new container working layer is created and data is restored from the stored packaged file, and the joint file system is mounted with the following container solidification layer and each image layer as the file system of the container, and modifications made by the container to its file system are saved in the readable and writable container working layer.

[0031] This embodiment provides a container implementation method based on a dual container layer, and a method for restoring a correct working state after a container operation failure: when the container cannot be regenerated and restored normally due to container layer data errors due to misoperation or failure during use, the container working layer is deleted, and a blank container working layer, a container solidification layer, and each mirror layer are mounted as a joint file system as the file system of the container. The file system is restored to the normal state of the container when the container solidification layer and the container working layer were merged last time, thereby restoring the container operation.

[0032] This embodiment provides a container implementation method based on a double container layer, including the following steps: Step 1: When a user creates a reproducible container C based on an image for the first time, Figure 1 As shown, perform the following steps: (101) Create two blank directories as container curing layer D and container working layer E respectively; (102) Each image layer of the image is used as a read-only layer, and the container solidification layer D and the container working layer E are added on top, and they are mounted together as a joint file system as the file system of the renewable container, and the corresponding process is loaded according to the settings of the renewable container to complete the first run of the renewable container. In this way, the container solidification layer D in the renewable container is read-only, and all modifications to the renewable container are reflected in the read-write container working layer E.

[0033] Step 2: When the user exits the reproducible container C created based on the image, the following steps are performed: (201) Stop the reproducible container, enter the stopped state, and umount the union file system; (202) The solidified layer D of the container remains unchanged; (203) Packing and saving the data of the container working layer E (container status data); (204) Destroy the renewable container and delete the renewable container working layer directory.

[0034] Step 3: A method for implementing the re-entry of the regenerable container into the running state of the container to restore the state when the container was last exited. That is, when the user runs the regenerable container again, Figure 2 As shown, perform the following steps: (301) Create a blank directory as a readable and writable container working layer, read the packaged data of the container working layer E saved when the last regenerable container was exited, and unpack it into the container working layer directory to regenerate the container status data when the last regenerable container was exited; (302) Use the image layers and container solidification layer D of the image as read-only layers, the container working layer as a readable and writable layer, and mount the union file system as the basic file system of the reproducible container; (303) According to the setting of the regenerable container, the corresponding process is loaded, the regenerable container is run again, and the container state at the time of last exit is restored.

[0035] Step 4: Data updating method of the container solidification layer and the container working layer of the renewable container, such as Figure 3 As shown, including: (401) In response to the data update instruction, stop the reproducible container and umount its union file system; (402) With the container working layer as the upper layer and the container solidification layer as the lower layer, mount as a union file system; (403) Create a blank directory as a new container solidification layer, copy the contents of the union file system to the new container solidification layer, and replace the original container working layer with the new container solidification layer, thereby merging the data of the original container working layer and the container solidification layer into the new container solidification layer; (404) umount the union file system, delete the original container working layer and container solidified layer directories, and clear the previously saved container working layer packaging data.

[0036] (405) When regenerating a regenerable container, create a blank container working layer directory as the read-write layer, and use the new container solidification layer and the image layers as read-only layers. Mount the union file system as the base file system for the regenerable container, thereby providing the same container working state as before the merge operation.

[0037] Step 5: A method for restoring the regenerable container to the correct operating state at the time of the last merge operation when a failure occurs. That is, when the user is using the regenerable container C and the regenerable container crashes and cannot be regenerated based on the current container working layer data, perform the following operations: (501) Create a blank directory as a readable and writable container working layer; (502) Treat the image layers and container solidification layers of image B as read-only layers, and the new blank container working layer as a readable and writable layer, mount them as a union file system as the file system of the regenerable container, load the corresponding processes according to the settings of the regenerable container, and run the regenerable container again, so that the system is restored to the correct running state at the time of the merge.

[0038] This embodiment provides a container implementation method based on a dual container layer, which reconstructs the container layer on which the operation of a renewable container depends into a lower read-only container solidification layer and an upper readable and writable container working layer. During the use of the renewable container, modifications to the container data will be reflected in the top container working layer, and the entire container layer data will be merged and saved to the container solidification layer in stages for persistent storage, so that the container layer data can be saved in a read-only manner, thereby saving the correct container layer data and preventing it from being modified, and providing the ability to resume operation in the event of an error.

[0039] The present embodiment provides a container implementation method based on a double container layer. While merging and saving the entire container layer data to the container solidification layer, the container working layer is cleared. The data that needs to be saved for container regeneration and exit is only the data changes modified to the renewable container after the last merge, which are saved in the container working layer. The data volume is small, which reduces the amount of copying of container status data during the regeneration operation and exit of the renewable container.

[0040] The container implementation method based on a double container layer provided in this embodiment provides the ability for a renewable container to recover from errors during long-term intermittent use, and reduces the amount of copying of container status data when the renewable container is regenerated and exited.

[0041] The present embodiment provides a container implementation method based on a double container layer, which can periodically merge the state data of the renewable container into the container solidification layer for persistent storage, thereby solidifying the correct state data of the container at that moment. The data that needs to be saved for container regeneration and exit is only the data changes modified to the renewable container after the last merger, which are saved in the container working layer and the data volume is relatively small.

[0042] Embodiment 2 The purpose of the second embodiment is to provide a container implementation system based on a double container layer, including: A dual container layer creation module, which is configured to: reconstruct the container layer on which the reproducible container depends for operation into a read-only container solidification layer and a readable and writable container working layer, wherein the container solidification layer and the container working layer jointly store the modification content of the file system made by the reproducible container since the first creation; The data merging module is configured to: in response to a data update instruction, merge the data of the container solidification layer and the container working layer in a united file system manner to update the container solidification layer and clear the container working layer.

[0043] 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.

[0044] Embodiment 3 This embodiment provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the steps in the container implementation method based on double container layers as described in the first embodiment above are implemented.

[0045] Embodiment 4 This embodiment provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, the steps in the container implementation method based on a double container layer as described in the first embodiment are implemented.

[0046] Embodiment 5 This embodiment provides a computer program product, which is a computer program product containing a computer program. When a processor executes the computer program, the steps in the container implementation method based on double container layers as described in the first embodiment above are implemented.

[0047] 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.

[0048] 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 container implementation method based on double container layers, characterized in that: include: Reconstructing the container layer on which the reproducible container depends for operation into a read-only container solidification layer and a readable and writable container working layer, wherein the container solidification layer and the container working layer jointly store the modification content of the file system made by the reproducible container since the first creation; In response to the data update instruction, the data of the container solidification layer and the container working layer are merged in a united file system manner to update the container solidification layer and clear the container working layer.

2. A container realization method based on double container layers as claimed in claim 1, characterized in that: The step of updating the container solidification layer comprises: In response to the data update instruction, the operation of the reproducible container is stopped, and the union file system of the reproducible container is unmounted; The container working layer is used as an upper layer and the container solidification layer is used as a lower layer, and mounted as a joint file system; A blank directory is created as a new container solidification layer, and the content of the union file system is copied to the new container solidification layer, and the container solidification layer is replaced with the new container solidification layer.

3. A container realization method based on double container layers as claimed in claim 1, characterized in that: The step of clearing the container working layer includes: uninstalling the union file system of the regenerable container, deleting the container working layer, and clearing the packaged data of the saved container working layer.

4. A container realization method based on double container layers as claimed in claim 1, characterized in that: When the regenerable container cannot be regenerated and resumed, the blank container working layer, the container solidification layer and each mirror layer are mounted as a joint file system as the file system of the regenerable container.

5. A container realization method based on double container layers as claimed in claim 1, characterized in that: When the reproducible container exits operation and the joint file system of the reproducible container is uninstalled, the container solidification layer remains unchanged, and the data of the container working layer is packaged and saved to obtain the packaged data of the container working layer.

6. A container realization method based on double container layers as claimed in claim 1, characterized in that: When the renewable container is regenerated and resumed, a new blank container working layer is created, and the packaged data of the container working layer saved when the renewable container last exited is read. After unpacking to the new blank container working layer, each image layer and container solidification layer are used as read-only layers, and the container working layer is used as a readable and writable layer. They are mounted as a joint file system as the file system of the renewable container.

7. A container implementation system based on double container layers, characterized in that: include: A dual container layer creation module, which is configured to: reconstruct the container layer on which the reproducible container depends for operation into a read-only container solidification layer and a readable and writable container working layer, wherein the container solidification layer and the container working layer jointly store the modification content of the file system made by the reproducible container since the first creation; The data merging module is configured to: in response to a data update instruction, merge the data of the container solidification layer and the container working layer in a united file system manner to update the container solidification layer and clear the container working layer.

8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps in the container realization method based on double container layers as described in any one of claims 1 to 6 are implemented.

9. 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 container implementation method based on double container layers as described in any one of claims 1 to 6 are implemented.

10. A computer program product, which is a computer program product containing a computer program, characterized in that When the processor executes the computer program, the steps in the container implementation method based on double container layers as described in any one of claims 1 to 6 are implemented.