[go: up one dir, main page]
More Web Proxy on the site http://driver.im/

CN110196728B - Method and device for processing container of image upgrade - Google Patents

Method and device for processing container of image upgrade Download PDF

Info

Publication number
CN110196728B
CN110196728B CN201810259793.7A CN201810259793A CN110196728B CN 110196728 B CN110196728 B CN 110196728B CN 201810259793 A CN201810259793 A CN 201810259793A CN 110196728 B CN110196728 B CN 110196728B
Authority
CN
China
Prior art keywords
layer
image
file
files
container
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
CN201810259793.7A
Other languages
Chinese (zh)
Other versions
CN110196728A (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.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen 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 Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN201810259793.7A priority Critical patent/CN110196728B/en
Publication of CN110196728A publication Critical patent/CN110196728A/en
Application granted granted Critical
Publication of CN110196728B publication Critical patent/CN110196728B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Facsimiles In General (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention provides a container processing method and device for image upgrading, wherein the method comprises the following steps: acquiring a first image before upgrading and a second image after upgrading; comparing the mirror image information of the first mirror image with the mirror image information of the second mirror image, and determining a deleting layer of the first mirror image relative to the second mirror image and/or an adding layer of the second mirror image relative to the first mirror image; comparing the file of each deleted layer in the first mirror image with the corresponding lower layer file, determining the file change state of each deleted layer, synchronously correcting the file state of the writable layer of the first container corresponding to the first mirror image according to the file change state of each deleted layer, and/or comparing the file of each added layer in the second mirror image with the corresponding lower layer file, determining the file change state of each added layer, and synchronously correcting the file state of the writable layer of the first container corresponding to the first mirror image according to the file change state of each added layer. Thereby, the efficiency of image upgrade is improved.

Description

Method and device for processing container of image upgrade
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method and an apparatus for processing a container for image upgrade.
Background
At present, the mirror image is composed of mirror image metadata and layer files, an operation file and a configuration environment of an application program are provided for a container, and before the container operates, the mirror image metadata and layer files need to be downloaded to a host machine in advance. Therefore, the container is used as a container virtualization technology, encapsulates the running environment of the process of the application program, isolates the system resources and provides a running environment which is not interfered with each other for a plurality of application programs. In this case, since the container is an operating instance based on an image, the upgrade of the application program is actually a process of opening a new container by the upgraded image.
In the related art, when the original image file is updated, a new container is required to be restarted by the new image file, and the corresponding application program is updated by running the new container, however, restarting a new container requires loading a large amount of data into the memory, which takes a long time, and thus results in lower image updating efficiency.
Disclosure of Invention
The invention provides a container processing method and device for image upgrading, which are used for solving the technical problem of low image upgrading efficiency in the prior art.
The first embodiment of the present invention provides an image upgrade processing method, including the steps of: acquiring a first image before upgrading and a second image after upgrading; comparing the image information of the first image with the image information of the second image, and determining a deleting layer of the first image relative to the second image and/or an adding layer of the second image relative to the first image; comparing the files of each deletion layer in the first mirror image with the corresponding lower layer files in a bottom-up sequence, determining the file change state of each deletion layer, synchronously correcting the file state of the writable layer of the first container corresponding to the first mirror image according to the file change state of each deletion layer, and/or comparing the files of each addition layer in the second mirror image with the corresponding lower layer files in a bottom-up sequence, determining the file change state of each addition layer, and synchronously correcting the file state of the writable layer of the first container corresponding to the first mirror image according to the file change state of each addition layer.
A second embodiment of the present invention provides an image upgrade processing apparatus, including: the acquisition module is used for acquiring the first image before upgrading and the second image after upgrading; the comparison and determination module is used for comparing the image information of the first image and the second image, and determining a deletion layer of the first image relative to the second image and/or an addition layer of the second image relative to the first image; and the correction module is used for comparing the files of each deletion layer in the first mirror image with the corresponding lower layer files in a sequence from bottom to top, determining the file change state of each deletion layer, synchronously correcting the file state of the writable layer of the first container corresponding to the first mirror image according to the file change state of each deletion layer, and/or comparing the files of each addition layer in the second mirror image with the corresponding lower layer files in a sequence from bottom to top, determining the file change state of each addition layer, and synchronously correcting the file state of the writable layer of the first container corresponding to the first mirror image according to the file change state of each addition layer.
A third embodiment of the present invention provides a computer apparatus including: the system comprises a memory, a processor and a computer program stored on the memory and capable of running on the processor, wherein the processor realizes the container processing method of image upgrading according to the embodiment when executing the computer program.
A fourth embodiment of the present invention provides a non-transitory computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements a container handling method of image upgrade as described in the above embodiments.
The technical scheme provided by the embodiment of the invention can have the following beneficial effects:
comparing the first image before upgrading with the second image after upgrading, determining a change layer of image upgrading, and further synchronously correcting a writable layer of the first container corresponding to the first image according to file upgrading operation of the change layer to generate the first container corresponding to the second image. Therefore, the image upgrading is realized on the basis of not pulling up a new container, the reloading of the related memory is avoided, and the image upgrading efficiency is improved.
Additional aspects and advantages of the invention will be set forth in part in the description which follows and, in part, will be obvious from the description, or may be learned by practice of the invention.
Drawings
The foregoing and/or additional aspects and advantages of the present invention will become apparent and may be better understood from the following description of embodiments with reference to the accompanying drawings, in which,
FIG. 1A is a schematic diagram of a mirrored file structure according to the prior art;
FIG. 1B is a schematic illustration of a container structure according to the prior art;
FIG. 1C is a schematic diagram of an upgraded image file according to one embodiment of the present invention;
FIG. 2 is a flow chart of a container handling method of image upgrades according to one embodiment of the invention;
FIG. 3 is a flow chart of a container handling method of image upgrades according to another embodiment of the present invention;
FIG. 4 is a schematic illustration of an application scenario of a container handling method of image upgrades according to yet another embodiment of the present invention;
FIG. 5 is a schematic illustration of an application scenario of a container handling method of image upgrades according to one embodiment of the present invention;
FIG. 6 is a schematic illustration of an application scenario of a container handling method for image upgrades according to another embodiment of the present invention;
FIG. 7 is a schematic diagram of a container handling apparatus for image upgrades according to one embodiment of the present invention.
Detailed Description
Embodiments of the present invention are described in detail below, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to like or similar elements or elements having like or similar functions throughout. The embodiments described below by referring to the drawings are illustrative and intended to explain the present invention and should not be construed as limiting the invention.
In order to make it easier for those skilled in the art to understand the image upgrade container processing method of the present invention, the prior art image and container will be described first.
The image is actually a file set for providing hierarchical files and configuration information for the running environment of the container, the image files are stored and updated in an increment through layering, and in some applications, the image files can be related files corresponding to a program package of an application program, for example, files with suffixes of. Bin,. Dfi and the like.
The container is a lightweight virtualized container technology, and the internal implementation details of the container are mirror files existing in a layered mode. Specifically, as shown in fig. 1A, the mirror image is a unified view of a stack of read-only layers, and referring to fig. 1A, a plurality of read-only layers are stacked together, and other layers except for the lowest layer have a pointer to the next layer, and these layers are implementation details inside the container (for convenience of description, only two layers of mirror image files are shown in the figure), and as shown in fig. 1B, the container is formed by adding a writable layer to all the mirror image layers, and this writable layer has a process running on the CPU.
When the container runs, all operations of the mirror image files can be finally embodied in a writable layer of the container, namely, files of the mirror image layer run sequentially from top to bottom, except for the lowest layer, repair of each layer can be embodied in an upper layer, and the files repaired in the upper layer can cover the files repaired in the lower layer. For example, when a bug exists in a file a in the layer a file shown in fig. 1B and needs to be repaired, the bug is implemented in a file a after repair in a layer B file in an upper layer, so that the file a after repair in the uppermost layer of the image file is reflected in a writable layer in the uppermost layer of the container, and the original file a is covered. When running on CPU, the function corresponding to the repaired file a is executed, and the function corresponding to the file a is updated.
Of course, all file operations of the mirror image file finally embodied in the writable layer of the container include, in addition to the above-mentioned file modification coverage, new addition and deletion of the file, for example, when the file B does not exist in the layer a shown in fig. 1B and appears in the layer B file in the upper layer, the newly added file B is embodied in the writable layer in the uppermost layer of the container, so that when running on the CPU, the function corresponding to the file B is also executed.
For another example, when the file c exists in the layer a shown in fig. 1B, and the file c does not appear in the layer B file in the upper layer, the deletion operation of the file c is embodied in the writable layer in the uppermost layer of the container, and the file c does not appear in the writable layer in the uppermost layer of the container, so that when the file c runs on the CPU, the function corresponding to the file c is not executed.
When an original image file in a container needs to be updated due to an upgrade of an application program or the like, a new image is often required to open a new container, and this image upgrade method takes a long time, and with continued reference to the above example, when the original image files need to be upgraded, for example, when the original image files a and B are upgraded to D, E and a shown in fig. 1C, the new container needs to be pulled up again, all the memory in the original container is destroyed, and resources are built in the new container, for example, the data already loaded in the memory when the original container runs is reloaded, so that the upgrade efficiency of the image file is low.
According to the invention, according to the internal operation details of the container, the operation of the writable layer at the uppermost layer of the container is adopted to realize the hot upgrading on the image file without pulling up the new container, and the memory data loaded in the original container is reserved without being loaded again, so that the upgrading efficiency of the image file is greatly improved.
Specifically, FIG. 2 is a flow chart of a container handling method of image upgrades according to one embodiment of the present invention, as shown in FIG. 2, the method comprising the steps of:
step 101, acquiring a first image before upgrading and a second image after upgrading.
Step 102, comparing the image information of the first image and the second image to determine a deleted layer of the first image relative to the second image, and/or an added layer of the second image relative to the first image.
Step 103, comparing the files of each deletion layer in the first mirror image with the corresponding lower layer files according to the sequence from bottom to top, determining the file change state of each deletion layer, and synchronously correcting the file state of the writable layer of the first container corresponding to the first mirror image according to the file change state of each deletion layer, and/or,
and comparing the files of each added layer in the second mirror image with the corresponding lower layer files according to the sequence from bottom to top, determining the file change state of each added layer, and synchronously correcting the file state of the writable layer of the first container corresponding to the first mirror image according to the file change state of each added layer.
In the embodiment of the invention, the first image before upgrading and the second image after upgrading are compared, the change layer of the image upgrading is determined, after the change layer is found, the file upgrading operation of the change layer is carried out, and the correction is carried out in the original first container corresponding to the first image, so that the updating from the first container to the container corresponding to the second image is realized, the updating is based on the original first container, a new container is not required to be pulled up again, the upgrading efficiency is high, and the operability is strong.
In order to more intuitively describe the container processing method for image upgrade according to the embodiment of the present invention, the following is exemplified in conjunction with a specific scenario, which is described as follows:
in this scenario, as shown in fig. 4, the file layer included in the first image is A, B, C, D, E, the read-write layer of the first container corresponding to the first image is Z1 layer, the updated file layer included in the second image is A, B, C, F, G, and according to the comparison of the layer files of the first image and the second image, the deleted layer of the first image relative to the second image is D, E layer, and the added layer of the second image relative to the first image is F, G layer. It should be noted that, the image upgrading change layer includes a deletion layer of the second image corresponding to the first image and an addition layer of the second image corresponding to the first image, and in different application scenarios, the ways of determining the image upgrading change layer are different, which are illustrated as follows:
first example:
in this example, the change layer is obtained by layer-by-layer comparison of the first mirror image and the second mirror image.
As shown in fig. 3, the step 101 includes:
step 201, respectively obtaining layer identifiers of each layer of the first mirror image and the second mirror image.
Step 202, comparing the layer identifiers of the first mirror image and the second mirror image, and judging whether the layer identifiers of the first mirror image and the second mirror image are the same.
Step 203, if it is determined that there is a different layer identifier between the first image and the second image, deleting the layer of the first image relative to the second image, and/or adding the layer of the second image relative to the first image.
The interlayer identification is used for identifying the uniqueness of each layer of the mirror image, and the interlayer identification can be an interlayer ID (identity) of a fixed-bit number such as a two-level system code, a hexadecimal code and the like, or can be a name identification or an icon identification which adopts characters or icons and the like and can realize interlayer distinction.
In this embodiment, each layer identifier of the first image file and each layer identifier of the second image file are obtained respectively, the layer identifiers of each layer of the first image file and each layer of the second image file are compared, whether the layer identifiers of each layer of the first image file and each layer of the second image file are identical is determined, if it is determined that different layer identifiers exist between the first image file and the second image file, a change layer of an image upgrade is determined according to the different layer identifiers, where the different layer identifiers correspond to different layer identifiers, and the different layer identifiers include an interlayer identifier that is included in the first image file and is not included in the second image file (i.e., a deleted layer of the first image file relative to the second image file), or an interlayer identifier that is included in the first image file and is not included in the second image file (i.e., an added layer of the second image file relative to the first image file).
A second example:
in this example, the containing files between the layers of the first image and the second image are compared, and when there are layers in which the containing files are not identical, the layer is determined as a changed layer of the image upgrade.
Further, the file upgrading operation corresponding to the change layer of the image file includes two aspects of deleting an original layer in the original image file and adding a new layer of a new image file, and the file upgrading operation is focused on the two aspects, and the implementation process of synchronously correcting the writable layer of the first container corresponding to the first image according to the file upgrading operation of the change layer is described in detail.
On the one hand, the files of each deletion layer in the first mirror image are compared with the corresponding lower layer files according to the sequence from bottom to top, the file change state of each deletion layer is determined, and the file state of the writable layer of the first container corresponding to the first mirror image is synchronously corrected according to the file change state of each deletion layer.
It can be understood that in this embodiment, when some layer files in the first image are deleted by the second image, it is indicated that the new application scenario no longer needs the functions implemented by the original layer files, so that the operations of restoring the original deleted layer files, as known from the foregoing analysis, the operations of the upper layer files on the lower layer files include updating, deleting and adding the files, so that the operations of restoring the original N layer files are updating, recovering, adding and deleting the files correspondingly.
In one embodiment of the present invention, the files of each deletion layer in the first image are compared with the corresponding lower layer files in the order from bottom to top, and if the comparison knows that the first files existing in the current deletion layer also exist in the corresponding lower layer files at the same time, the first files existing in the lower layer files closest to the current deletion layer are copied to the writable layer of the first container.
In this example, if the first file existing in the current delete layer has already been deleted and the file exists in the lower layer file, this indicates that the delete layer is no longer required to operate on the first file in the updated second image, thereby restoring the first file to the last first file before processing in the delete layer. In one embodiment of the present invention, the files of each deletion layer in the first image are compared with the corresponding lower layer files in the order from bottom to top, and if the comparison knows that the second file existing in the current deletion layer does not exist in the corresponding lower layer files, the second file is deleted from the writable layer of the first container.
In this example, if the second file existing in the current deletion layer is deleted and the file does not exist in the lower layer file, it indicates that the function corresponding to the second file in the deletion layer is no longer needed in the updated second image, and thus, the second file is directly deleted from the writable layer of the first container.
In one embodiment of the present invention, the files of each deletion layer in the first image are compared with the corresponding lower layer files in the order from bottom to top, and if the comparison knows that the third file which does not exist in the current deletion layer exists in the corresponding lower layer files, the third file closest to the current deletion layer is copied to the writable layer of the first container.
In this example, if the third file that does not exist in the current deletion layer exists in the lower layer file, it indicates that the function corresponding to the third file deleted in the deletion layer is needed in the updated second image, and thus, the third file closest to the current deletion layer is copied to the writable layer of the first container.
Thus, the influence of the deletion layer on the operation of the file is eliminated, the lower layer file deleted by the deletion layer is added, the file added by the deletion layer is deleted, the lower layer file covered by the deletion layer is restored to the previous lower layer file, and the like.
For example, as shown in the left diagram of fig. 5, the first image includes 3-layer files A, B, C, and when the delete layer is the layer 3 layer C of the first image, the files in the layer 3 of the first image are a, g, the files in the layer 2 are a, C, and the files in the layer 1 are a, as shown in the second image. Comparing the files in the 3 rd layer with the files in the 1 st layer of the 2 nd layer, and comparing the first files a to be simultaneously present in the lower layer files, copying the first files a present in the lower layer files closest to the 3 rd layer to the writable layer of the first container, thereby eliminating the covering operation of the 3 rd layer on the files a in the updated first container as shown in the right graph of fig. 5.
If the comparison shows that the second file g existing in the 3 rd layer is not existing in the lower layer file, the second file g is deleted from the writable layer of the first container, so that the adding operation of the 3 rd layer to the file g is eliminated in the updated first container as shown in the right diagram of fig. 5.
If the comparison knows that the third file c which does not exist in the 3 rd layer exists in the lower layer file, the third file c which exists in the lower layer file is copied to the writable layer of the first container. Thus, as shown in the right diagram of fig. 5, the deletion operation of the file c by the layer 3 is eliminated in the updated first container.
And on the other hand, comparing the files of each added layer in the second mirror image with the corresponding lower layer files according to the sequence from bottom to top, determining the file change state of each added layer, and synchronously correcting the file state of the writable layer of the first container corresponding to the first mirror image according to the file change state of each added layer.
In one embodiment of the present invention, the files of each added layer in the second image are compared with the corresponding lower layer files in the order from bottom to top, and if the comparison knows that the fourth file existing in the current added layer also exists in the corresponding lower layer files at the same time, the fourth file existing in the current added layer is copied to the writable layer of the first container.
In this example, if the fourth file existing in the current added layer exists in the lower layer file, it indicates that the updated second image needs to be updated by the added layer, so that the fourth file existing in the current added layer is copied to the writable layer of the first container to overwrite the original fourth file.
In one embodiment of the present invention, the files of each added layer in the second image are compared with the corresponding lower layer files in a bottom-up order, and if the comparison knows that the fifth file existing in the current added layer does not exist in the corresponding lower layer files, the fifth file is copied to the writable layer of the first container.
In this example, if the fifth file existing in the current adding layer is not existing in the lower layer file, it indicates that the function operation corresponding to the fifth file needs to be added in the updated second image, so that the fifth file existing in the current adding layer is copied to the writable layer of the first container to add the function corresponding to the fifth file.
In one embodiment of the present invention, the files of each added layer in the second image are compared with the corresponding lower layer files in a bottom-up order, and if the comparison knows that the sixth file which does not exist in the current added layer exists in the corresponding lower layer files, the sixth file is deleted from the writable layer of the first container.
In this example, if the sixth file that does not exist in the current added layer exists in the lower layer file, it indicates that the function operation corresponding to the sixth file needs to be deleted in the updated second image, so that the sixth file that does not exist in the current added layer is deleted from the writable layer of the first container, so as to delete the function corresponding to the sixth file.
Thus, the influence of the added layer on the operation of the file is added, the lower layer file deleted by the added layer is deleted, the file added by the added layer is added, and the lower layer file updated by the added layer is covered.
For example, as shown in the left diagram of fig. 6, when the added layer is the layer 3D layer in the second mirror image, the files in the layer 3D layer are a, h, the files in the layer 2 are a, c, and the files in the layer 1 are a. Comparing the files in the 3 rd layer with the files in the 1 st layer of the 2 nd layer, and comparing the fourth file a to exist in the lower layer files at the same time, copying the fourth file a to the writable layer of the first container, thereby, as shown in the right diagram of fig. 6, adding the coverage operation of the 3 rd layer D layer to the file a in the updated first container.
If the fifth file h existing in the 3 rd layer is not existing in the lower layer file, the fifth file h is copied from the writable layer of the first container, so that the adding operation of the newly added 3 rd layer D layer to the fifth file h is embodied in the updated first container as shown in the right diagram of fig. 6.
If the comparison knows that the sixth file c which does not exist in the 3 rd layer exists in the lower layer file, deleting the sixth file which exists in the lower layer file, thereby deleting the writable layer of the first container. Thus, in the updated first container, the deletion operation of the sixth file c by the newly added layer file of the D layer is embodied.
In order to more fully describe the implementation process of the container processing method for image upgrading of the present invention, a specific application scenario is described below, where, with continued reference to fig. 4, deleted layer files in the first image are two layers E and D, and newly added layer files in the second image are two layers G and F. The first image is the old image and the second image is the new image, the writable layer in the first container being denoted by Z.
Specifically, referring to fig. 4, the layer IDs of the old and new images are acquired first, and the layer IDs of the old and new images are compared to find out the difference. The above figures illustrate examples where the difference is in two layers E, D for the old image and G, F for the new image.
The influence of the extra layers (E and D) of the old mirror image is eliminated, and the method specifically comprises the following steps: starting processing from the layer D, for the newly added and modified files in the layer D, sequentially searching the files in the layers C, B and A below, and if the files can be found, indicating that the files are modified, copying the found files in the lower layer to the layer Z1 of the old container; if it cannot be found, indicating that the file is newly added, it is necessary to delete the file at the Z1 level of the old container. For the deleted files in the layer D, the deleted files need to be sequentially searched in the layers C, B and A, and the found files in the lower layer need to be copied to the layer Z1 of the old container after the files are found. After the D layer is processed, the E layer or higher layer contents are processed in the same way in turn.
Synchronizing the layers (G, F layers) of the new image and the older image to the Z1 layer of the old container, specifically: processing from the F layer, and directly copying the newly added and modified files in the F layer to the Z1 layer of the old container; for the file deleted in layer F, the file is deleted directly in layer Z1 of the old container. After the F layer is processed, the G layer or higher layer contents are processed in the same way in turn. Thus, after all the difference files are written into the Z1 layer of the old container, a new container is formed, and the writable layer in the new container is Z2.
In summary, in the method for processing the container for upgrading the image, the first image before upgrading and the second image after upgrading are compared, the change layer of the image upgrading is determined, and then the writable layer of the first container corresponding to the first image is synchronously corrected according to the file upgrading operation of the change layer, so that the updated first container corresponding to the second image is generated. Therefore, the image upgrading is realized on the basis of not pulling up a new container, the reloading of the related memory is avoided, and the image upgrading efficiency is improved.
In order to implement the above embodiment, the present invention further proposes a container processing device for image upgrade, and fig. 7 is a schematic structural diagram of a container image upgrade processing device according to an embodiment of the present invention, and as shown in fig. 7, the container processing device for image upgrade includes an obtaining module 100, a comparing and determining module 200, and a modifying module 300.
The acquiring module 100 is configured to acquire a first image before upgrading and a second image after upgrading.
The comparison determining module 200 is configured to compare the image information of the first image and the second image, and determine a deleted layer of the first image relative to the second image, and/or an added layer of the second image relative to the first image.
The correction module 300 is configured to compare the file of each deletion layer in the first image with the corresponding lower layer file in the order from bottom to top, determine a file change state of each deletion layer, and perform synchronous correction on the file state of the writable layer of the first container corresponding to the first image according to the file change state of each deletion layer, and/or,
and comparing the files of each added layer in the second mirror image with the corresponding lower layer files according to the sequence from bottom to top, determining the file change state of each added layer, and synchronously correcting the file state of the writable layer of the first container corresponding to the first mirror image according to the file change state of each added layer.
It should be noted that the foregoing explanation of the embodiment of the image upgrading container processing method is also applicable to the image upgrading container processing device of this embodiment, and the implementation principle is similar, which is not repeated herein.
In summary, the image-upgraded container processing device of the present invention compares the first image before upgrading and the second image after upgrading to determine the change layer of the image upgrading, and further, according to the file upgrading operation of the change layer, synchronously corrects the writable layer of the first container corresponding to the first image to generate the updated first container corresponding to the second image. Therefore, the image upgrading is realized on the basis of not pulling up a new container, the reloading of the related memory is avoided, and the image upgrading efficiency is improved.
In order to implement the above embodiment, the present invention also proposes a computer device including: memory, a processor and a computer program stored on the memory and executable on the processor, which when executing the program, implements the container handling method of image upgrades as described in the above embodiments.
In order to achieve the above-described embodiments, the present invention also proposes a non-transitory computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements a container processing method of image upgrade as described in the above-described embodiments.
In the description of the present specification, a description referring to terms "one embodiment," "some embodiments," "examples," "specific examples," or "some examples," etc., means that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the present invention. In this specification, schematic representations of the above terms are not necessarily directed to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. Furthermore, the different embodiments or examples described in this specification and the features of the different embodiments or examples may be combined and combined by those skilled in the art without contradiction.
Furthermore, the terms "first," "second," and the like, are used for descriptive purposes only and are not to be construed as indicating or implying a relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defining "a first" or "a second" may explicitly or implicitly include at least one such feature. In the description of the present invention, the meaning of "plurality" means at least two, for example, two, three, etc., unless specifically defined otherwise.
Any process or method descriptions in flow charts or otherwise described herein may be understood as representing modules, segments, or portions of code which include one or more executable instructions for implementing specific logical functions or steps of the process, and additional implementations are included within the scope of the preferred embodiment of the present invention in which functions may be executed out of order from that shown or discussed, including substantially concurrently or in reverse order from that shown or discussed, depending on the functionality involved, as would be understood by those reasonably skilled in the art of the embodiments of the present invention.
Logic and/or steps represented in the flowcharts or otherwise described herein, e.g., a ordered listing of executable instructions for implementing logical functions, can be embodied in any computer-readable medium for use by or in connection with an instruction execution system, apparatus, or device, such as a computer-based system, processor-containing system, or other system that can fetch the instructions from the instruction execution system, apparatus, or device and execute the instructions. For the purposes of this description, a "computer-readable medium" can be any means that can contain, store, communicate, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device. More specific examples (a non-exhaustive list) of the computer-readable medium would include the following: an electrical connection (electronic device) having one or more wires, a portable computer diskette (magnetic device), a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disc read-only memory (CDROM). In addition, the computer readable medium may even be paper or other suitable medium on which the program is printed, as the program may be electronically captured, via, for instance, optical scanning of the paper or other medium, then compiled, interpreted or otherwise processed in a suitable manner, if necessary, and then stored in a computer memory.
It is to be understood that portions of the present invention may be implemented in hardware, software, firmware, or a combination thereof. In the above-described embodiments, the various steps or methods may be implemented in software or firmware stored in a memory and executed by a suitable instruction execution system. As with the other embodiments, if implemented in hardware, may be implemented using any one or combination of the following techniques, as is well known in the art: discrete logic circuits having logic gates for implementing logic functions on data signals, application specific integrated circuits having suitable combinational logic gates, programmable Gate Arrays (PGAs), field Programmable Gate Arrays (FPGAs), and the like.
Those of ordinary skill in the art will appreciate that all or a portion of the steps carried out in the method of the above-described embodiments may be implemented by a program to instruct related hardware, where the program may be stored in a computer readable storage medium, and where the program, when executed, includes one or a combination of the steps of the method embodiments.
In addition, each functional unit in the embodiments of the present invention may be integrated in one processing module, or each unit may exist alone physically, or two or more units may be integrated in one module. The integrated modules may be implemented in hardware or in software functional modules. The integrated modules may also be stored in a computer readable storage medium if implemented in the form of software functional modules and sold or used as a stand-alone product.
The above-mentioned storage medium may be a read-only memory, a magnetic disk or an optical disk, or the like. While embodiments of the present invention have been shown and described above, it will be understood that the above embodiments are illustrative and not to be construed as limiting the invention, and that variations, modifications, alternatives and variations may be made to the above embodiments by one of ordinary skill in the art within the scope of the invention.

Claims (10)

1. A method of processing an image upgraded container, comprising the steps of:
acquiring a first image before upgrading and a second image after upgrading;
comparing the image information of the first image with the image information of the second image, and determining a deleting layer of the first image relative to the second image and/or an adding layer of the second image relative to the first image;
comparing the files of each deletion layer in the first mirror image with the corresponding lower layer files in a sequence from bottom to top, determining the file change state of each deletion layer, and synchronously correcting the file state of the writable layer of the first container corresponding to the first mirror image according to the file change state of each deletion layer, and/or,
comparing the files of each added layer in the second mirror image with the corresponding lower layer files according to the sequence from bottom to top, determining the file change state of each added layer, and synchronously correcting the file state of the writable layer of the first container corresponding to the first mirror image according to the file change state of each added layer;
comparing the files of each deletion layer in the first mirror image with the corresponding lower layer files in a sequence from bottom to top, determining the file change state of each deletion layer, and synchronously correcting the file state of the writable layer of the first container corresponding to the first mirror image according to the file change state of each deletion layer, wherein the method comprises the following steps:
and comparing the files of each deleting layer in the first mirror image with the corresponding lower layer files in a sequence from bottom to top, and if the comparison shows that the first files existing in the current deleting layer also exist in the corresponding lower layer files at the same time, copying the first files existing in the lower layer files closest to the current deleting layer to the writable layer of the first container.
2. The method of claim 1, wherein comparing the image information of the first image and the second image, determining a deletion layer of the first image relative to the second image, and/or adding a layer of the second image relative to the first image, comprises:
layer identifiers of layers of the first mirror image and the second mirror image are respectively obtained,
comparing the layer identifiers of the layers of the first mirror image and the second mirror image, and judging whether the layer identifiers of the layers of the first mirror image and the second mirror image are the same;
if judging that different layer identifiers exist between the first image and the second image, determining a deleted layer of the first image relative to the second image and/or an added layer of the second image relative to the first image according to the different layer identifiers.
3. The method of claim 1, wherein comparing the file of each deletion layer in the first image with the corresponding lower layer file in the order from bottom to top, determining a file change state of each deletion layer, and performing synchronous correction on the file state of the writable layer of the first container corresponding to the first image according to the file change state of each deletion layer, comprises:
and comparing the files of each deleting layer in the first mirror image with the corresponding lower layer files according to the sequence from bottom to top, and deleting the second files from the writable layer of the first container if the comparison shows that the second files existing in the current deleting layer do not exist in the corresponding lower layer files.
4. The method of claim 1, wherein comparing the file of each deletion layer in the first image with the corresponding lower layer file in the order from bottom to top, determining a file change state of each deletion layer, and performing synchronous correction on the file state of the writable layer of the first container corresponding to the first image according to the file change state of each deletion layer, comprises:
and comparing the files of each deleting layer in the first mirror image with the corresponding lower layer files according to the sequence from bottom to top, and if the comparison shows that the third files which do not exist in the current deleting layer exist in the corresponding lower layer files, copying the third files closest to the current deleting layer to the writable layer of the first container.
5. The method of claim 1, wherein comparing the file of each added layer in the second image with the corresponding lower layer file in the order from bottom to top, determining a file change state of each added layer, and performing synchronous correction on the file state of the writable layer of the first container corresponding to the first image according to the file change state of each added layer, comprises:
and comparing the files of each added layer in the second mirror image with the corresponding lower layer files in a sequence from bottom to top, and if the comparison shows that the fourth files existing in the current added layer also exist in the corresponding lower layer files at the same time, copying the fourth files existing in the current added layer to the writable layer of the first container.
6. The method of claim 1, wherein comparing the file of each added layer in the second image with the corresponding lower layer file in the order from bottom to top, determining a file change state of each added layer, and performing synchronous correction on the file state of the writable layer of the first container corresponding to the first image according to the file change state of each added layer, comprises:
and comparing the files of each added layer in the second mirror image with the corresponding lower layer files in the order from bottom to top, and copying the fifth file to the writable layer of the first container if the comparison shows that the fifth file existing in the current added layer does not exist in the corresponding lower layer files.
7. The method of claim 1, wherein comparing the file of each added layer in the second image with the corresponding lower layer file in the order from bottom to top, determining a file change state of each added layer, and performing synchronous correction on the file state of the writable layer of the first container corresponding to the first image according to the file change state of each added layer, comprises:
and comparing the files of each added layer in the second mirror image with the corresponding lower layer files in the sequence from bottom to top, and deleting the sixth file from the writable layer of the first container if the comparison shows that the sixth file which does not exist in the current added layer exists in the corresponding lower layer files.
8. An image-upgraded container handling apparatus, comprising:
the acquisition module is used for acquiring the first image before upgrading and the second image after upgrading;
the comparison and determination module is used for comparing the image information of the first image and the second image, and determining a deletion layer of the first image relative to the second image and/or an addition layer of the second image relative to the first image;
a correction module, configured to compare, in order from bottom to top, a file of each deletion layer in the first image with a corresponding lower layer file, determine a file change state of each deletion layer, and perform synchronous correction on a file state of a writable layer of a first container corresponding to the first image according to the file change state of each deletion layer, and/or,
comparing the files of each added layer in the second mirror image with the corresponding lower layer files according to the sequence from bottom to top, determining the file change state of each added layer, and synchronously correcting the file state of the writable layer of the first container corresponding to the first mirror image according to the file change state of each added layer;
the correction module is used for comparing the file of each deletion layer in the first mirror image with the corresponding lower layer file according to the sequence from bottom to top, determining the file change state of each deletion layer, and synchronously correcting the file state of the writable layer of the first container corresponding to the first mirror image according to the file change state of each deletion layer, and is specifically used for:
and comparing the files of each deleting layer in the first mirror image with the corresponding lower layer files in a sequence from bottom to top, and if the comparison shows that the first files existing in the current deleting layer also exist in the corresponding lower layer files at the same time, copying the first files existing in the lower layer files closest to the current deleting layer to the writable layer of the first container.
9. A computer device, comprising: memory, a processor and a computer program stored on the memory and executable on the processor, which processor, when executing the computer program, implements the container handling method of an image upgrade according to any of the claims 1-7.
10. A non-transitory computer readable storage medium having stored thereon a computer program, wherein the computer program when executed by a processor implements the container handling method of image upgrades according to any one of claims 1-7.
CN201810259793.7A 2018-03-27 2018-03-27 Method and device for processing container of image upgrade Active CN110196728B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810259793.7A CN110196728B (en) 2018-03-27 2018-03-27 Method and device for processing container of image upgrade

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810259793.7A CN110196728B (en) 2018-03-27 2018-03-27 Method and device for processing container of image upgrade

Publications (2)

Publication Number Publication Date
CN110196728A CN110196728A (en) 2019-09-03
CN110196728B true CN110196728B (en) 2023-07-25

Family

ID=67751309

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810259793.7A Active CN110196728B (en) 2018-03-27 2018-03-27 Method and device for processing container of image upgrade

Country Status (1)

Country Link
CN (1) CN110196728B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111459614A (en) * 2020-03-30 2020-07-28 中科边缘智慧信息科技(苏州)有限公司 Service lightweight containerized packaging migration method
CN111552496B (en) * 2020-05-07 2021-07-20 上海道客网络科技有限公司 System and method for realizing seamless upgrade of sidecar based on temporary container addition
CN111654531B (en) * 2020-05-22 2023-05-05 国云科技股份有限公司 Mirror image update release method and device based on container
CN113342378B (en) * 2021-06-25 2022-08-02 浪潮通用软件有限公司 Mirror image generation method, device and medium based on file system update
CN113553091A (en) * 2021-07-28 2021-10-26 恒安嘉新(北京)科技股份公司 Method, device, equipment and storage medium for automatically generating incremental mirror image data packet

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105511943A (en) * 2015-12-03 2016-04-20 华为技术有限公司 Docker container running method and device
CN106155778A (en) * 2016-07-07 2016-11-23 中国科学院声学研究所 A kind of startup method and system of application container
CN106528224A (en) * 2016-11-03 2017-03-22 腾讯科技(深圳)有限公司 Content updating method and system for Docker container, and server
CN107015995A (en) * 2016-01-28 2017-08-04 华为技术有限公司 The amending method and device of a kind of image file
WO2017173922A1 (en) * 2016-04-08 2017-10-12 中兴通讯股份有限公司 Method and apparatus for upgrading virtual machine

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105511943A (en) * 2015-12-03 2016-04-20 华为技术有限公司 Docker container running method and device
CN107015995A (en) * 2016-01-28 2017-08-04 华为技术有限公司 The amending method and device of a kind of image file
WO2017173922A1 (en) * 2016-04-08 2017-10-12 中兴通讯股份有限公司 Method and apparatus for upgrading virtual machine
CN106155778A (en) * 2016-07-07 2016-11-23 中国科学院声学研究所 A kind of startup method and system of application container
CN106528224A (en) * 2016-11-03 2017-03-22 腾讯科技(深圳)有限公司 Content updating method and system for Docker container, and server

Also Published As

Publication number Publication date
CN110196728A (en) 2019-09-03

Similar Documents

Publication Publication Date Title
CN110196728B (en) Method and device for processing container of image upgrade
US11249745B2 (en) Image upgrade method and device
US9880889B2 (en) Virtual application extension points
US10942734B2 (en) Software dependency shading
US8429639B2 (en) Image-based software update
US7669021B2 (en) File system based offline disk management
US10346150B2 (en) Computerized system and method for patching an application by separating executables and working data using different images
US8255361B2 (en) Method and system for validating differential computer system update
WO2016090836A1 (en) Method and apparatus for starting embedded system
CN113238790B (en) Firmware program updating method and system based on SD card and EEPROM
US9459883B2 (en) Modifying disk images
CN114003258A (en) Software upgrading method, computing equipment and readable storage medium
US20150039872A1 (en) Multiple Signed Filesystem Application Packages
CN114756333B (en) Mirror image processing method and device, electronic equipment and readable medium
KR102067974B1 (en) Image forming apparatus and method for deleting application
KR102090977B1 (en) Information processing apparatus and resource management method
WO2020107469A1 (en) Application processing method and apparatus and storage medium
KR101418451B1 (en) Electric Control Unit and Update Method thereof
EP4290376A1 (en) Reducing deployment time for container clones in computing environments
US11947495B1 (en) System and method for providing a file system without duplication of files
CN112711561A (en) Software movement processing method and device and storage medium
US20240177830A1 (en) Automated imaging protocol management for hybrid modalities
CN111400243A (en) Research and development management system based on pipeline service and file storage method and device
CN114721699B (en) Mirror image upgrading method and device, electronic equipment and storage medium
US20210374124A1 (en) Bulk file verification

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