CN107015995B - Method and device for modifying mirror image file - Google Patents

Method and device for modifying mirror image file Download PDF

Info

Publication number
CN107015995B
CN107015995B CN201610058799.9A CN201610058799A CN107015995B CN 107015995 B CN107015995 B CN 107015995B CN 201610058799 A CN201610058799 A CN 201610058799A CN 107015995 B CN107015995 B CN 107015995B
Authority
CN
China
Prior art keywords
layer
modified
mirror
image
file
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.)
Active
Application number
CN201610058799.9A
Other languages
Chinese (zh)
Other versions
CN107015995A (en
Inventor
纪军
江洋洋
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CN201610058799.9A priority Critical patent/CN107015995B/en
Publication of CN107015995A publication Critical patent/CN107015995A/en
Application granted granted Critical
Publication of CN107015995B publication Critical patent/CN107015995B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/16File or folder operations, e.g. details of user interfaces specifically adapted to file systems

Abstract

The invention discloses a method and a device for modifying a mirror image file, which are used for modifying the mirror image file under the condition of avoiding adding redundant files and redundant layers. The embodiment of the invention provides a method for modifying an image file, which comprises the following steps: exporting the mirror image layer to be modified from the container; modifying the mirror image file to be modified, and storing the modified mirror image file to the mirror image layer to be modified so as to obtain the modified mirror image layer; and importing the modified mirror image layer into the container.

Description

Method and device for modifying mirror image file
Technical Field
The invention relates to the technical field of computers, in particular to a method and a device for modifying an image file.
Background
Computer virtualization technologies have long been known, ranging from hardware emulation to full virtualization, to para-virtualization and operating system virtualization, and a wide variety of technologies. Compared with full virtualization and semi-virtualization, a Container (English name: Container) is a lightweight virtualization technology at an operating system level, and technologies (such as Linux Namespace and Linux CGroup) depended by the Container bottom layer are completely kernel characteristics, have no middle layer overhead, have extremely high resource utilization rate, and have performance close to that of a physical machine.
The mirror (english name: Image) is a read-only template, such as: an image may comprise a complete operating system environment. The mirror image may be used to create a container. Containers are runtime instances of mirror creation that can be started, stopped, deleted, each container being a separate and secure platform. Containers provide an isolation environment for running programs, and the containers tightly control the resources that the programs therein can access. The creation and maintenance of the plurality of containers are all executed based on the image file, the image file is a file for storing container data, and the image file can be stored and migrated to other hosts for operation.
When the container is started, a writable layer (English name: lay) can be created as the uppermost layer, the image file is formed by a plurality of layers which are overlapped layer by layer, each layer realizes a specific function and contains specific components. In the application container engine Docker, each layer contains the image file of a specific component, some layers realize the configuration function, the image file of the upper layer covers the image file of the lower layer, in the file system in which the container finally operates, if the image file of the upper layer and the image file of the lower layer are simultaneously stored, the image file of the upper layer can be read or written, and the covered image file of the lower layer is read-only.
The method for modifying the image file provided by the prior art comprises the following steps: and adding a new layer on the topmost layer, adding an image file, modifying the image file or deleting the image file in the newly-built layer, submitting and storing the newly-added layer to a container, and realizing coverage updating. However, the inventor of the present invention finds at least the following problems in the prior art in the process of implementing the present invention: the prior art mirror file modification methods result in file redundancy and layer redundancy. And with the mirror image file being modified once, a new layer is added on the original layer, and Docker has limitation on the number of total layers, which easily leads to the saturation of the mirror image layer and leads to no further addition of a new layer.
Disclosure of Invention
The embodiment of the invention provides a method and a device for modifying a mirror image file, which are used for modifying the mirror image file under the condition of avoiding adding a redundant file and a redundant layer.
In order to solve the above technical problems, embodiments of the present invention provide the following technical solutions:
in a first aspect, an embodiment of the present invention provides a method for modifying an image file, including:
exporting the mirror image layer to be modified from the container;
modifying the mirror image file to be modified, and storing the modified mirror image file to the mirror image layer to be modified so as to obtain the modified mirror image layer;
and importing the modified mirror image layer into the container.
In the embodiment of the present invention, because the mirror layer to be modified is obtained by exporting the mirror layer from the container, and the modified mirror file is imported into the container through the modified mirror layer, the mirror file in the container can be modified, the mirror file is prevented from being modified by adding a new layer, and thus redundant files and redundant layers are not generated.
With reference to the first aspect, in a first possible implementation manner of the first aspect, the mirror layer to be modified includes: the first mirror image layer is located in a first mirror image layer, and the first mirror image file is a mirror image file to be modified;
the modifying the image file to be modified and saving the modified image file to the image layer to be modified so as to obtain the modified image layer includes:
and modifying the exported first image file in the first image layer to obtain the first image layer where the modified first image file is located, wherein the modified image layer is specifically the first image layer where the modified first image file is located.
In the above embodiment of the present invention, the first mirror layer is a mirror layer to be modified, and after the first mirror layer is exported, the first mirror file in the first mirror layer may be modified to generate the first mirror layer where the modified first mirror file is located, so that the mirror file is prevented from being modified by adding a new layer, and thus a redundant file and a redundant layer are not generated.
With reference to the first possible implementation manner of the first aspect, in a second possible implementation manner of the first aspect, the modifying the exported first image file in the first image layer to obtain a first image layer where the modified first image file is located includes:
decompressing all image files in the first image layer;
determining a first image file from all the image files decompressed in the first image layer;
modifying the first image file to obtain a modified first image file;
and storing the modified first image file into the first image layer, and compressing the first image layer in which the modified first image file is stored to obtain the first image layer in which the modified first image file is located.
In the above embodiment of the present invention, further, if the image file in the first image layer is compressed and stored, the first image file may be decompressed first and then modified, and the image file is compressed again after the modification is completed, so that the image file is prevented from being modified by a new layer adding manner, and thus a redundant file and a redundant layer are not generated.
With reference to the first aspect, in a third possible implementation manner of the first aspect, the mirror layer to be modified includes: the second mirror image layer is a mirror image layer to be deleted in the container, and the third mirror image layer is an adjacent mirror image layer positioned above the second mirror image layer in the container;
the modifying the image file to be modified and saving the modified image file to the image layer to be modified so as to obtain the modified image layer includes:
deleting the second mirror image layer from the derived mirror image layer to be modified, and modifying the parent-child layer relationship of the third mirror image layer into a fourth mirror image layer which is positioned below the second mirror image layer and is adjacent to the second mirror image layer so as to obtain a modified mirror image layer, wherein the modified mirror image layer comprises: and the relationship of the parent-child layer is modified to form a third mirror image layer.
In the embodiment of the present invention, because the second mirror layer and the third mirror layer are obtained by exporting the mirror layer from the container, the second mirror layer is deleted, the relationship between the parent layer and the child layer of the third mirror layer is modified, and the third mirror layer is reintroduced into the container, the modification of the mirror file in the container can be realized, the mirror file is prevented from being modified by adding a new layer, and thus, a redundant file and a redundant layer are not generated.
With reference to the third possible implementation manner of the first aspect, in a fourth possible implementation manner of the first aspect, the deleting the second mirror layer from the derived mirror layer to be modified includes:
and deleting all the image files and all the configuration information files included in the second image layer in the image layers to be modified.
In the above embodiment of the present invention, deleting the second mirror layer may be deleting all mirror files and all configuration information files in the second mirror layer, so as to avoid modifying the mirror files by adding a new layer, and thus, redundant files and redundant layers are not generated.
With reference to the first aspect, in a fifth possible implementation manner of the first aspect, the deriving, from the container, a mirror layer to be modified includes:
determining the position of a fifth mirror image layer needing to be added in the container;
deriving a sixth mirror layer from the container according to the position of the fifth mirror layer, the mirror layer to be modified comprising: the sixth mirror image layer is an adjacent mirror image layer located above the fifth mirror image layer in the container.
In the embodiment of the present invention, since the sixth mirror layer is obtained by exporting the mirror layer from the container, and the modified sixth mirror layer and the newly added fifth mirror layer are imported into the container, the mirror file in the container can be modified, and the mirror file is prevented from being modified by newly adding layers on all the original layers, so that redundant files and redundant layers are not generated.
With reference to the fifth possible implementation manner of the first aspect, in a sixth possible implementation manner of the first aspect, the modifying the image file to be modified, and saving the modified image file to the image layer to be modified so as to obtain the modified image layer includes:
modifying the parent-child layer relationship of the sixth mirror image layer into the fifth mirror image layer;
saving the sixth mirror image layer with the modified relationship between the fifth mirror image layer and the parent-child layer to the mirror image layer to be modified so as to obtain a modified mirror image layer, wherein the modified mirror image layer comprises: and the fifth mirror image layer and the sixth mirror image layer with the modified relationship between the parent layer and the child layer.
In the embodiment of the present invention, since the sixth mirror layer is obtained by exporting the mirror layer from the container, and the modified sixth mirror layer and the newly added fifth mirror layer are imported into the container, the mirror file in the container can be modified, and the mirror file is prevented from being modified by newly adding layers on all the original layers, so that redundant files and redundant layers are not generated.
With reference to the sixth possible implementation manner of the first aspect, in a seventh possible implementation manner of the first aspect, the modifying the image file to be modified, and saving the modified image file to the image layer to be modified so as to obtain the modified image layer further includes:
adding a mirror image file and a configuration information file in the fifth mirror image layer;
and configuring the parent-child layer relationship in the configuration information file of the fifth mirror image layer into a seventh mirror image layer which is positioned below the sixth mirror image layer and adjacent to the sixth mirror image layer in the container.
In the above embodiment of the present invention, an implementation manner of a newly added fifth mirror layer is described, so that a mirror layer can be newly added to a container, and a manner of modifying a mirror file by newly adding layers over all original layers is avoided, so that a redundant file and a redundant layer are not generated.
In a second aspect, an embodiment of the present invention further provides an apparatus for modifying an image file, including:
the layer export module is used for exporting the mirror image layer to be modified from the container;
the modification module is used for modifying the mirror image file to be modified and storing the modified mirror image file to the mirror image layer to be modified so as to obtain the modified mirror image layer;
a layer import module to import the modified mirror layer into the container.
In the embodiment of the present invention, because the mirror layer to be modified is obtained by exporting the mirror layer from the container, and the modified mirror file is imported into the container through the modified mirror layer, the mirror file in the container can be modified, the mirror file is prevented from being modified by adding a new layer, and thus redundant files and redundant layers are not generated.
With reference to the second aspect, in a first possible implementation manner of the second aspect, the mirror layer to be modified includes: the first mirror image layer is located in a first mirror image layer, and the first mirror image file is a mirror image file to be modified;
the modification module is specifically configured to modify the exported first image file in the first image layer to obtain a first image layer where the modified first image file is located, where the modified image layer is specifically the first image layer where the modified first image file is located.
In the above embodiment of the present invention, the first mirror layer is a mirror layer to be modified, and after the first mirror layer is exported, the first mirror file in the first mirror layer may be modified to generate the first mirror layer where the modified first mirror file is located, so that the mirror file is prevented from being modified by adding a new layer, and thus a redundant file and a redundant layer are not generated.
With reference to the first possible implementation manner of the second aspect, in a second possible implementation manner of the second aspect, the modifying module includes:
the decompression unit is used for decompressing all the image files in the first image layer;
the file determining unit is used for determining a first image file from all the image files decompressed in the first image layer;
the first file modification unit is used for modifying the first image file to obtain a modified first image file;
a file saving unit, configured to save the modified first image file into the first image layer,
and the compression unit is used for compressing the first mirror image layer in which the modified first mirror image file is stored to obtain the first mirror image layer in which the modified first mirror image file is located.
In the above embodiment of the present invention, further, if the image file in the first image layer is compressed and stored, the first image file may be decompressed first and then modified, and the image file is compressed again after the modification is completed, so that the image file is prevented from being modified by a new layer adding manner, and thus a redundant file and a redundant layer are not generated.
With reference to the second aspect, in a third possible implementation manner of the second aspect, the mirror layer to be modified includes: the second mirror image layer is a mirror image layer to be deleted in the container, and the third mirror image layer is an adjacent mirror image layer positioned above the second mirror image layer in the container;
the modification module includes: a layer deletion unit and a second file modification unit, wherein,
the layer deleting unit is used for deleting the second mirror image layer from the derived mirror image layer to be modified;
the second file modifying unit is configured to modify a parent-child layer relationship of the third mirror image layer into a fourth mirror image layer located below the second mirror image layer and adjacent to the second mirror image layer, so as to obtain a modified mirror image layer, where the modified mirror image layer includes: and the relationship of the parent-child layer is modified to form a third mirror image layer.
In the embodiment of the present invention, because the second mirror layer and the third mirror layer are obtained by exporting the mirror layer from the container, the second mirror layer is deleted, the relationship between the parent layer and the child layer of the third mirror layer is modified, and the third mirror layer is reintroduced into the container, the modification of the mirror file in the container can be realized, the mirror file is prevented from being modified by adding a new layer, and thus, a redundant file and a redundant layer are not generated.
With reference to the third possible implementation manner of the second aspect, in a fourth possible implementation manner of the second aspect, the layer deleting unit is specifically configured to delete all image files and all configuration information files included in a second image layer of the image layers to be modified.
In the above embodiment of the present invention, deleting the second mirror layer may be deleting all mirror files and all configuration information files in the second mirror layer, so as to avoid modifying the mirror files by adding a new layer, and thus, redundant files and redundant layers are not generated.
With reference to the second aspect, in a fifth possible implementation manner of the second aspect, the layer derivation module includes:
a layer determining unit, configured to determine a position of a fifth mirror layer that needs to be added in the container;
a layer derivation unit, configured to derive a sixth mirror layer from the container according to a position of the fifth mirror layer, where the mirror layer to be modified includes: the sixth mirror image layer is an adjacent mirror image layer located above the fifth mirror image layer in the container.
In the embodiment of the present invention, since the sixth mirror layer is obtained by exporting the mirror layer from the container, and the modified sixth mirror layer and the newly added fifth mirror layer are imported into the container, the mirror file in the container can be modified, and the mirror file is prevented from being modified by newly adding layers on all the original layers, so that redundant files and redundant layers are not generated.
With reference to the fifth possible implementation manner of the second aspect, in a sixth possible implementation manner of the second aspect, the modifying module includes: a third file modification unit and a layer modification unit, wherein,
the third file modification unit is configured to modify the parent-child layer relationship of the sixth mirror image layer into the fifth mirror image layer;
the layer modification unit is configured to store the sixth mirror layer with the modified relationship between the fifth mirror layer and the parent-child layer to the mirror layer to be modified, so as to obtain a modified mirror layer, where the modified mirror layer includes: and the fifth mirror image layer and the sixth mirror image layer with the modified relationship between the parent layer and the child layer.
In the embodiment of the present invention, since the sixth mirror layer is obtained by exporting the mirror layer from the container, and the modified sixth mirror layer and the newly added fifth mirror layer are imported into the container, the mirror file in the container can be modified, and the mirror file is prevented from being modified by newly adding layers on all the original layers, so that redundant files and redundant layers are not generated.
With reference to the sixth possible implementation manner of the second aspect, in a seventh possible implementation manner of the second aspect, the third file modifying unit is further configured to add an image file and a configuration information file in the fifth image layer; and configuring the parent-child layer relationship in the configuration information file of the fifth mirror image layer into a seventh mirror image layer which is positioned below the sixth mirror image layer and adjacent to the sixth mirror image layer in the container.
In the above embodiment of the present invention, an implementation manner of a newly added fifth mirror layer is described, so that a mirror layer can be newly added to a container, and a manner of modifying a mirror file by newly adding layers over all original layers is avoided, so that a redundant file and a redundant layer are not generated.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments will be briefly introduced below, and it is apparent that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art that other drawings can be obtained according to the drawings.
Fig. 1 is a schematic flowchart of a method for modifying an image file according to an embodiment of the present invention;
FIG. 2-a is a schematic flowchart of another method for modifying an image file according to an embodiment of the present invention;
FIG. 2-b is a schematic diagram of a modification process for modifying a single middle layer file according to an embodiment of the present invention;
FIG. 3-a is a schematic flowchart of another method for modifying an image file according to an embodiment of the present invention;
FIG. 3-b is a schematic diagram of a process for deleting a mirror layer according to an embodiment of the present invention;
FIG. 4-a is a schematic flowchart of another method for modifying an image file according to an embodiment of the present invention;
FIG. 4-b is a schematic diagram of a process for adding a mirror layer according to an embodiment of the present invention;
FIG. 5-a is a schematic diagram of a component structure of an apparatus for modifying an image file according to an embodiment of the present invention;
FIG. 5-b is a schematic diagram of a modification module according to an embodiment of the present invention;
FIG. 5-c is a schematic diagram of a structure of another modification module according to an embodiment of the present invention;
FIG. 5-d is a schematic diagram of a component structure of another apparatus for modifying an image file according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of a modifying apparatus for an image file according to an embodiment of the present invention.
Detailed Description
The embodiment of the invention provides a method and a device for modifying a mirror image file, which are used for modifying the mirror image file under the condition of avoiding adding a redundant file and a redundant layer.
In order to make the objects, features and advantages of the present invention more obvious and understandable, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention, and it is apparent that the embodiments described below are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments that can be derived by one skilled in the art from the embodiments given herein are intended to be within the scope of the invention.
The terms "first," "second," and the like in the description and in the claims, and in the drawings described above, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the terms so used are interchangeable under appropriate circumstances and are merely descriptive of the invention in its embodiments for distinguishing between objects of the same nature. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of elements is not necessarily limited to those elements, but may include other elements not expressly listed or inherent to such process, method, article, or apparatus.
The following are detailed below.
Referring to fig. 1, an embodiment of the method for modifying an image file according to the present invention may be applied to an open-source application container Docker, and the method for modifying an image file according to an embodiment of the present invention may include the following steps:
101. the mirror layer to be modified is derived from the container.
In the embodiment of the invention, a plurality of mirror image layers are arranged in the container, each mirror image layer is stored with a mirror image file, and when the mirror image files need to be modified, the mirror image layers to be modified are firstly exported from the container. The image layer to be modified can be determined according to the image file to be modified in the container, and the specific image file to be modified can be determined in a specific implementation scene. Further, the image layer to be modified may be determined according to a specific modification mode of the image file to be modified in the container, and a corresponding image file modification mode may be provided in a specific implementation scenario, and detailed description may be given for the specific modification mode of the image file in the subsequent embodiments.
102. And modifying the image file to be modified, and storing the modified image file to the image layer to be modified so as to obtain the modified image layer.
In an embodiment of the present invention, after exporting the mirror layer to be modified from the container, the predetermined mirror file to be modified may be modified, for example, the modifying of the mirror file may include: modifying the data content of the image file in the container, or deleting the image file in the container, or newly adding the image file in the container, and specifically describing different modification modes in the subsequent embodiments. When the modified image file is obtained after the modification of the image file to be modified is completed, the modified image file can be stored in the image layer to be modified so as to obtain a modified image layer, and the modified image layer is obtained by adding the modified image file to the image layer to be modified which is led out from the container. The modification of the mirror image file in the container in the embodiment of the invention is operated by exporting the mirror image layer from the container, and a layer is not required to be newly added on the original mirror image layer according to the prior art to store the modified mirror image file.
103. And importing the modified mirror image layer into the container.
In the embodiment of the present invention, the modified mirror layer is obtained in step 102, and the modified mirror layer includes the modified mirror file, and the modified mirror layer can be imported into the container only by determining compatibility of the upper interface and the lower interface of the modified layer, so that modification of the mirror files of a plurality of mirror layers in the container can be completed. The modification mode of the image file provided by the embodiment of the invention is to modify and then import the image layer after exporting the image layer from the container, and the mode is different from the mode of directly adding a new image layer in the prior art, so that redundant files and redundant layers are not brought.
As can be seen from the description of the embodiment of the present invention, the mirror layer to be modified is first exported from the container, the mirror file to be modified is then modified, the modified mirror file is saved in the mirror layer to be modified, so as to obtain the modified mirror layer, and finally the modified mirror layer is imported into the container. In the embodiment of the invention, the mirror image layer to be modified is acquired by exporting the mirror image layer from the container, and the modified mirror image file is imported into the container through the modified mirror image layer, so that the mirror image file in the container can be modified, the mirror image file is prevented from being modified in a way of adding a new layer, and redundant files and redundant layers are not generated.
Referring to fig. 2-a, the following describes an example of modifying data content of an image file to be modified, where the method for modifying an image file according to an embodiment of the present invention includes the following steps:
201. and exporting a first image layer where the first image file is located from the container, wherein the first image file is the image file to be modified.
In the embodiment of the present invention, taking a modification of the data content of the first image file in the container as an example, first determining that the image layer where the first image file is located is the first image layer, exporting the first image layer from the container, and then executing step 202.
202. And modifying the first image file in the exported first image layer to obtain the first image layer where the modified first image file is located, wherein the modified image layer is specifically the first image layer where the modified first image file is located.
In this embodiment of the present invention, the first mirror layer is a mirror layer to be modified, and after the first mirror layer is exported, the first mirror file in the first mirror layer may be modified to generate a first mirror layer where the modified first mirror file is located, so that the modified mirror layer in step 102 in the foregoing embodiment is specifically the first mirror layer where the modified first mirror file is located.
In some embodiments of the present invention, step 202 modifies the first image file in the exported first image layer to obtain a first image layer where the modified first image file is located, including:
a1, decompressing all image files in the first image layer;
a2, determining a first image file from all the image files decompressed in the first image layer;
a3, modifying the first image file to obtain a modified first image file;
and A4, saving the modified first image file into the first image layer, and compressing the first image layer in which the modified first image file is saved to obtain the first image layer in which the modified first image file is located.
And then, modifying and replacing the first image file by using the target file to obtain a modified first image file, storing the modified first image file to the first image layer, and packaging the modified first image layer. And importing the packaging modified first mirror image layer into the container to form a modified container. Referring to fig. 2-b, which is a schematic view of a modification process for modifying a single middle layer file according to an embodiment of the present invention, taking four mirror image layers established in a Docker container as an example, the mirror image files stored in the respective mirror image layers are respectively four different application programs, for example, the four application programs are respectively: debian, Samba, Vim and Apache, if the image file to be modified is Vim, a third image layer where the Vim is located can be exported from the Docker container, the image layer can be modified after the third image layer where the Vim is located is exported, and after layer modification is completed, the third image layer where the Vim is located is imported into the Docker container, so that modification of the Vim image file can be completed. According to the image file modification method in the prior art, a New image layer needs to be added on the uppermost layer (namely the fourth image layer where the Apache is located), and the newly added image layer is used for storing the New Vim image file, so that the Docker container comprises five image layers.
203. And importing the first image layer where the modified first image file is located into the container.
In the embodiment of the present invention, the first image layer where the modified first image file is located is obtained through step 202, and then the first image layer where the modified first image file is located is imported into the container, so that modification of the image file included in the image layer in the container can be completed. The modification mode of the image file provided by the embodiment of the invention is to modify and then import the image layer after exporting the image layer from the container, and the mode is different from the mode of directly adding a new image layer in the prior art, so that redundant files and redundant layers are not brought.
As can be seen from the description of the foregoing embodiment, in the embodiment of the present invention, the first mirror layer is obtained by exporting the mirror layer from the container, and the modified first mirror file is imported into the container through the modified first mirror layer, so that the mirror file in the container can be modified, the mirror file is prevented from being modified by adding a new layer, and thus a redundant file and a redundant layer are not generated.
Taking the example of deleting the image file to be modified from the container as an example, referring to fig. 3-a, the method for modifying an image file according to the embodiment of the present invention may include the following steps:
301. deriving from the container a mirror layer to be modified, the mirror layer to be modified comprising: the second mirror image layer is a mirror image layer to be deleted in the container, and the third mirror image layer is an adjacent mirror image layer positioned above the second mirror image layer in the container.
In the embodiment of the present invention, taking deletion of the second mirror layer in the container as an example, first determining the mirror layer to be modified includes: a second mirror image layer and a third mirror image layer, wherein the third mirror image layer and the second mirror image layer are two upper and lower mirror image layers which are positioned adjacently in the container, and the mirror image layer to be modified is derived from the container and then step 302 is executed.
302. Deleting the second mirror image layer from the derived mirror image layer to be modified, modifying the parent-child layer relationship of the third mirror image layer into a fourth mirror image layer which is positioned below the second mirror image layer and is adjacent to the second mirror image layer so as to obtain a modified mirror image layer, wherein the modified mirror image layer comprises: and the relationship of the parent-child layer is modified to form a third mirror image layer.
In this embodiment of the present invention, the second mirror layer and the third mirror layer are to-be-modified mirror layers, after the to-be-modified mirror layer is derived, the second mirror layer may be deleted from the derived to-be-modified mirror layer, and a relationship between a parent layer and a child layer of the third mirror layer is modified into a fourth mirror layer located below the second mirror layer and adjacent to the second mirror layer, so as to obtain the modified mirror layer, and then the modified mirror layer in step 102 in the foregoing embodiment specifically includes: and the relationship of the parent-child layer is modified to form a third mirror image layer. The third mirror image layer, the second mirror image layer and the fourth mirror image layer are upper and lower three mirror image layers which are adjacent in position in the container, and after the second mirror image layer between the third mirror image layer and the fourth mirror image layer is deleted, the third mirror image layer and the fourth mirror image layer form upper and lower two adjacent mirror image layers, and the relationship between the parent layer and the child layer of the third mirror image layer needs to be modified into the fourth mirror image layer. The mirror image layer to be modified derived from the container comprises: a second mirror layer and a third mirror layer, the modified mirror layer including only the third mirror layer, thereby completing deletion of the second mirror layer,
in some embodiments of the present invention, deleting the second mirror layer from the derived mirror layer to be modified in step 302 specifically includes the following steps:
and B1, deleting all image files and all configuration information files included in the second image layer in the image layers to be modified.
The deleting of the second image layer may be deleting all image files and all configuration information files in the second image layer. Next, the description will be given. For example, all layers of the mirror files in the whole container are exported from the container, then the second mirror layer to be deleted is found according to the layer configuration information, then the mirror files and the configuration information files of the second mirror layer are deleted, finally the configuration information files of the parent-child layer of the third mirror layer are modified, the correct parent-child layer relationship after deletion is configured, and the new container is formed by packaging. Referring to fig. 3-b, which is a schematic view of a process for deleting a mirror layer according to an embodiment of the present invention, taking four mirror layers established in a Docker container as an example, mirror files stored in the respective mirror layers are respectively four different application programs, for example, the four application programs are respectively: debian, Samba, Vim and Apache, if the mirror layer to be deleted is the mirror layer where Vim is located, all the mirror layers can be exported from the Docker container, the mirror layer where Vim is located can be deleted, after the layer deletion is completed, the parent-child layer relationship in the configuration information file of the mirror layer where Apache is located is reconfigured, the parent-child layer of the mirror layer where Apache is located is modified into the mirror layer where Samba is located, and the mirror layer where Apache is located is imported into the Docker container, so that the modification of the mirror layer where Vim is located can be completed. According to the image file modification method in the prior art, a new image layer needs to be added on the uppermost layer (namely the fourth image layer where the Apache is located), and the newly added image layer is used for storing deletion of the image layer where the Vim image file is located, so that the Docker container comprises five image layers.
303. And importing the third mirror image layer with the modified relationship of the parent layer and the child layer into the container.
In the embodiment of the present invention, the third mirror image layer with the modified parent-child layer relationship is obtained in step 302, and then the third mirror image layer with the modified parent-child layer relationship is imported into the container, so that the modification of the mirror image file included in the mirror image layer in the container can be completed. The modification mode of the image file provided by the embodiment of the invention is to modify and then import the image layer after exporting the image layer from the container, and the mode is different from the mode of directly adding a new image layer in the prior art, so that redundant files and redundant layers are not brought.
As can be seen from the description of the foregoing embodiment, in the embodiment of the present invention, the second mirror layer and the third mirror layer are obtained by exporting the mirror layer from the container, the second mirror layer is deleted, the relationship between the parent layer and the child layer of the third mirror layer is modified, and the third mirror layer is reintroduced into the container, so that the mirror file in the container can be modified, the mirror file is prevented from being modified by adding a new layer, and thus a redundant file and a redundant layer are not generated.
Referring to fig. 4-a, taking an example of adding an image file to be modified to a container as an example, a method for modifying an image file according to an embodiment of the present invention may include the following steps:
401. the location of the fifth mirror image layer that needs to be added in the container is determined.
402. Deriving the sixth mirror layer from the container according to the position of the fifth mirror layer, the mirror layer to be modified comprising: and the sixth mirror image layer is an adjacent mirror image layer positioned above the fifth mirror image layer in the container.
In the embodiment of the present invention, firstly, the mirror layer to be added in the container is defined as the fifth mirror layer, the position of the fifth mirror layer to be added may be determined according to the division manner of the service components, then, the sixth mirror layer is determined according to the position of the fifth mirror layer, the sixth mirror layer in the container is derived from the container by modifying the sixth mirror layer in the container into an example, and then step 403 is performed.
403. And modifying the parent-child layer relationship of the sixth mirror image layer into a fifth mirror image layer.
The parent-child layer relationship of the sixth mirror layer in the container describes that the next mirror layer adjacent to the sixth mirror layer before the fifth mirror layer is inserted, for example, the seventh mirror layer is located below the sixth mirror layer and adjacent to the sixth mirror layer, and if the fifth mirror layer is inserted below the sixth mirror layer, the parent-child layer relationship of the sixth mirror layer needs to be modified from the seventh mirror layer to the fifth mirror layer.
404. Saving the sixth mirror image layer with the modified relationship between the fifth mirror image layer and the parent-child layer to the mirror image layer to be modified so as to obtain the modified mirror image layer, wherein the modified mirror image layer comprises: and the relationship between the fifth mirror image layer and the parent-child layer is modified to form a sixth mirror image layer.
In this embodiment of the present invention, the sixth mirror layer is a mirror layer to be modified, and after the sixth mirror layer is derived, the sixth mirror layer whose relationship between the fifth mirror layer and the parent-child layer is modified may be stored in the mirror layer to be modified, so as to obtain the modified mirror layer, where the modified mirror layer in step 102 in the foregoing embodiment is specifically the sixth mirror layer whose relationship between the fifth mirror layer and the parent-child layer is modified.
In some embodiments of the present invention, the method for modifying an image file provided in the embodiments of the present invention may further include, in addition to steps 401 to 405, the following steps:
c1, adding mirror image files and configuration information files in the fifth mirror image layer;
and C2, configuring the parent-child layer relationship in the configuration information file of the fifth mirror layer into a seventh mirror layer which is positioned below and adjacent to the sixth mirror layer in the container.
The generation manner of the fifth mirror image layer is described in steps C1 to C2, and the mirror image file and the configuration information file may be added to the fifth mirror image layer, and then the configuration information file is modified, for example, the parent-child layer relationship in the configuration information file of the fifth mirror image layer is configured as a seventh mirror image layer located below and adjacent to the sixth mirror image layer in the container. Next, the description will be given. For example, the position of the added fifth mirror layer is determined, and is generally divided reasonably according to service components, all the mirror files of the new added layer are placed in the layer data, a layer configuration information file is newly created to describe the fifth mirror layer, then the upper and lower layer relations of the added layer are configured and configured in the layer information file, and the mirror files and the configuration information file of the added layer are packaged in the fifth mirror layer. And exporting the configuration information of the upper layer (namely, the sixth mirror image layer) of the added layer, and configuring the parent layer of the upper layer as the newly added layer. And introducing all the modified layers into the container, and repacking the layers to form a new container. Referring to fig. 4-b, which is a schematic view of a process for adding a mirror layer according to an embodiment of the present invention, taking three mirror layers established in a Docker container as an example, mirror files stored in the respective mirror layers are respectively three different application programs, for example, the three application programs are respectively: debian, Samba and Apache, if the mirror layer to be added is the mirror layer where the Vim is located, the mirror layer where the Vim to be added is between the mirror layer where the Samba is located and the mirror layer where the Apache is located, and the mirror layer where the Apache is located on the mirror layer where the Vim is located, the mirror layer where the Apache is located can be derived from the Docker container, the mirror layer where the Vim is located and the mirror layer where the Apache is located can be packaged, the parent-child layer relationship in the configuration information file of the mirror layer where the Apache is located is reconfigured, the parent-child layer of the mirror layer where the Apache is located in the original container is the mirror layer where the Samba is located, the parent-child layer of the mirror layer where the Apache is located is modified into the mirror layer where the Vim is located, and the mirror layer where the Apache is located and the mirror layer where the Vim is located are introduced into the Docker container, so that the increase of the mirror layer where the Vim is located can be completed. According to the image file modification method in the prior art, a new image layer needs to be added on the uppermost layer (namely the image layer where the Apache is located), the newly added image layer is used for storing the increase of the image layer where the Vim image file is located, so that the Docker container comprises four image layers, the total number of layers of the Docker container is continuously increased along with the multiple modifications of the Docker container, not only redundant files and redundant layers are brought, but also the total number of layers of the Docker container reaches the number of layers with the maximum limit, and the image file in the Docker container cannot be modified.
405. And importing the sixth mirror image layer with the modified relationship between the fifth mirror image layer and the parent-child layer into the container.
In the embodiment of the present invention, the sixth mirror image layer with the modified relationship between the fifth mirror image layer and the parent-child layer is obtained in step 404, and then the sixth mirror image layer with the modified relationship between the fifth mirror image layer and the parent-child layer is imported into the container, so that the modification of the mirror image file included in the mirror image layer in the container can be completed. The modification mode of the image file provided by the embodiment of the invention is to modify and then import the image layer after exporting the image layer from the container, and the mode is different from the mode of directly adding a new image layer in the prior art, so that redundant files and redundant layers are not brought.
As can be seen from the description of the foregoing embodiment, in the embodiment of the present invention, the sixth mirror layer is obtained by exporting the mirror layer from the container, and the modified sixth mirror layer and the newly added fifth mirror layer are imported into the container, so that the mirror file in the container can be modified, the mirror file is prevented from being modified by newly adding layers on all the original layers, and thus, a redundant file and a redundant layer are not generated.
It should be noted that, for simplicity of description, the above-mentioned method embodiments are described as a series of acts or combination of acts, but those skilled in the art will recognize that the present invention is not limited by the order of acts, as some steps may occur in other orders or concurrently in accordance with the invention. Further, those skilled in the art should also appreciate that the embodiments described in the specification are preferred embodiments and that the acts and modules referred to are not necessarily required by the invention.
To facilitate a better implementation of the above-described aspects of embodiments of the present invention, the following also provides relevant means for implementing the above-described aspects.
Referring to fig. 5-a, an apparatus 500 for modifying an image file according to an embodiment of the present invention is applied to a file system of a Docker container, where the apparatus 500 for modifying an image file includes: a layer export module 501, a modification module 502, and a layer import module 503, wherein,
a layer export module 501, configured to export a mirror layer to be modified from a container;
a modifying module 502, configured to modify the image file to be modified, and store the modified image file in the image layer to be modified, so as to obtain a modified image layer;
a layer import module 503, configured to import the modified mirror layer into the container.
In some embodiments of the invention, the mirror layer to be modified comprises: the first mirror image layer is located in a first mirror image layer, and the first mirror image file is a mirror image file to be modified;
the modifying module 502 is specifically configured to modify the exported first image file in the first image layer to obtain a first image layer where the modified first image file is located, where the modified image layer is specifically the first image layer where the modified first image file is located.
In some embodiments of the present invention, as shown in FIG. 5-b, the modification module 502 comprises:
a decompressing unit 5021, configured to decompress all the image files in the first image layer;
a file determining unit 5022, configured to determine a first image file from all the image files decompressed in the first image layer;
a first file modifying unit 5023, configured to modify the first image file to obtain a modified first image file;
a file saving unit 5024, configured to save the modified first image file into the first image layer,
the compressing unit 5025 is configured to compress the first image layer in which the modified first image file is stored, so as to obtain the first image layer in which the modified first image file is located.
In some embodiments of the invention, the mirror layer to be modified comprises: the second mirror image layer is a mirror image layer to be deleted in the container, and the third mirror image layer is an adjacent mirror image layer positioned above the second mirror image layer in the container;
as shown in fig. 5-c, the modification module 502 includes: a layer deleting unit 5026 and a second file modifying unit 5027, wherein,
the layer deleting unit 5026 is configured to delete the second mirror layer from the derived mirror layer to be modified;
the second file modifying unit 5027 is configured to modify a parent-child layer relationship of the third mirror layer into a fourth mirror layer located below and adjacent to the second mirror layer, so as to obtain a modified mirror layer, where the modified mirror layer includes: and the relationship of the parent-child layer is modified to form a third mirror image layer.
In some embodiments of the present invention, the layer deleting unit 5026 is specifically configured to delete all image files and all configuration information files included in a second image layer of the image layers to be modified.
In some embodiments of the present invention, as shown in fig. 5-d, the layer export module 501 comprises:
a layer determining unit 5011 for determining the position of a fifth mirror layer to be added in the container;
a layer derivation unit 5012, configured to derive a sixth mirror layer from the container according to a position of the fifth mirror layer, where the mirror layer to be modified includes: the sixth mirror image layer is an adjacent mirror image layer located above the fifth mirror image layer in the container.
Further, the modification module 502 includes: a third file modification unit 5028 and a layer modification unit 5029, wherein,
the third file modifying unit 5028 is configured to modify the parent-child layer relationship of the sixth mirror layer into the fifth mirror layer;
the layer modification unit 5029 is configured to save the sixth mirror layer after the relationship between the fifth mirror layer and the parent-child layer is modified to the mirror layer to be modified, so as to obtain a modified mirror layer, where the modified mirror layer includes: and the fifth mirror image layer and the sixth mirror image layer with the modified relationship between the parent layer and the child layer.
In some embodiments of the present invention, the third file modifying unit 5028 is further configured to add an image file and a configuration information file in the fifth image layer; and configuring the parent-child layer relationship in the configuration information file of the fifth mirror image layer into a seventh mirror image layer which is positioned below the sixth mirror image layer and adjacent to the sixth mirror image layer in the container.
It should be noted that, because the contents of information interaction, execution process, and the like between the modules/units of the apparatus are based on the same concept as the method embodiment of the present invention, the technical effect brought by the contents is the same as the method embodiment of the present invention, and specific contents may refer to the description in the foregoing method embodiment of the present invention, and are not described herein again.
As can be seen from the description of the foregoing embodiment, in the embodiment of the present invention, the first mirror layer is obtained by exporting the mirror layer from the container, and the modified first mirror file is imported into the container through the modified first mirror layer, so that the mirror file in the container can be modified, the mirror file is prevented from being modified by adding a new layer, and thus a redundant file and a redundant layer are not generated.
An embodiment of the present invention further provides a computer storage medium, where the computer storage medium stores a program, and the program executes some or all of the steps described in the above method embodiments.
Referring to fig. 6, a modification apparatus 600 for an image file according to another embodiment of the present invention includes:
a receiver 601, a transmitter 602, a processor 603 and a memory 604 (wherein the number of processors 603 in the image file modification apparatus 600 may be one or more, and one processor is taken as an example in fig. 6). In some embodiments of the present invention, the receiver 601, the transmitter 602, the processor 603 and the memory 604 may be connected by a bus or other means, wherein the connection by the bus is exemplified in fig. 6.
The memory 604 may include a read-only memory and a random access memory, and provides instructions and data to the processor 603. A portion of Memory 604 may also include Non-Volatile Random Access Memory (NVRAM). The memory 604 stores an operating system and operating instructions, executable modules or data structures, or a subset or an expanded set thereof, wherein the operating instructions may include various operating instructions for performing various operations. The operating system may include various system programs for implementing various basic services and for handling hardware-based tasks.
The processor 603 controls the operation of the image file modification device, and the processor 603 may also be called a Central Processing Unit (CPU). In a specific application, the components of the image file modification apparatus are coupled together by a bus system, wherein the bus system may include a power bus, a control bus, a status signal bus, and the like, in addition to a data bus. For clarity of illustration, the various buses are referred to in the figures as a bus system.
The method disclosed in the above embodiments of the present invention may be applied to the processor 603, or implemented by the processor 603. The processor 603 may be an integrated circuit chip having signal processing capabilities. In implementation, the steps of the above method may be performed by integrated logic circuits of hardware or instructions in the form of software in the processor 603. The processor 603 may be a general purpose processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Programmable Gate Array (FPGA), or other Programmable logic device, discrete Gate or transistor logic device, discrete hardware component. The various methods, steps and logic blocks disclosed in the embodiments of the present invention may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of the method disclosed in connection with the embodiments of the present invention may be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software modules in the decoding processor. The software module may be located in ram, flash memory, rom, prom, or eprom, registers, etc. storage media as is well known in the art. The storage medium is located in a memory 604, and the processor 603 reads the information in the memory 604 and performs the steps of the above method in combination with hardware thereof.
In this embodiment of the present invention, the processor 603 is configured to execute the method for modifying an image file described in any of the foregoing method embodiments.
As can be seen from the description of the foregoing embodiment, in the embodiment of the present invention, the first mirror layer is obtained by exporting the mirror layer from the container, and the modified first mirror file is imported into the container through the modified first mirror layer, so that the mirror file in the container can be modified, the mirror file is prevented from being modified by adding a new layer, and thus a redundant file and a redundant layer are not generated.
It should be noted that the above-described embodiments of the apparatus are merely schematic, where the units described as separate parts may or may not be physically separate, and the parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. In addition, in the drawings of the embodiment of the apparatus provided by the present invention, the connection relationship between the modules indicates that there is a communication connection between them, and may be specifically implemented as one or more communication buses or signal lines. One of ordinary skill in the art can understand and implement it without inventive effort.
Through the above description of the embodiments, those skilled in the art will clearly understand that the present invention may be implemented by software plus necessary general hardware, and may also be implemented by special hardware including special integrated circuits, special CPUs, special memories, special components and the like. Generally, functions performed by computer programs can be easily implemented by corresponding hardware, and specific hardware structures for implementing the same functions may be various, such as analog circuits, digital circuits, or dedicated circuits. However, the implementation of a software program is a more preferable embodiment for the present invention. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which is stored in a readable storage medium, such as a floppy disk, a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk of a computer, and includes instructions for enabling a computer device (which may be a personal computer, a server, or a network device) to execute the methods according to the embodiments of the present invention.
In summary, the above embodiments are only used for illustrating the technical solutions of the present invention, and not for limiting the same; although the present invention has been described in detail with reference to the above embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the above embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.

Claims (16)

1. A method for modifying an image file, comprising:
deriving a mirror layer to be modified from the Docker container;
modifying the image file to be modified in the image layer to be modified, and storing the modified image file to the image layer to be modified so as to obtain the modified image layer;
and importing the modified mirror image layer into the container.
2. The method of claim 1, wherein the mirror layer to be modified comprises: the first mirror image layer is located in a first mirror image layer, and the first mirror image file is a mirror image file to be modified;
the modifying the image file to be modified in the image layer to be modified and saving the modified image file to the image layer to be modified so as to obtain the modified image layer includes:
and modifying the exported first image file in the first image layer to obtain the first image layer where the modified first image file is located, wherein the modified image layer is specifically the first image layer where the modified first image file is located.
3. The method of claim 2, wherein modifying the exported first image file in the first image layer to obtain the first image layer where the modified first image file is located comprises:
decompressing all image files in the first image layer;
determining a first image file from all the image files decompressed in the first image layer;
modifying the first image file to obtain a modified first image file;
and storing the modified first image file into the first image layer, and compressing the first image layer in which the modified first image file is stored to obtain the first image layer in which the modified first image file is located.
4. The method of claim 1, wherein the mirror layer to be modified comprises: the second mirror image layer is a mirror image layer to be deleted in the container, and the third mirror image layer is an adjacent mirror image layer positioned above the second mirror image layer in the container;
the modifying the image file to be modified in the image layer to be modified and saving the modified image file to the image layer to be modified so as to obtain the modified image layer includes:
deleting the second mirror image layer from the derived mirror image layer to be modified, and modifying the parent-child layer relationship of the third mirror image layer into a fourth mirror image layer which is positioned below the second mirror image layer and is adjacent to the second mirror image layer so as to obtain a modified mirror image layer, wherein the modified mirror image layer comprises: and the relationship of the parent-child layer is modified to form a third mirror image layer.
5. The method of claim 4, wherein the deleting the second mirror layer from the derived mirror layer to be modified comprises:
and deleting all the image files and all the configuration information files included in the second image layer in the image layers to be modified.
6. The method of claim 1, wherein the deriving the mirror layer to be modified from the Docker container comprises:
determining the position of a fifth mirror image layer needing to be added in the container;
deriving a sixth mirror layer from the container according to the position of the fifth mirror layer, the mirror layer to be modified comprising: the sixth mirror image layer is an adjacent mirror image layer located above the fifth mirror image layer in the container.
7. The method according to claim 6, wherein the modifying the image file to be modified in the image layer to be modified and saving the modified image file to the image layer to be modified to obtain the modified image layer comprises:
modifying the parent-child layer relationship of the sixth mirror image layer into the fifth mirror image layer;
saving the sixth mirror image layer with the modified relationship between the fifth mirror image layer and the parent-child layer to the mirror image layer to be modified so as to obtain a modified mirror image layer, wherein the modified mirror image layer comprises: and the fifth mirror image layer and the sixth mirror image layer with the modified relationship between the parent layer and the child layer.
8. The method according to claim 7, wherein the modifying the image file to be modified in the image layer to be modified, and saving the modified image file to the image layer to be modified to obtain the modified image layer, further comprises:
adding a mirror image file and a configuration information file in the fifth mirror image layer;
and configuring the parent-child layer relationship in the configuration information file of the fifth mirror image layer into a seventh mirror image layer which is positioned below the sixth mirror image layer and adjacent to the sixth mirror image layer in the container.
9. An apparatus for modifying an image file, comprising:
the layer export module is used for exporting the mirror layer to be modified from the Docker container;
the modification module is used for modifying the mirror image file to be modified in the mirror image layer to be modified and storing the modified mirror image file to the mirror image layer to be modified so as to obtain the modified mirror image layer;
a layer import module to import the modified mirror layer into the container.
10. The apparatus of claim 9, wherein the mirror layer to be modified comprises: the first mirror image layer is located in a first mirror image layer, and the first mirror image file is a mirror image file to be modified;
the modification module is specifically configured to modify the exported first image file in the first image layer to obtain a first image layer where the modified first image file is located, where the modified image layer is specifically the first image layer where the modified first image file is located.
11. The apparatus of claim 10, wherein the modification module comprises:
the decompression unit is used for decompressing all the image files in the first image layer;
the file determining unit is used for determining a first image file from all the image files decompressed in the first image layer;
the first file modification unit is used for modifying the first image file to obtain a modified first image file;
a file saving unit, configured to save the modified first image file into the first image layer,
and the compression unit is used for compressing the first mirror image layer in which the modified first mirror image file is stored to obtain the first mirror image layer in which the modified first mirror image file is located.
12. The apparatus of claim 9, wherein the mirror layer to be modified comprises: the second mirror image layer is a mirror image layer to be deleted in the container, and the third mirror image layer is an adjacent mirror image layer positioned above the second mirror image layer in the container;
the modification module includes: a layer deletion unit and a second file modification unit, wherein,
the layer deleting unit is used for deleting the second mirror image layer from the derived mirror image layer to be modified;
the second file modifying unit is configured to modify a parent-child layer relationship of the third mirror image layer into a fourth mirror image layer located below the second mirror image layer and adjacent to the second mirror image layer, so as to obtain a modified mirror image layer, where the modified mirror image layer includes: and the relationship of the parent-child layer is modified to form a third mirror image layer.
13. The apparatus according to claim 12, wherein the layer deleting unit is specifically configured to delete all image files and all configuration information files included in a second image layer of the image layers to be modified.
14. The apparatus of claim 9, wherein the layer export module comprises:
a layer determining unit, configured to determine a position of a fifth mirror layer that needs to be added in the container;
a layer derivation unit, configured to derive a sixth mirror layer from the container according to a position of the fifth mirror layer, where the mirror layer to be modified includes: the sixth mirror image layer is an adjacent mirror image layer located above the fifth mirror image layer in the container.
15. The apparatus of claim 14, wherein the modification module comprises: a third file modification unit and a layer modification unit, wherein,
the third file modification unit is configured to modify the parent-child layer relationship of the sixth mirror image layer into the fifth mirror image layer;
the layer modification unit is configured to store the sixth mirror layer with the modified relationship between the fifth mirror layer and the parent-child layer to the mirror layer to be modified, so as to obtain a modified mirror layer, where the modified mirror layer includes: and the fifth mirror image layer and the sixth mirror image layer with the modified relationship between the parent layer and the child layer.
16. The apparatus according to claim 15, wherein the third file modifying unit is further configured to add an image file and a configuration information file in the fifth image layer; and configuring the parent-child layer relationship in the configuration information file of the fifth mirror image layer into a seventh mirror image layer which is positioned below the sixth mirror image layer and adjacent to the sixth mirror image layer in the container.
CN201610058799.9A 2016-01-28 2016-01-28 Method and device for modifying mirror image file Active CN107015995B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610058799.9A CN107015995B (en) 2016-01-28 2016-01-28 Method and device for modifying mirror image file

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610058799.9A CN107015995B (en) 2016-01-28 2016-01-28 Method and device for modifying mirror image file

Publications (2)

Publication Number Publication Date
CN107015995A CN107015995A (en) 2017-08-04
CN107015995B true CN107015995B (en) 2021-01-05

Family

ID=59439548

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610058799.9A Active CN107015995B (en) 2016-01-28 2016-01-28 Method and device for modifying mirror image file

Country Status (1)

Country Link
CN (1) CN107015995B (en)

Families Citing this family (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109542493A (en) * 2017-09-22 2019-03-29 华为技术有限公司 A kind of image upgrade method and apparatus
CN110196728B (en) * 2018-03-27 2023-07-25 腾讯科技(深圳)有限公司 Method and device for processing container of image upgrade
CN109325012A (en) * 2018-08-08 2019-02-12 国云科技股份有限公司 A method of modification virtual machine image subregion
CN110262873B (en) * 2019-05-17 2023-07-28 平安科技(深圳)有限公司 Configuration modification method and device for container application, computer equipment and storage medium
CN110569218B (en) * 2019-08-01 2021-11-23 厦门市美亚柏科信息股份有限公司 Offline modification method and device for EXT file system and storage medium
CN113495870A (en) * 2020-04-01 2021-10-12 北京沃东天骏信息技术有限公司 Mirror image construction method and device, electronic equipment and storage medium
CN111984368A (en) * 2020-07-28 2020-11-24 苏州浪潮智能科技有限公司 Component modification method, system, device and readable storage medium
CN112181597B (en) * 2020-10-12 2024-01-19 成都精灵云科技有限公司 Dynamic updating method for container resource use limit
CN112631737B (en) * 2021-01-08 2023-11-17 重庆紫光华山智安科技有限公司 Container mirror image construction method, device, electronic equipment and storage medium
CN113342378B (en) * 2021-06-25 2022-08-02 浪潮通用软件有限公司 Mirror image generation method, device and medium based on file system update

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103218248A (en) * 2013-03-25 2013-07-24 华为技术有限公司 Virtual machine mirror image updating method, server and desktop cloud system
CN104463012A (en) * 2014-11-24 2015-03-25 东软集团股份有限公司 Virtual machine image file exporting and importing method and device
CN105069353A (en) * 2015-08-11 2015-11-18 武汉大学 Security reinforcement method for credible container based on Docker
CN105187500A (en) * 2015-08-07 2015-12-23 浪潮(北京)电子信息产业有限公司 Container-based distributed storage system deployment method
CN105260184A (en) * 2015-10-15 2016-01-20 广东欧珀移动通信有限公司 Image recovery file debugging method and apparatus
CN105094924B (en) * 2015-08-21 2018-06-26 华为技术有限公司 The introduction method and device of image file

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20100120397A (en) * 2009-05-06 2010-11-16 주식회사 히타치엘지 데이터 스토리지 코리아 Selective mirror method

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103218248A (en) * 2013-03-25 2013-07-24 华为技术有限公司 Virtual machine mirror image updating method, server and desktop cloud system
CN104463012A (en) * 2014-11-24 2015-03-25 东软集团股份有限公司 Virtual machine image file exporting and importing method and device
CN105187500A (en) * 2015-08-07 2015-12-23 浪潮(北京)电子信息产业有限公司 Container-based distributed storage system deployment method
CN105069353A (en) * 2015-08-11 2015-11-18 武汉大学 Security reinforcement method for credible container based on Docker
CN105094924B (en) * 2015-08-21 2018-06-26 华为技术有限公司 The introduction method and device of image file
CN105260184A (en) * 2015-10-15 2016-01-20 广东欧珀移动通信有限公司 Image recovery file debugging method and apparatus

Also Published As

Publication number Publication date
CN107015995A (en) 2017-08-04

Similar Documents

Publication Publication Date Title
CN107015995B (en) Method and device for modifying mirror image file
US9703890B2 (en) Method and system that determine whether or not two graph-like representations of two systems describe equivalent systems
US11922046B2 (en) Erasure coded data within zoned drives
US9432301B2 (en) Defining disjoint node groups for virtual machines with pre-existing placement policies
JP2021509200A (en) Systems and methods for updating containers
US10558543B2 (en) Methods and systems that efficiently store and analyze multidimensional metric data
US10120893B1 (en) Storing data to content-addressable storage
US10592495B1 (en) Function-based object queries
KR102156439B1 (en) Cloud-edge system and method for processing data thereof
US10095699B2 (en) Computer-readable recording medium, execution control method, and information processing apparatus
US9824133B1 (en) Cloud analytics marketplace
US8813076B2 (en) Virtual machine updates
US9817592B1 (en) Using an intermediate virtual disk format for virtual disk conversion
US9882775B1 (en) Dependent network resources
US9699252B2 (en) Deployment of virtual machine disks from a shared network file system
CN104239122A (en) VM (virtual machine) migration method and device
US11509731B2 (en) Robotic cloud computing services arbitration using orchestrator of orchestrators
CN106775946A (en) A kind of virtual machine Method of Creation Process
US9712610B2 (en) System and method for increasing physical memory page sharing by workloads
CN107239309B (en) Patch generation method and device, updating method, electronic device and storage medium
US20210158131A1 (en) Hierarchical partitioning of operators
US10503718B2 (en) Parallel transfers of electronic data
CN113504918A (en) Equipment tree configuration optimization method and device, computer equipment and storage medium
US10437797B1 (en) In-memory distributed database with a remote data store
CN113296891A (en) Multi-scene knowledge graph processing method and device based on platform

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
GR01 Patent grant
GR01 Patent grant