CN118132204A - Container management method, device, equipment and medium - Google Patents
Container management method, device, equipment and medium Download PDFInfo
- Publication number
- CN118132204A CN118132204A CN202410311286.9A CN202410311286A CN118132204A CN 118132204 A CN118132204 A CN 118132204A CN 202410311286 A CN202410311286 A CN 202410311286A CN 118132204 A CN118132204 A CN 118132204A
- Authority
- CN
- China
- Prior art keywords
- container
- read
- target container
- cloud storage
- storage system
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000007726 management method Methods 0.000 title claims abstract description 53
- 238000000034 method Methods 0.000 claims abstract description 33
- 238000012217 deletion Methods 0.000 claims abstract description 11
- 230000037430 deletion Effects 0.000 claims abstract description 11
- 238000004590 computer program Methods 0.000 claims description 16
- 230000005012 migration Effects 0.000 claims description 6
- 238000013508 migration Methods 0.000 claims description 6
- 230000000694 effects Effects 0.000 abstract description 3
- 230000002045 lasting effect Effects 0.000 abstract 2
- 230000008569 process Effects 0.000 description 13
- 238000010586 diagram Methods 0.000 description 11
- 230000006870 function Effects 0.000 description 9
- 238000004891 communication Methods 0.000 description 6
- 238000012545 processing Methods 0.000 description 6
- 230000003287 optical effect Effects 0.000 description 5
- 239000003795 chemical substances by application Substances 0.000 description 4
- 230000002085 persistent effect Effects 0.000 description 4
- 230000004044 response Effects 0.000 description 4
- 238000010276 construction Methods 0.000 description 3
- 230000008859 change Effects 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 230000014759 maintenance of location Effects 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 239000013307 optical fiber Substances 0.000 description 2
- 230000000644 propagated effect Effects 0.000 description 2
- 239000004065 semiconductor Substances 0.000 description 2
- 230000001360 synchronised effect Effects 0.000 description 2
- 238000007792 addition Methods 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000033228 biological regulation Effects 0.000 description 1
- 238000013500 data storage Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 239000000835 fiber Substances 0.000 description 1
- 238000009434 installation Methods 0.000 description 1
- 239000004973 liquid crystal related substance Substances 0.000 description 1
- 238000012546 transfer Methods 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45533—Hypervisors; Virtual machine monitors
- G06F9/45558—Hypervisor-specific management and integration aspects
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/10—File systems; File servers
- G06F16/11—File system administration, e.g. details of archiving or snapshots
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45533—Hypervisors; Virtual machine monitors
- G06F9/45558—Hypervisor-specific management and integration aspects
- G06F2009/45562—Creating, deleting, cloning virtual machine instances
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45533—Hypervisors; Virtual machine monitors
- G06F9/45558—Hypervisor-specific management and integration aspects
- G06F2009/45575—Starting, stopping, suspending or resuming virtual machine instances
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Software Systems (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Data Mining & Analysis (AREA)
- Databases & Information Systems (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The embodiment of the disclosure relates to a container management method, a device, equipment and a medium, wherein the method comprises the following steps: when a target container is started, mounting a cloud storage system appointed by a storage volume to a read-write layer in a root file system of the target container; and responding to the deleting request of the target container, executing a reservation operation on the read-write layer and the increment data in the cloud storage system, and re-mounting the cloud storage system to the read-write layer of the root file system of the restarted target container after the target container is restarted. Therefore, the storage of the data in the read-write layer is realized through the cloud storage system, the read-write layer and the incremental data in the cloud storage system are reserved when the subsequent target container is deleted, the reserved incremental data can be read by re-mounting the cloud storage system after the target container is restarted, the incremental data of the container is not influenced by the deletion of the container to realize the lasting storage, the lasting storage of the total data of the container is further realized, and the access experience effect of a user on the data is improved.
Description
Technical Field
The disclosure relates to the technical field of cloud computing, and in particular relates to a container management method, device, equipment and medium.
Background
In the container arranging system, data of a container can be stored through a Volume (Volume) or a cloud disk and the like which are mounted, but the Volume or the cloud disk can only be mounted to a certain subdirectory of the container, and after the container is migrated or restarted, the storage of the data of the subdirectory can only be realized, and other data in the container are lost, so that the user experience is affected.
Disclosure of Invention
In order to solve the technical problems, the present disclosure provides a container management method, device, equipment and medium.
The embodiment of the disclosure provides a container management method, which comprises the following steps:
When a target container is started, mounting a cloud storage system appointed by a storage volume to a read-write layer in a root file system of the target container;
And responding to the deleting request of the target container, executing a reservation operation on the read-write layer and the increment data in the cloud storage system, and re-mounting the cloud storage system to the read-write layer of the root file system of the restarted target container after the target container is restarted.
The embodiment of the disclosure also provides a container management device, which comprises:
the mounting module is used for mounting the cloud storage system appointed by the storage volume to a read-write layer in a root file system of the target container when the target container is started;
And the reservation module is used for responding to the deletion request of the target container, executing reservation operation on the read-write layer and the incremental data in the cloud storage system, and re-mounting the cloud storage system to the read-write layer of the root file system of the restarted target container after the target container is restarted.
The embodiment of the disclosure also provides an electronic device, which comprises: a processor; a memory for storing the processor-executable instructions; the processor is configured to read the executable instructions from the memory and execute the instructions to implement a container management method as provided in an embodiment of the disclosure.
The present disclosure also provides a computer-readable storage medium storing a computer program for executing the container management method as provided by the embodiments of the present disclosure.
The disclosed embodiments also provide a computer program product comprising a computer program/instructions, characterized in that the computer program/instructions, when executed by a processor, implement the steps of the container management method provided by the disclosed embodiments.
Compared with the prior art, the technical scheme provided by the embodiment of the disclosure has the following advantages: according to the container management scheme provided by the embodiment of the disclosure, when a target container is started, a cloud storage system designated by a storage volume is mounted to a read-write layer in a root file system of the target container; and responding to the deleting request of the target container, executing a reservation operation on the read-write layer and the increment data in the cloud storage system, and re-mounting the cloud storage system to the read-write layer of the root file system of the restarted target container after the target container is restarted. By adopting the technical scheme, the cloud storage system appointed by the storage volume is mounted on the read-write layer of the root file system, the storage of data in the read-write layer is realized through the cloud storage system, the read-write layer and the incremental data in the cloud storage system are reserved when the subsequent target container is deleted, the reserved incremental data can be read by re-mounting the cloud storage system after the target container is restarted, the incremental data of the container is not influenced by the deletion of the container to realize the persistent storage, the persistent storage of the total data of the container is further realized, and the access experience effect of a user on the data is improved.
Drawings
The above and other features, advantages, and aspects of embodiments of the present disclosure will become more apparent by reference to the following detailed description when taken in conjunction with the accompanying drawings. The same or similar reference numbers will be used throughout the drawings to refer to the same or like elements. It should be understood that the figures are schematic and that elements and components are not necessarily drawn to scale.
FIG. 1 is a schematic illustration of container management provided by the related art;
FIG. 2 is a flow chart of a method of container management provided in some embodiments of the present disclosure;
FIG. 3 is a schematic illustration of container management provided by some embodiments of the present disclosure;
FIG. 4 is a schematic illustration of a start-up target container provided by some embodiments of the present disclosure;
FIG. 5 is a schematic view of a container management device according to some embodiments of the present disclosure;
Fig. 6 is a schematic structural diagram of an electronic device according to some embodiments of the present disclosure.
Detailed Description
Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While certain embodiments of the present disclosure have been shown in the accompanying drawings, it is to be understood that the present disclosure may be embodied in various forms and should not be construed as limited to the embodiments set forth herein, but are provided to provide a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are for illustration purposes only and are not intended to limit the scope of the present disclosure.
It should be understood that the various steps recited in the method embodiments of the present disclosure may be performed in a different order and/or performed in parallel. Furthermore, method embodiments may include additional steps and/or omit performing the illustrated steps. The scope of the present disclosure is not limited in this respect.
The term "including" and variations thereof as used herein are intended to be open-ended, i.e., including, but not limited to. The term "based on" is based at least in part on. The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments. Related definitions of other terms will be given in the description below.
It should be noted that the terms "first," "second," and the like in this disclosure are merely used to distinguish between different devices, modules, or units and are not used to define an order or interdependence of functions performed by the devices, modules, or units.
It should be noted that references to "one", "a plurality" and "a plurality" in this disclosure are intended to be illustrative rather than limiting, and those of ordinary skill in the art will appreciate that "one or more" is intended to be understood as "one or more" unless the context clearly indicates otherwise.
The names of messages or information interacted between the various devices in the embodiments of the present disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.
In the native implementation of the container orchestration system, storage of container data is achieved by mounted volumes or cloud disks, etc. Fig. 1 is a schematic diagram of container management provided in the related art, as shown in fig. 1, a volume or a cloud disk can only be bound to a certain subdirectory of a container, and original content in the subdirectory is replaced with content in the volume or the cloud disk. After the container is migrated or restarted, the data in the subdirectory is reserved, and other data in the container such as a writable layer is lost, so that the user experience is affected.
For example, in an integrated development environment based on cloud computing, a default Home (Home) directory of a container is mounted on a storage system, user data in the Home directory is stored on the storage system, and after the container is migrated or restarted, the user data in the Home directory is saved. But other data such as installation packages generated by the user in the container environment is lost.
In order to solve the above-described problems, embodiments of the present disclosure provide a container management method, which is described below in connection with specific embodiments.
Fig. 2 is a flow chart of a container management method provided in some embodiments of the present disclosure, which may be performed by a container management device, where the device may be implemented in software and/or hardware, and may be generally integrated in an electronic device. As shown in fig. 2, the container management method includes:
Step 201, when a target container is started, a cloud storage system designated by a storage volume is mounted to a read-write layer in a root file system of the target container.
The target Container may be any one or more containers in the Container group, and the target Container may be a Container (Container) currently activated in the Container arrangement system. The type of the target container is not limited in this embodiment, for example, the target container may be a standard container that meets a certain container interface specification, and the specific container interface specification is not limited.
A containerization system may be used to manage containerized applications on multiple hosts in a cloud platform, which may be understood as a containerization engine used to automatically deploy, scale and manage containerized applications. A group of containers in a container orchestration system may be the smallest unit of creation or deployment of the container orchestration system, one group of containers encapsulating one or more containers.
The storage volume may be understood as an abstraction of the cloud storage system at the level of the container orchestration system, and may be used to store data in the read-write layer of the root file system, and may be a predefined volume in the container orchestration system. The lifecycle of the storage volume may be different from the lifecycle of the target container, and the lifecycle of the storage volume may be independent of the lifecycle of the target container. For example, after the target container is deleted, the data stored in the storage volume may still exist. The lifecycle characteristics of the storage volume create a basis for preserving previously stored data after a target container reboot. The cloud storage system can be a data storage system realized based on cloud technology, and the cloud storage system can realize the storage of data to the cloud end, and is also called a cloud disk. In some embodiments of the present disclosure, the cloud storage system is a block storage cloud system. A block storage cloud system may be a cloud storage system that divides data into blocks, stores and accesses the data in units of blocks, and is also called a block storage cloud disk.
The root file system (RootFS) may be a file system for providing an isolated execution environment for the container process, and may be understood as a federated file system. The root file system may include a read-only layer (LowerDir) and a read-write layer (UpperDir). The read-only layer may be a layer with access rights that are read-only, and may be used to store mirrored data that is read-only. The read-write layer can be a layer with access authority which can be read and written, and the read-write layer is also called as a writable layer. The read-write layer may be used to store readable and writable data, and may be located above the read-only layer, and may be used to record modifications to files in the root file system.
In embodiments of the present disclosure, the container management method may be performed by a container orchestration system, i.e. the container management device may be provided in the container orchestration system.
In the embodiment of the disclosure, the container management device may respond to a start request of a user to a target container, start the target container, and mount a cloud storage system corresponding to a storage volume to a read-write layer of a root file system of the target container in a start process, so as to store data in the read-write layer through the cloud storage system.
In some embodiments of the present disclosure, at a start-up of a target container, mounting a cloud storage system specified by a storage volume to a read-write layer in a root file system of the target container includes: when a target container is started by calling a container running tool, setting the directory of a read-write layer of a root file system of the target container as a mounting directory of a storage volume of a specified cloud storage system.
Wherein the container running tool may be a lightweight container running tool that may be used to create and run containers. The mount directory (/ mount-path) may be a directory to which the storage volume is mounted, and may be understood as a mount point of the storage volume.
In this embodiment, after the root file system is built, a container running tool is invoked based on the open container initiative, by which the target container is started. In the starting process of the target container, if the container running tool determines that the mount directory recorded in the annotation is the read-write layer directory, the read-write layer directory is specified as the mount directory of the cloud storage system, and the container management device sets the read-write layer directory of the root file system of the target container as the mount directory of the storage volume of the cloud storage system. And if the mounting catalogue recorded in the mounting annotation is not the catalogue of the read-write layer through the container running tool, mounting the storage volume of the cloud storage system according to the mounting catalogue recorded in the mounting annotation.
FIG. 3 is a schematic diagram of container management provided by some embodiments of the present disclosure, where in FIG. 3, the merge directory (MergeDir) may be a directory of a container-aware root file system. As shown in fig. 3, a node agent in the container arrangement system mounts the storage system to a host, and designates a directory of a writable layer of a root file system of a target container as a mount directory of the cloud storage system, and a container running tool starts the target container to mount the cloud storage system to a readable layer of the root file system.
In the scheme, the root file system of the target container is built based on the container running time, the container running tool is called to start the target container, and the cloud storage system is mounted to the read-write layer when the target container is started through cooperation of the container running time and the container running tool, so that a foundation is created for subsequent incremental data reservation.
And 202, responding to a deleting request of the target container, executing a reservation operation on the read-write layer and the incremental data in the cloud storage system, and re-mounting the cloud storage system to the read-write layer of the root file system of the restarted target container after the target container is restarted.
Wherein the delete request may be a request indicating a deletion of the target container. In some embodiments of the present disclosure, the delete request includes a migration request or a restart request. Wherein the migration request may be a request indicating that the target container is migrated from one container orchestration system node to another. The restart request may be a request indicating that the target container is restarted. In this embodiment, in response to a migration request or a restart request for a target container, the container management device may both reserve the read-write layer and incremental data in the cloud storage system, and reload the cloud storage system to the read-write layer of the root file system of the restarted target container after the target container is restarted. Under the condition of migrating or restarting the target container, the original incremental data of the read-write layer corresponding to the target container can be reserved.
The incremental data may be data for recording changes during the operation of the target container, and the incremental data may be data recorded in a read-write layer of the root file system of the target container. Because the cloud storage system is mounted on the read-write layer, the incremental data is specifically stored in the cloud storage system. The reservation operation may be an operation that does not delete the delta data, and may be implemented by executing corresponding reservation code.
In the embodiment of the disclosure, in the running process of the target container, since the cloud storage system is mounted on the read-write layer of the root file system, and the data change in the running process of the target container is recorded in the read-write layer through the incremental data, the incremental data can be synchronized into the cloud storage system, and the synchronization of the data change in the target container is realized. If the user needs to delete the target container, the user can create a corresponding deleting process, the deleting process generates a deleting request aiming at the target container and sends the deleting request to the container management device, the container management device responds to the deleting request to execute the deleting of the target container and intercept the deleting of the incremental data in the read-write layer and the cloud storage system, and the reservation of the incremental data in the read-write layer and the cloud storage system is realized.
Further, after the target container is restarted, the cloud storage system is re-mounted to the read-write layer of the root file system of the target container after the restart, and the data in the read-write layer is the data stored in the cloud storage system, namely the data recorded in the read-write layer before the target container is deleted.
In some embodiments of the present disclosure, performing a reservation operation on a read-write layer and incremental data in a cloud storage system includes: acquiring a target directory of a read-write layer recorded in an annotation of a target container; and if the target directory is determined to be the same as the mounting directory of the cloud storage system, the cloud storage system is determined to be mounted on the read-write layer, and the reservation operation is executed on the read-write layer and the incremental data in the cloud storage system.
The target directory may be a basis for determining whether to reserve the incremental data, where the target directory may be a directory on which the read-write layer is mounted when the incremental data is reserved. It can be understood that if the read-write layer is mounted on the target directory, the incremental data in the read-write layer is reserved, and if the read-write layer is not mounted on the target directory, the incremental data in the read-write layer is not reserved.
In this embodiment, the container management device parses the annotation in the target container in response to receiving the deletion operation on the target container, obtains the target directory of the read-write layer recorded in the annotation, and obtains the mount directory currently mounted by the cloud storage system. And judging whether the target directory is consistent with the mounting directory, if so, indicating that the current cloud storage system is mounted on the read-write layer of the root file system, and reserving the read-write layer and the incremental data in the cloud storage system. If the target directory is inconsistent with the mounting directory, which indicates that the current cloud storage system is not mounted on the read-write layer of the root file system, the incremental data in the read-write layer is not reserved, and the incremental data in the read-write layer is deleted.
In the scheme, the judgment of whether the cloud storage system is mounted on the read-write layer is realized based on the comparison of the target directory and the mounting directory, and the reservation of the incremental data in the read-write layer is realized under the condition that the cloud storage system is mounted on the read-write layer.
According to the container management scheme provided by the embodiment of the disclosure, when a target container is started, a cloud storage system designated by a storage volume is mounted to a read-write layer in a root file system of the target container; and responding to the deleting request of the target container, executing a reservation operation on the read-write layer and the increment data in the cloud storage system, and re-mounting the cloud storage system to the read-write layer of the root file system of the restarted target container after the target container is restarted. By adopting the technical scheme, the cloud storage system appointed by the storage volume is mounted on the read-write layer of the root file system, the storage of data in the read-write layer is realized through the cloud storage system, the read-write layer and the incremental data in the cloud storage system are reserved when the subsequent target container is deleted, the reserved incremental data can be read by re-mounting the cloud storage system after the target container is restarted, the incremental data of the container is not influenced by the deletion of the container to realize the persistent storage, the persistent storage of the total data of the container is further realized, and the access experience effect of a user on the data is improved.
In the related art, a storage system is a sub-directory mounted to a container, and the storage system cannot sense a root file system serving as a joint file system and cannot sense a read-write layer in the root file system. In the embodiment of the disclosure, the operation of the root file system is realized, and the container is mounted to the read-write layer of the root file system, so that the retention of the increment data in the read-write layer is realized. Under the condition that the mirror image data in the read-only layer is unchanged, the incremental data are combined with the mirror image data in the read-only layer to obtain all data of the target container, so that the total storage of the data of the target container is realized.
In some embodiments of the present disclosure, before the target container is started, the container management method further includes: and mounting the cloud storage system on a host machine of the target container, and constructing a root file system of the target container based on the container runtime.
Wherein, when the container is operated as the container of the industry standard, one or more of the following functions can be realized by the container when operated: managing the lifecycle of the container, pulling or pushing the container image, managing the storage of the image and container data, invoking command line tools to run the container, managing the container network, and network interfaces. Wherein the host may be a physical machine or a virtual machine running a container orchestration system Node (Node).
In this embodiment, the node agent in the container orchestration system may mount the cloud storage system to the host of the target container, and when the container is invoked to run based on the preset remote procedure call service through the container runtime interface, construct the root file system of the target container through the container runtime. Specifically, the image is downloaded from a preset image warehouse, the image comprises a plurality of compressed files, one compressed file corresponds to one layer in the read-only layer, and the compressed files are decompressed into the catalogue of the corresponding layer to obtain the read-only layer of the root file system. And setting the read-write layer of the root file system as an empty directory, thereby obtaining the root file system. In the construction process of the root file system, the loading catalogue of the cloud storage system is recorded through annotation when the container runs, and the loading catalogue of the annotation record can be a catalogue of a read-write layer.
Fig. 4 is a schematic diagram of a startup target container provided in some embodiments of the present disclosure, as shown in fig. 4, a node agent in a container orchestration system mounts a cloud storage system to a host, when a container runtime is invoked based on a preset remote procedure call service through a container runtime interface, the container runtime builds a root file system of the target container, and invokes a container runtime tool through an open container initiative, and the target container is started through the container runtime tool.
In the scheme, the root file system is constructed, and a foundation is created for the subsequent mounting of the cloud storage system.
In some embodiments of the present disclosure, the container management method further comprises: and adding a reserved code in the deleting code of the target container, wherein the reserved code is used for not executing deleting operation on the increment data of the read-write layer when the deleting of the target container is determined.
The deleting code may be an existing function code for deleting the target container, and the deleting code may include a migration code for migrating the target container or a container code for restarting the target container. The reserved code can be a newly added functional code for reserving the incremental data, the reserved code can be a logic code branch which is added for the deleting code and is used for reserving the incremental data, the reserved code can be a code constructed based on a conditional statement, the judging condition of the reserved code can be that an installed catalog of the cloud storage system is a catalog of a read-write layer of a root file system, and the executing operation can be that the deleting operation is not executed on the incremental data of the read-write layer. The present embodiment does not limit the type of the conditional statement, and for example, the conditional statement may be an if-then statement.
In this embodiment, the reserved code is added to the existing deletion code for deleting the target container. And executing a deleting code aiming at the target container when the target container is deleted, and executing a reserved code aiming at the incremental data in the deleting code, so as to further realize the reservation of the incremental data of the read-write layer when the target container is deleted. Thus, a foundation is created at the code level for subsequent deletion of the target container but retaining the incremental data in the read-write layer.
In some embodiments of the present disclosure, after the cloud storage system is mounted to the read-write layer in the root file system of the target container at the time of the start-up of the target container, the container management method further includes: and responding to the data operation request of the target container, and storing incremental data corresponding to the data operation request in the read-write layer and the cloud storage system.
Wherein the data manipulation request may be a processing request for data in the target container. The type of the data operation request is not limited in this embodiment, and for example, the data operation request may be one or more of addition, deletion, and modification. In this embodiment, the layer where the data is in the data operation request operation is not limited, for example, the data may be in a read-only layer, or the data may be in a read-write layer.
In this embodiment, after the cloud storage system is mounted to the read-write layer of the root file system of the target container, if the user needs to operate on the data in the target container, the user may create a corresponding operation process, send a data operation request to the container management device through the operation process, after receiving the data operation request, the container management device parses the data operation request, if the data operation request is an adding or modifying operation for the data in the read-only layer, the container management device may copy the data to the read-write layer, and perform an adding or modifying operation for the data in the read-write layer according to the data operation request, generate corresponding incremental data in the read-write layer and the cloud storage system, and store the incremental data. If the data operation request is to delete the data in the read-only layer, the container management device may create the occlusion data for the data in the read-write layer, and further, implement hiding the data by using the occlusion data, and use the occlusion data as incremental data.
If the data operation request is a process for the existing incremental data in the read-write layer, one or more of adding, deleting and changing the existing incremental data is performed according to the data operation request, so as to obtain new incremental data corresponding to the data operation request.
In the scheme, the incremental data is stored in the read-write layer and the cloud storage system in response to the data operation request, so that the data operation request is processed. And the construction of the full data can be realized based on the incremental data and the data of the read-only authority in the read-only layer.
The container management method in the embodiment of the present disclosure will be further described by way of a specific example.
In this embodiment, the node agent in the container arrangement system mounts the cloud storage system to the host, and at this time, the cloud storage system may be a directory on the host. The root file system of the target container is generated through the container runtime. The root file system can be understood as a combined file system, a read-only layer in the root file system stores read-only mirror image data, a directory of a read-write layer in the root file system is a directory mounted by a cloud storage system, and data changes in a target container are synchronized to the cloud storage system in the form of incremental data in the read-write layer.
According to the container management scheme provided by the embodiment of the disclosure, when the container is operated, the mounting directory of the cloud storage system is designated as the directory of the read-write layer of the root file system during the assembly of the root file directory, the storage of the data in the writable layer of the root file system is subsequently carried out through the cloud storage system, and the incremental data is combined with the mirror image data in the read-only layer, so that the full storage of the target container data is realized.
Fig. 5 is a schematic structural diagram of a container management device according to some embodiments of the present disclosure, where the device may be implemented by software and/or hardware, and may be generally integrated in an electronic device. As shown in fig. 5, the container management apparatus includes:
the mounting module 501 is configured to mount a cloud storage system specified by a storage volume to a read-write layer in a root file system of a target container when the target container is started;
And the reservation module 502 is configured to perform a reservation operation on the read-write layer and incremental data in the cloud storage system in response to a deletion request for the target container, and re-mount the cloud storage system to the read-write layer of the root file system of the restarted target container after the target container is restarted.
In some embodiments of the present disclosure, mounting module 501 is configured to:
And when the target container is started by calling a container running tool, setting the directory of the read-write layer of the root file system of the target container as a mounting directory of the storage volume of the cloud storage system.
In some embodiments of the present disclosure, a retention module 502 is configured to:
acquiring a target directory of the read-write layer recorded in the annotation of the target container;
And if the target directory is determined to be the same as the mounting directory of the cloud storage system, determining that the cloud storage system is mounted to the read-write layer, and executing reservation operation on the read-write layer and the incremental data in the cloud storage system.
In some embodiments of the present disclosure, the container management apparatus further includes:
and the construction module is used for mounting the cloud storage system on a host machine of the target container before the target container is started, and constructing a root file system of the target container based on container running.
In some embodiments of the present disclosure, the container management apparatus further includes:
And the adding module is used for adding a reserved code in the deleting code of the target container, wherein the reserved code is used for not executing deleting operation on the increment data of the read-write layer when the target container is determined to be deleted.
In some embodiments of the present disclosure, the container management apparatus further includes:
And the storage module is used for responding to a data operation request for the target container after the cloud storage system is mounted to a read-write layer in a root file system of the target container when the target container is started, and storing incremental data corresponding to the data operation request in the read-write layer and the cloud storage system.
In some embodiments of the present disclosure, the delete request includes a migration request or a restart request, and the cloud storage system is a block storage cloud system.
The container management device provided by the embodiment of the disclosure can execute the container management method provided by any embodiment of the disclosure, and has the corresponding functional modules and beneficial effects of the execution method.
A computer program product comprising computer program/instructions which, when executed by a processor, implement the steps of the container management method described above
Fig. 6 is a schematic structural diagram of an electronic device according to some embodiments of the present disclosure.
Referring now in particular to fig. 6, a schematic diagram of an electronic device 600 suitable for use in implementing embodiments of the present disclosure is shown. The electronic device 600 in the embodiments of the present disclosure may include, but is not limited to, mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), car terminals (e.g., car navigation terminals), and the like, and stationary terminals such as digital TVs, desktop computers, and the like. The electronic device shown in fig. 6 is merely an example and should not be construed to limit the functionality and scope of use of the disclosed embodiments.
As shown in fig. 6, the electronic device 600 may include a processing means (e.g., a central processing unit, a graphics processor, etc.) 601, which may perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 602 or a program loaded from a storage means 608 into a Random Access Memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the electronic apparatus 600 are also stored. The processing device 601, the ROM 602, and the RAM 603 are connected to each other through a bus 604. An input/output (I/O) interface 605 is also connected to bus 604.
In general, the following devices may be connected to the I/O interface 605: input devices 606 including, for example, a touch screen, touchpad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, and the like; an output device 607 including, for example, a Liquid Crystal Display (LCD), a speaker, a vibrator, and the like; storage 608 including, for example, magnetic tape, hard disk, etc.; and a communication device 609. The communication means 609 may allow the electronic device 600 to communicate with other devices wirelessly or by wire to exchange data. While fig. 6 shows an electronic device 600 having various means, it is to be understood that not all of the illustrated means are required to be implemented or provided. More or fewer devices may be implemented or provided instead.
In particular, according to embodiments of the present disclosure, the processes described above with reference to flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a non-transitory computer readable medium, the computer program comprising program code for performing the method shown in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network via communication means 609, or from storage means 608, or from ROM 602. When executed by the processing device 601, the computer program performs the above-described functions defined in the container management method of the embodiment of the present disclosure.
It should be noted that the computer readable medium described in the present disclosure may be a computer readable signal medium or a computer readable storage medium, or any combination of the two. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples of the computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this disclosure, a computer-readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present disclosure, however, the computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, with the computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, fiber optic cables, RF (radio frequency), and the like, or any suitable combination of the foregoing.
In some embodiments, the clients, servers may communicate using any currently known or future developed network protocol, such as HTTP (HyperText Transfer Protocol ), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), the internet (e.g., the internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future developed networks.
The computer readable medium may be contained in the electronic device; or may exist alone without being incorporated into the electronic device.
The computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to: when a target container is started, mounting a cloud storage system appointed by a storage volume to a read-write layer in a root file system of the target container; and responding to the deleting request of the target container, executing a reservation operation on the read-write layer and the increment data in the cloud storage system, and re-mounting the cloud storage system to the read-write layer of the root file system of the restarted target container after the target container is restarted.
Computer program code for carrying out operations of the present disclosure may be written in one or more programming languages, including, but not limited to, an object oriented programming language such as Java, smalltalk, C ++ and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computer (for example, through the Internet using an Internet service provider).
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units involved in the embodiments of the present disclosure may be implemented by means of software, or may be implemented by means of hardware. Wherein the names of the units do not constitute a limitation of the units themselves in some cases.
The functions described above herein may be performed, at least in part, by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: a Field Programmable Gate Array (FPGA), an Application Specific Integrated Circuit (ASIC), an Application Specific Standard Product (ASSP), a system on a chip (SOC), a Complex Programmable Logic Device (CPLD), and the like.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. The machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
It will be appreciated that prior to using the technical solutions disclosed in the embodiments of the present disclosure, the user should be informed and authorized of the type of information, the scope of use, the use scenario, etc. related to the present disclosure in an appropriate manner according to relevant legal regulations.
The foregoing description is only of the preferred embodiments of the present disclosure and description of the principles of the technology being employed. It will be appreciated by persons skilled in the art that the scope of the disclosure referred to in this disclosure is not limited to the specific combinations of features described above, but also covers other embodiments which may be formed by any combination of features described above or equivalents thereof without departing from the spirit of the disclosure. Such as those described above, are mutually substituted with the technical features having similar functions disclosed in the present disclosure (but not limited thereto).
Moreover, although operations are depicted in a particular order, this should not be understood as requiring that such operations be performed in the particular order shown or in sequential order. In certain circumstances, multitasking and parallel processing may be advantageous. Likewise, while several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of the present disclosure. Certain features that are described in the context of separate embodiments can also be implemented in combination in a single embodiment. Conversely, various features that are described in the context of a single embodiment can also be implemented in multiple embodiments separately or in any suitable subcombination.
Although the subject matter has been described in language specific to structural features and/or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are example forms of implementing the claims.
Claims (11)
1. A method of container management, comprising:
When a target container is started, mounting a cloud storage system appointed by a storage volume to a read-write layer in a root file system of the target container;
And responding to the deleting request of the target container, executing a reservation operation on the read-write layer and the increment data in the cloud storage system, and re-mounting the cloud storage system to the read-write layer of the root file system of the restarted target container after the target container is restarted.
2. The method of claim 1, wherein mounting the storage volume specified cloud storage system to the read-write layer in the root file system of the target container at the time of target container startup comprises:
And when the target container is started by calling a container running tool, setting the directory of the read-write layer of the root file system of the target container as a mounting directory of the storage volume of the cloud storage system.
3. The method of claim 1, wherein performing a reservation operation on the read-write layer and incremental data in the cloud storage system comprises:
acquiring a target directory of the read-write layer recorded in the annotation of the target container;
And if the target directory is determined to be the same as the mounting directory of the cloud storage system, determining that the cloud storage system is mounted to the read-write layer, and executing reservation operation on the read-write layer and the incremental data in the cloud storage system.
4. The method of claim 1, wherein prior to the target container being started, the method further comprises:
And mounting the cloud storage system on a host machine of the target container, and constructing a root file system of the target container based on container running time.
5. The method according to claim 1, wherein the method further comprises:
And adding a reserved code in the deleting code of the target container, wherein the reserved code is used for not executing deleting operation on the increment data of the read-write layer when the target container is determined to be deleted.
6. The method of claim 1, wherein upon a target container startup, after mounting a cloud storage system to a read-write layer in a root file system of the target container, the method further comprises:
And responding to the data operation request of the target container, and storing incremental data corresponding to the data operation request in the read-write layer and the cloud storage system.
7. The method of claim 1, wherein the delete request comprises a migration request or a restart request, and wherein the cloud storage system is a block storage cloud system.
8. A method of container management, comprising:
the mounting module is used for mounting the cloud storage system appointed by the storage volume to a read-write layer in a root file system of the target container when the target container is started;
And the reservation module is used for responding to the deletion request of the target container, executing reservation operation on the read-write layer and the incremental data in the cloud storage system, and re-mounting the cloud storage system to the read-write layer of the root file system of the restarted target container after the target container is restarted.
9. An electronic device, the electronic device comprising:
a processor;
a memory for storing the processor-executable instructions;
The processor is configured to read the executable instructions from the memory and execute the instructions to implement the container management method of any one of the preceding claims 1-7.
10. A computer readable storage medium, characterized in that the storage medium stores a computer program for executing the container management method according to any one of the preceding claims 1-7.
11. A computer program product comprising computer programs/instructions which, when executed by a processor, implement the steps of the container management method of any of the preceding claims 1-7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202410311286.9A CN118132204A (en) | 2024-03-18 | 2024-03-18 | Container management method, device, equipment and medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202410311286.9A CN118132204A (en) | 2024-03-18 | 2024-03-18 | Container management method, device, equipment and medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN118132204A true CN118132204A (en) | 2024-06-04 |
Family
ID=91245343
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202410311286.9A Pending CN118132204A (en) | 2024-03-18 | 2024-03-18 | Container management method, device, equipment and medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN118132204A (en) |
-
2024
- 2024-03-18 CN CN202410311286.9A patent/CN118132204A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11740891B2 (en) | Providing access to a hybrid application offline | |
CN112965761B (en) | Data processing method, system, electronic equipment and storage medium | |
CN110851204B (en) | Application starting method and device and application packaging method and device | |
EP3884375B1 (en) | Accelerating application and sub-package installations | |
CN110688174A (en) | Container starting method, storage medium and electronic device | |
CN114625536B (en) | Video memory allocation method, device, medium and electronic equipment | |
CN116339756A (en) | Application program mounting method, device, equipment and storage medium | |
CN112131181B (en) | Display method and device of storage path and electronic equipment | |
CN113127430B (en) | Mirror image information processing method, mirror image information processing device, computer readable medium and electronic equipment | |
CN118132204A (en) | Container management method, device, equipment and medium | |
US20210373881A1 (en) | Memory efficient software patching for updating applications on computing devices | |
CN114297157B (en) | File processing method, device, equipment and medium | |
CN118132203A (en) | Container management method, device, equipment and medium | |
CN111831655B (en) | Data processing method, device, medium and electronic equipment | |
CN111381897B (en) | Interface calling method and device, mobile terminal and storage medium | |
CN115951903A (en) | Application deployment method and device | |
CN117633382A (en) | Page loading method and device, electronic equipment and computer readable medium | |
CN117130752A (en) | Data processing method and device and electronic equipment | |
CN116302047A (en) | Configuration file construction processing method, electronic equipment and storage medium | |
CN118672503A (en) | Heterogeneous computing power resource management system storage fusion method for object-oriented storage | |
CN117076407A (en) | Information processing method, device, terminal and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |