CN110196728A - The container-treatment and device of image upgrade - Google Patents

The container-treatment and device of image upgrade Download PDF

Info

Publication number
CN110196728A
CN110196728A CN201810259793.7A CN201810259793A CN110196728A CN 110196728 A CN110196728 A CN 110196728A CN 201810259793 A CN201810259793 A CN 201810259793A CN 110196728 A CN110196728 A CN 110196728A
Authority
CN
China
Prior art keywords
file
layer
mirror image
container
compared
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.)
Granted
Application number
CN201810259793.7A
Other languages
Chinese (zh)
Other versions
CN110196728B (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

Abstract

The invention proposes a kind of container-treatment of image upgrade and devices, wherein method includes: to obtain the first mirror image before upgrading and after upgrading the second mirror image;The Mirror Info of first mirror image and the second mirror image is compared, determines deletion layer of first mirror image relative to the second mirror image, and/or, increase layer of second mirror image relative to the first mirror image;The file for deleting layer each in first mirror image is compared with corresponding underlying file, determine each file change state for deleting layer, and amendment is synchronized according to the file status of the writable layers of each file change state pair the first container corresponding with the first mirror image for deleting layer, and/or, the file for increasing layer each in second mirror image is compared with corresponding underlying file, it determines each file change state for increasing layer, and amendment is synchronized according to the file status of the writable layers of each file change state pair the first container corresponding with the first mirror image for increasing layer.The efficiency of image upgrade is improved as a result,.

Description

The container-treatment and device of image upgrade
Technical field
The present invention relates to field of computer technology more particularly to the container-treatments and device of a kind of image upgrade.
Background technique
Currently, mirror image is made of mirror metadata and layer file, the operating file of application program is provided for container and is matched Environment is set, before container operation, needs in advance to download to the metadata of mirror image and layer file download on host.To, The technology that container is virtualized as a kind of container encapsulates the running environment of the process of application program, to system resource It is isolated, provides non-interfering running environment for multiple application programs.Wherein, since container is based on mirror image one A running example, thus, the upgrading of application program is actually process of the mirror image after upgrading to the unlatching of new container.
In the related technology, when original image file updates, need new image file reopen one it is new Container realizes the upgrading of corresponding application program by running new container, however, restarting a new container, needing will be a large amount of Data be loaded into memory, take a long time, it is lower so as to cause image upgrade efficiency.
Summary of the invention
The present invention provides the container-treatment and device of a kind of image upgrade, to solve image upgrade in the prior art Low efficiency the technical issues of.
First embodiment of the invention provides a kind of image upgrade processing method, comprising the following steps: the before obtaining upgrading One mirror image and after upgrading the second mirror image;The Mirror Info of first mirror image and second mirror image is compared, really Fixed deletion layer of first mirror image relative to second mirror image, and/or, second mirror image is relative to first mirror image Increase layer;According to sequence from top to bottom by file and the corresponding underlying file for deleting layer each in first mirror image into Row compares, and determines each file change state for deleting layer, and according to each file change state pair for deleting layer and institute The file status for stating the writable layers of the corresponding the first container of the first mirror image synchronizes amendment, and/or, it is suitable according to from top to bottom The file for increasing layer each in second mirror image is compared by sequence with corresponding underlying file, determines each text for increasing layer Part variable condition, and according to each file change state pair the first container corresponding with first mirror image for increasing layer The file status of writable layers synchronizes amendment.
Second embodiment of the invention provides a kind of image upgrade processing unit, comprising: module is obtained, before obtaining upgrading The first mirror image and upgrading after the second mirror image;Compare determining module, is used for first mirror image and second mirror image Mirror Info compare, determine deletion layer of first mirror image relative to second mirror image, and/or, described second Increase layer of the mirror image relative to first mirror image;Correction module, for according to sequence from top to bottom by first mirror image In each file for deleting layer be compared with corresponding underlying file, determine the file change state of each deletion layer, and root According to the file shape of the writable layers of each file change state pair the first container corresponding with first mirror image for deleting layer State synchronizes amendment, and/or, according to sequence from top to bottom by second mirror image it is each increase layer file with it is corresponding Underlying file be compared, determine it is each increase layer file change state, and according to it is described it is each increase layer file become The file status of the writable layers of change state pair the first container corresponding with first mirror image synchronizes amendment.
Third embodiment of the invention provides a kind of computer equipment, comprising: memory, processor and storage are on a memory And the computer program that can be run on a processor, when the processor executes the computer program, realize such as above-mentioned implementation The container-treatment of image upgrade described in example.
Fourth embodiment of the invention provides a kind of non-transitorycomputer readable storage medium, is stored thereon with computer journey Sequence realizes the container-treatment of the image upgrade as described in above-described embodiment when the computer program is executed by processor.
Technical solution provided in an embodiment of the present invention can include the following benefits:
The first mirror image before upgrading and after upgrading the second mirror image is compared, determines the change layer of image upgrade, In turn, it is operated according to the document upgrading of change layer, amendment is synchronized to the writable layers of the first container corresponding with the first mirror image, Generate the first container corresponding with the second mirror image.Image upgrade is realized on the basis of not pull-up new container as a result, avoids correlation Memory reloads, and improves image upgrade efficiency.
The additional aspect of the present invention and advantage will be set forth in part in the description, and will partially become from the following description Obviously, or practice through the invention is recognized.
Detailed description of the invention
Above-mentioned and/or additional aspect and advantage of the invention will become from the following description of the accompanying drawings of embodiments Obviously and it is readily appreciated that, wherein
Figure 1A is image file structural schematic diagram according to prior art;
Figure 1B is structure of container schematic diagram according to prior art;
Fig. 1 C is the structural schematic diagram after image file upgrading according to an embodiment of the invention;
Fig. 2 is the flow chart of the container-treatment of image upgrade according to an embodiment of the invention;
Fig. 3 is the flow chart of the container-treatment of image upgrade in accordance with another embodiment of the present invention;
Fig. 4 is the application scenarios schematic diagram of the container-treatment of the image upgrade of another embodiment according to the present invention;
Fig. 5 is the application scenarios schematic diagram of the container-treatment of image upgrade according to an embodiment of the invention;
Fig. 6 is the application scenarios schematic diagram of the container-treatment of image upgrade in accordance with another embodiment of the present invention;
Fig. 7 is the structural schematic diagram of the container processing of image upgrade according to an embodiment of the invention.
Specific embodiment
The embodiment of the present invention is described below in detail, examples of the embodiments are shown in the accompanying drawings, wherein from beginning to end Same or similar label indicates same or similar element or element with the same or similar functions.Below with reference to attached The embodiment of figure description is exemplary, it is intended to is used to explain the present invention, and is not considered as limiting the invention.
In order to enable those skilled in the art, the container processing side of the understanding being more easier image upgrade of the invention Method is first below described mirror image in the prior art and container.
Wherein, mirror image is actually to provide the file set of hierarchical file and configuration information, mirror image for container running environment File realizes the preservation and update of increment by layering, and in some applications, image file can be the program bag of application program Corresponding associated documents, for example, suffix is the file etc. of .bin .dfi.
Container, is to provide a kind of container technique of light weight virtualization, and the inside of container realizes that details is to be layered existing mirror As file.Specifically, as shown in Figure 1A, mirror image is the unified visual angle of a pile read only layer, referring to such as Figure 1A, multiple read-only layer heaps It stacks, in addition to one layer bottom, other layers can all have a pointer to be directed toward next layer, these layers are the realizations inside container Details (for convenience of description, only shows two layers of image file) in figure, as shown in Figure 1B, container is in all Image Planes Upper to increase what a writable layers were formed, this writable layers has the process operated on CPU.
In container operation, all operations of image file can finally be embodied in the writable layers of container, the i.e. text of Image Planes Part is sequence operation from top to bottom, and in addition to nethermost one layer, every layer of reparation can all be embodied on upper layer, and upper layer is repaired File can cover the file that lower layer is repaired.For example, the file a shown in Figure 1B in A layers of file is needed there are bug When to be rehabilitated, it can be realized in the B layer file on upper layer by the file a after repairing, thus, in the writable layers of container top layer Embodiment is that the file a, original file a after image file top layer repairs are capped.To execute when being run on CPU The corresponding function of file a after reparation, the corresponding function of file a are upgraded.
Certainly, the All Files operation of the image file of this writable layers for being finally embodied in container, in addition to including above-mentioned The change covering of file is outer, further includes newly-increased and deletion of file etc., file b is not present for A layers shown in Figure 1B for example, working as, on There is file b in the B layer file of layer, then newly-increased file b is embodied in the writable layers of container top layer, to transport on CPU When row, the corresponding function of file b is also executed.
For another example, shown in Figure 1B A layers there are file c, there is not file c in the B layer file on upper layer, then to file The delete operation of c is embodied in the writable layers of container top layer, and file c no longer occur in the writable layers of container top layer, thus in CPU When upper operation, the corresponding function of file c is no longer executed.
When the upgrading etc. due to application program makes the original image file in container need to update, one is generally required New mirror image opens a new container, and this image upgrade method takes a long time, with continued reference to above-mentioned example, when needing pair When original image file is upgraded, such as when original image file A and B are upgraded to D, E and A as shown in Figure 1 C, need All memories in original container are destroyed, then construct resource in new container, such as will be former by the new container of pull-up again The data that beginning container is already loaded into memory when running are reloaded, lower so as to cause the upgrading efficiency of image file.
The invention proposes a kind of container upgrading modes of new image file to be passed through according to container internal operation details It in the operation of the writable layers of container top layer, realizes on the basis of not pull-up new container, realizes that the heat on image file rises Grade, the internal storage data loaded in original container retains without loading again, substantially increases the upgrading efficiency of image file.
Specifically, Fig. 2 is the flow chart of the container-treatment of image upgrade according to an embodiment of the invention, such as Shown in Fig. 2, method includes the following steps:
Step 101, the first mirror image before upgrading and after upgrading the second mirror image is obtained.
Step 102, the Mirror Info of the first mirror image and the second mirror image is compared determines the first mirror image relative to second The deletion layer of mirror image, and/or, increase layer of second mirror image relative to the first mirror image.
Step 103, according to sequence from top to bottom that the file for deleting layer each in the first mirror image and corresponding lower layer is literary Part is compared, and determines each file change state for deleting layer, and according to each file change state pair for deleting layer and the The file status of the writable layers of the corresponding the first container of one mirror image synchronizes amendment, and/or,
The file for increasing layer each in the second mirror image is compared with corresponding underlying file according to sequence from top to bottom Compared with, determine it is each increase layer file change state, and according to it is each increase layer file change state pair and the first mirror image pair The file status of the writable layers for the first container answered synchronizes amendment.
In an embodiment of the present invention, the first mirror image before upgrading and the second mirror image after upgrading are compared, is determined The change layer of image upgrade after finding change layer, operates, corresponding with the first mirror image according to the document upgrading of change layer Be modified in original the first container, thus, realize the first container to container corresponding with the second mirror image update, it is this more Newly based on original the first container, the new container of pull-up again is not needed, upgrades high-efficient, strong operability.
For the container-treatment of the image upgrade of the more intuitive description embodiment of the present invention, below with reference to specific Scene is illustrated, and is described as follows:
In this scenario, as shown in figure 4, the file layers that the first mirror image includes are A, B, C, D, E, the first mirror image corresponding the The writable layer of one container be Z1 layer, the file layers that the second mirror image after upgrading includes be A, B, C, F, G, then according to the first mirror image with The comparison of the layer file of second mirror image, the first mirror image of discovery are D, E layers relative to the deletion layer of the second mirror image, the second mirror image phase Increase layer for the first mirror image is F, G layers, thus, the container-treatment of image upgrade through the embodiment of the present invention, On the basis of the first container, operated according to the document upgrading of change layer, in original the first container corresponding with the first mirror image It is modified, thus, the update of the first container to container corresponding with the second mirror image is realized, by the way that layer will be write in the first container It is updated to Z2 for Z1, the container of equally completion image upgrade pulls.It should be noted that the change layer of image upgrade, including the One mirror image relative to the second mirror image increase layer relative to the first mirror image of deletion layer and the second mirror image, answered in different It is different with the mode for the change layer under scene, determining image upgrade, it illustrates as follows:
The first example:
In this example, change layer is got by way of successively comparing to the first mirror image and the second mirror image.
As shown in figure 3, above-mentioned steps 101 include:
Step 201, the layer identification of the first mirror image and each layer of the second mirror image is obtained respectively.
Step 202, the layer identification of the first mirror image and each layer of the second mirror image is compared, judges the first mirror image and the second mirror As whether the layer identification of each layer is identical.
Step 203, if judgement knows that there are different layer identifications between the first mirror image and the second mirror image, according to first Deletion layer of the mirror image relative to the second mirror image, and/or, increase layer of second mirror image relative to the first mirror image.
Wherein, interlayer identifies each layer of the uniqueness for identifying mirror image, and interlayer mark can be the two of fixed digit Grade system coding, the interlayers ID such as hexadecimal code, are also possible to that other can realize interlayer differentiation using text or icon etc. Name identification or icon mark etc..
In the present embodiment, the first image file and each layer identification of the second image file are obtained respectively, by the first mirror image and The layer identification of each layer of second mirror image compares, and judges whether the layer identification of the first mirror image and each layer of the second mirror image is identical, if Judgement knows that there are different layer identifications between the first mirror image and the second mirror image, then determine mirror image according to different layer identification The change layer of upgrading, wherein change layer is identified corresponding to different interlayer, and different interlayer mark includes the first mirror image text Include in part and do not include (i.e. deletion layer of the first mirror image relative to the second mirror image) in the second image file, alternatively, the first mirror As file includes and interlayer that the second image file does not include mark (i.e. increase layer of the second mirror image relative to the first mirror image).
Second of example:
In this example, compare between the first mirror image and each layer of the second mirror image comprising file, when existing comprising file not When identical layer, this layer is determined as to the change layer of image upgrade.
Further, the corresponding document upgrading operation of the change layer of image file, includes original in original image file Layer deletion and newly-increased new image file new layer addition the two aspect, concentrate below the two aspect Document upgrading operation, detailed description to according to the document upgrading of change layer operate, to the first container corresponding with the first mirror image Writable layers synchronize modified implementation process.
On the one hand, according to sequence from top to bottom by the first mirror image it is each delete layer file and corresponding underlying file It is compared, determines each file change state for deleting layer, and according to each file change state pair and first for deleting layer The file status of the writable layers of the corresponding the first container of mirror image synchronizes amendment.
It is appreciated that in the present embodiment, the second mirror image deletes some layers of file in the first mirror image, then shows new The function that application scenarios no longer need original these layer of file to implement, thus, restore these original deleted layer files Operation, by Such analysis it is found that topmost paper includes update, deletion and the addition of file to the operation of underlying file, thus, it is right It answers, the operation for restoring original N layers of file is the update recovery of file, addition and deletes.
In one embodiment of the invention, according to sequence from top to bottom by the first mirror image it is each delete layer file It is compared with corresponding underlying file, knows that the first file present in current deletion layer is also existed simultaneously in correspondence if comparing Underlying file in, then delete distance is current the first file copy present in the nearest underlying file of layer and arrive the first container Writable layers.
In this example, deleted if currently deleting the first file present in layer, and this document is in lower layer's text Exist in part, then no longer needs to delete the operation that layer carries out the first file in the second mirror image after showing upgrading, thus, by the One file is reduced to delete the first file of the last time before handling in layer.In one embodiment of the invention, according under The file for deleting layer each in the first mirror image is compared with corresponding underlying file to upper sequence, is known currently if comparing It deletes the second file present in layer to be not present in corresponding underlying file, then by the second file from the writable layers of the first container Middle deletion.
In this example, it is deleted if currently deleting the second file present in layer, and this document is in underlying file It is not present, then no longer needs to delete the corresponding function of the second file in layer in the second mirror image after showing upgrading, thus, directly will Second file is deleted from the writable layers of the first container.
In one embodiment of the invention, according to sequence from top to bottom by the first mirror image it is each delete layer file Be compared with corresponding underlying file, if compare know it is current delete the third file being not present in layer be present in it is corresponding under In layer file, then by the writable layers of the nearest third file copy of the current deletion layer of distance to the first container.
In this example, exist in underlying file if currently deleting the third file being not present in layer, show to rise Need to delete the corresponding function of third file of deleting in layer in the second mirror image after grade, thus, layer will be deleted most apart from current Writable layers of the close third file copy to the first container.
The influence for deleting layer to the operation of file is eliminated as a result, will be deleted the underlying file that layer is deleted and is added, will delete layer The file of addition is deleted, the underlying file etc. before the underlying file for deleting layer covering is reverted to.
For example, as shown in Fig. 5 left figure, the first mirror image include 3 layer by layer file A, B, C deleted as shown in the second mirror image Except layer is the 3rd layer C layer the in the first mirror image, the file in the 3rd layer in the first mirror image is a, g, and the file in the 2nd layer is a, c, File in 1st layer is a.By the Documents Comparison in the file and the 2nd layer the 1st layer in the 3rd layer, compare the first file a also simultaneously It is present in underlying file, then copies the first file a present in the 3rd layer of nearest underlying file of distance to the first container Writable layers, thus, as shown in Fig. 5 right figure, in updated the first container, eliminate the 3rd layer and the covering of file a operated.
If comparing the second file g present in knowing the 3rd layer to be not present in underlying file, by the second file g from It is deleted in the writable layers of one container, thus, as shown in Fig. 5 right figure, in updated the first container, the 3rd layer is eliminated to file g Addition operation.
Know that the third file c being not present in the 3rd layer is present in underlying file if comparing, will exist in underlying file Third file c copy the writable layers of the first container to.To in updated the first container, eliminate as shown in Fig. 5 right figure 3rd layer of delete operation to file c.
On the other hand, according to sequence from top to bottom that the file for increasing layer each in the second mirror image and corresponding lower layer is literary Part is compared, and determines each file change state for increasing layer, and according to each file change state pair for increasing layer and the The file status of the writable layers of the corresponding the first container of one mirror image synchronizes amendment.
In one embodiment of the invention, according to sequence from top to bottom by the second mirror image it is each increase layer file It is compared with corresponding underlying file, knows that the 4th file present in current increase layer is also existed simultaneously in correspondence if comparing Underlying file in, then current will increase the 4th file copy present in layer to the first container writable layers.
In this example, if currently increasing the 4th file present in layer, exist in underlying file, then show to upgrade Need to increase the operation that layer is updated the 4th file in the second mirror image afterwards, thus, will currently it increase by present in layer Four file copies cover original 4th file to the writable layers of the first container.
In one embodiment of the invention, according to sequence from top to bottom by the second mirror image it is each increase layer file Be compared with corresponding underlying file, if compare know it is current increase the 5th file present in layer be not present in it is corresponding under In layer file, then by the writable layers of the 5th file copy to the first container.
In this example, it if currently increasing the 5th file present in layer, is not present in underlying file, then shows to rise Need to increase the corresponding feature operation of the 5th file in the second mirror image after grade, thus, will currently it increase the 5th present in layer File copy to the first container writable layers, to increase the corresponding function of the 5th file.
In one embodiment of the invention, according to sequence from top to bottom by the second mirror image it is each increase layer file Be compared with corresponding underlying file, if compare know it is current increase the 6th file being not present in layer be present in it is corresponding under In layer file, then the 6th file is deleted from the writable layers of the first container.
In this example, if currently increasing the 6th file being not present in layer, exist in underlying file, then show to rise Need to delete the corresponding feature operation of the 6th file in the second mirror image after grade, thus, increase by the be not present in layer for current Six files are deleted from the writable layers of the first container, to delete the corresponding function of the 6th file.
To which the influence for increasing layer to the operation of file be added, the underlying file that layer is deleted will be increased and deleted, layer will be increased The file of addition adds, and will increase the underlying file that layer updates and covers.
It for example, is the 3rd layer D layers in the second mirror image when increasing layer, wherein the 3rd layer D layers as shown in Fig. 6 left figure In file be a, h, the file in the 2nd layer is a, c, and the file in the 1st layer is a.By in the 3rd layer file and the 2nd layer the 1st layer In Documents Comparison, compare the 4th file a and also exist simultaneously in underlying file, then copy the 4th file a to the first container Writable layers, thus, as shown in Fig. 6 right figure, in updated the first container, increase the 3rd layer D layers and the covering of file a grasped Make.
If comparing the 5th file h present in knowing the 3rd layer to be not present in underlying file, by the 5th file h from It copies and enters in the writable layers of one container, thus, as shown in Fig. 6 right figure, in the first container of update, embody newly-increased 3rd layer The D layers of addition to the 5th file h operates.
Know that the 6th file c being not present in the 3rd layer is present in underlying file if comparing, will exist in underlying file The 6th file to the first container writable layers delete.To embody the layer of newly-increased D layer in the first container of update Delete operation of the file to the 6th file c.
In order to more comprehensively illustrate image upgrade of the invention container-treatment implementation process, below with reference to tool The application scenarios of body are illustrated, wherein and with continued reference to Fig. 4, the layer file being deleted in the first mirror image is E, two layers of D, second In mirror image increase newly layer file be G, two layers of F.First mirror image is old image, and the second mirror image is new mirror image, in the first container can Write layer is indicated with Z.
Specifically, first obtaining each layer ID of new old image referring to Fig. 4, each layer ID of new old image is compared, is looked for Difference section out.For the above figure, difference section is the E of old image, the G of two layers of D and new mirror image, two layers of F.
It eliminates old image and has more the influence for carrying out layer (E, D two layers), specifically: it is started to process from D layers, for being increased newly in D layers With the file modified, lower layer C is needed, is successively looked in B, A layers, if it is possible to found, illustrate that this document is to be modified , then need the underlying file that will be found to copy the Z1 layer of old container to;If cannot find, illustrate that this document is to be increased newly , then it needs to delete this document in the Z1 layer of old container.For deleted file in D layers, it is also desirable to arrive lower layer C, B, A It is successively looked in layer, the underlying file that will be found then is needed to copy the Z1 layer of old container to after finding.D layers have been handled with this Afterwards, then successively E layers or higher content are handled in the same way.
New mirror image is synchronized to the Z1 layer of old container compared with the extra layer of old image (G, F two layers), specifically: it is opened from F layers Beginning processing is copied directly to the Z1 layer of old container for the file for increasing newly and modifying in F layers;For the text deleted in F layers Part then directly deletes this document in the Z1 layer of old container.After having handled F layers with this, then successively in the same way handle G layers or Higher content.After the Z1 layer of old container is all written in all differences file as a result, that is, new container is formed, it is writeable in new container Layer is Z2.
In conclusion the container-treatment of image upgrade of the invention, by the first mirror image before upgrading and after upgrading The second mirror image compare, determine the change layer of image upgrade, in turn, operated according to the document upgrading of change layer, to the The writable layers of the corresponding the first container of one mirror image synchronize amendment, generate the first container of update corresponding with the second mirror image. Image upgrade is realized on the basis of not pull-up new container as a result, is avoided reloading for associated internal memory, is improved image upgrade Efficiency.
In order to realize above-described embodiment, the invention also provides a kind of container processing of image upgrade, Fig. 7 is basis The structural schematic diagram of the container image upgrade processing unit of one embodiment of the invention, as shown in fig. 7, the container of the image upgrade Processing unit includes obtaining module 100, comparing determining module 200 and correction module 300.
Wherein, module 100 is obtained, for obtaining the first mirror image before upgrading and after upgrading the second mirror image.
Compare determining module 200, for comparing the Mirror Info of the first mirror image and the second mirror image, determines the first mirror As the deletion layer relative to the second mirror image, and/or, increase layer of second mirror image relative to the first mirror image.
Correction module 300, for according to sequence from top to bottom by the first mirror image it is each delete layer file with it is corresponding Underlying file be compared, determine it is each delete layer file change state, and according to it is each delete layer file change shape The file status of the writable layers of state pair the first container corresponding with the first mirror image synchronizes amendment, and/or,
The file for increasing layer each in the second mirror image is compared with corresponding underlying file according to sequence from top to bottom Compared with, determine it is each increase layer file change state, and according to it is each increase layer file change state pair and the first mirror image pair The file status of the writable layers for the first container answered synchronizes amendment.
It should be noted that the explanation of the aforementioned container-treatment embodiment to image upgrade is also applied for the reality The container processing of the image upgrade of example is applied, realization principle is similar, and details are not described herein.
In conclusion the container processing of image upgrade of the invention, by the first mirror image before upgrading and after upgrading The second mirror image compare, determine the change layer of image upgrade, in turn, operated according to the document upgrading of change layer, to the The writable layers of the corresponding the first container of one mirror image synchronize amendment, generate the first container of update corresponding with the second mirror image. Image upgrade is realized on the basis of not pull-up new container as a result, is avoided reloading for associated internal memory, is improved image upgrade Efficiency.
In order to realize above-described embodiment, the invention also provides a kind of computer equipments, comprising: memory, processor and The computer program that can be run on a memory and on a processor is stored, when the processor executes described program, is realized such as The container-treatment of the image upgrade of above-described embodiment description.
In order to realize above-described embodiment, the invention also provides a kind of non-transitorycomputer readable storage mediums, thereon It is stored with computer program, the container processing of the image upgrade as described in above-described embodiment is realized when which is executed by processor Method.
In the description of this specification, reference term " one embodiment ", " some embodiments ", " example ", " specifically show The description of example " or " some examples " etc. means specific features, structure, material or spy described in conjunction with this embodiment or example Point is included at least one embodiment or example of the invention.In the present specification, schematic expression of the above terms are not It must be directed to identical embodiment or example.Moreover, particular features, structures, materials, or characteristics described can be in office It can be combined in any suitable manner in one or more embodiment or examples.In addition, without conflicting with each other, the skill of this field Art personnel can tie the feature of different embodiments or examples described in this specification and different embodiments or examples It closes and combines.
In addition, term " first ", " second " are used for descriptive purposes only and cannot be understood as indicating or suggesting relative importance Or implicitly indicate the quantity of indicated technical characteristic.Define " first " as a result, the feature of " second " can be expressed or Implicitly include at least one this feature.In the description of the present invention, the meaning of " plurality " is at least two, such as two, three It is a etc., unless otherwise specifically defined.
Any process described otherwise above or method description are construed as in flow chart or herein, and expression includes It is one or more for realizing custom logic function or process the step of executable instruction code module, segment or portion Point, and the range of the preferred embodiment of the present invention includes other realization, wherein can not press shown or discussed suitable Sequence, including according to related function by it is basic simultaneously in the way of or in the opposite order, Lai Zhihang function, this should be of the invention Embodiment person of ordinary skill in the field understood.
Expression or logic and/or step described otherwise above herein in flow charts, for example, being considered use In the order list for the executable instruction for realizing logic function, may be embodied in any computer-readable medium, for Instruction execution system, device or equipment (such as computer based system, including the system of processor or other can be held from instruction The instruction fetch of row system, device or equipment and the system executed instruction) it uses, or combine these instruction execution systems, device or set It is standby and use.For the purpose of this specification, " computer-readable medium ", which can be, any may include, stores, communicates, propagates or pass Defeated program is for instruction execution system, device or equipment or the dress used in conjunction with these instruction execution systems, device or equipment It sets.The more specific example (non-exhaustive list) of computer-readable medium include the following: there is the electricity of one or more wirings Interconnecting piece (electronic device), portable computer diskette box (magnetic device), random access memory (RAM), read-only memory (ROM), erasable edit read-only storage (EPROM or flash memory), fiber device and portable optic disk is read-only deposits Reservoir (CDROM).In addition, computer-readable medium can even is that the paper that can print described program on it or other are suitable Medium, because can then be edited, be interpreted or when necessary with it for example by carrying out optical scanner to paper or other media His suitable method is handled electronically to obtain described program, is then stored in computer storage.
It should be appreciated that each section of the invention can be realized with hardware, software, firmware or their combination.Above-mentioned In embodiment, software that multiple steps or method can be executed in memory and by suitable instruction execution system with storage Or firmware is realized.Such as, if realized with hardware in another embodiment, following skill well known in the art can be used Any one of art or their combination are realized: have for data-signal is realized the logic gates of logic function from Logic circuit is dissipated, the specific integrated circuit with suitable combinational logic gate circuit, programmable gate array (PGA), scene can compile Journey gate array (FPGA) etc..
Those skilled in the art are understood that realize all or part of step that above-described embodiment method carries It suddenly is that relevant hardware can be instructed to complete by program, the program can store in a kind of computer-readable storage medium In matter, which when being executed, includes the steps that one or a combination set of embodiment of the method.
It, can also be in addition, each functional unit in each embodiment of the present invention can integrate in a processing module It is that each unit physically exists alone, can also be integrated in two or more units in a module.Above-mentioned integrated mould Block both can take the form of hardware realization, can also be realized in the form of software function module.The integrated module is such as Fruit is realized and when sold or used as an independent product in the form of software function module, also can store in a computer In read/write memory medium.
Storage medium mentioned above can be read-only memory, disk or CD etc..Although having been shown and retouching above The embodiment of the present invention is stated, it is to be understood that above-described embodiment is exemplary, and should not be understood as to limit of the invention System, those skilled in the art can be changed above-described embodiment, modify, replace and become within the scope of the invention Type.

Claims (11)

1. a kind of container-treatment of image upgrade, which comprises the following steps:
Obtain the first mirror image before upgrading and after upgrading the second mirror image;
The Mirror Info of first mirror image and second mirror image is compared, determines first mirror image relative to described The deletion layer of second mirror image, and/or, increase layer of second mirror image relative to first mirror image;
The file for deleting layer each in first mirror image is compared with corresponding underlying file according to sequence from top to bottom Compared with determining each file change state for deleting layer, and according to each file change state pair for deleting layer and described the The file status of the writable layers of the corresponding the first container of one mirror image synchronizes amendment, and/or,
The file for increasing layer each in second mirror image is compared with corresponding underlying file according to sequence from top to bottom Compared with determining each file change state for increasing layer, and according to each file change state pair for increasing layer and described the The file status of the writable layers of the corresponding the first container of one mirror image synchronizes amendment.
2. the method as described in claim 1, which is characterized in that the mirror image by first mirror image and second mirror image Information compares, and determines deletion layer of first mirror image relative to second mirror image, and/or, the second mirror image phase For the increase layer of first mirror image, comprising:
The layer identification of first mirror image and each layer of the second mirror image is obtained respectively,
The layer identification of first mirror image and each layer of the second mirror image is compared, judges first mirror image and described Whether the layer identification of each layer of two mirror images is identical;
If judgement knows that there are different layer identifications between first mirror image and second mirror image, according to the not phase With layer identification determine deletion layer of first mirror image relative to second mirror image, and/or, second mirror image relative to The increase layer of first mirror image.
3. the method as described in claim 1, which is characterized in that it is described will be in first mirror image according to sequence from top to bottom It is each delete layer file be compared with corresponding underlying file, determine it is each deletion layer file change state, and according to The file status of the writable layers of each file change state pair the first container corresponding with first mirror image for deleting layer Synchronize amendment, comprising:
The file for deleting layer each in first mirror image is compared with corresponding underlying file according to sequence from top to bottom Compared with, if compare know it is current delete the first file present in layer and also exist simultaneously in corresponding underlying file, by distance Writable layers of first file copy present in the nearest underlying file of the current deletion layer to the first container.
4. the method as described in claim 1, which is characterized in that it is described will be in first mirror image according to sequence from top to bottom It is each delete layer file be compared with corresponding underlying file, determine it is each deletion layer file change state, and according to The file status of the writable layers of each file change state pair the first container corresponding with first mirror image for deleting layer Synchronize amendment, comprising:
The file for deleting layer each in first mirror image is compared with corresponding underlying file according to sequence from top to bottom Compared with, if compare know it is current delete the second file present in layer and be not present in corresponding underlying file, by described second File is deleted from the writable layers of the first container.
5. the method as described in claim 1, which is characterized in that it is described will be in first mirror image according to sequence from top to bottom It is each delete layer file be compared with corresponding underlying file, determine it is each deletion layer file change state, and according to The file status of the writable layers of each file change state pair the first container corresponding with first mirror image for deleting layer Synchronize amendment, comprising:
The file for deleting layer each in first mirror image is compared with corresponding underlying file according to sequence from top to bottom Compared with, know that the current third file being not present in layer of deleting is present in corresponding underlying file if comparing, it will be apart from described Writable layers of the nearest third file copy of current deletion layer to the first container.
6. the method as described in claim 1, which is characterized in that it is described will be in second mirror image according to sequence from top to bottom It is each increase layer file be compared with corresponding underlying file, determine it is each increase layer file change state, and according to The file status of the writable layers of each file change state pair the first container corresponding with first mirror image for increasing layer Synchronize amendment, comprising:
The file for increasing layer each in second mirror image is compared with corresponding underlying file according to sequence from top to bottom Compared with, know that the 4th file present in current increase layer also exists simultaneously in corresponding underlying file if comparing, it will be described Writable layers of 4th file copy present in current increase layer to the first container.
7. the method as described in claim 1, which is characterized in that it is described will be in second mirror image according to sequence from top to bottom It is each increase layer file be compared with corresponding underlying file, determine it is each increase layer file change state, and according to The file status of the writable layers of each file change state pair the first container corresponding with first mirror image for increasing layer Synchronize amendment, comprising:
The file for increasing layer each in second mirror image is compared with corresponding underlying file according to sequence from top to bottom Compared with, if compare know it is current increase the 5th file present in layer and be not present in corresponding underlying file, by the described 5th Writable layers of the file copy to the first container.
8. the method as described in claim 1, which is characterized in that it is described will be in second mirror image according to sequence from top to bottom It is each increase layer file be compared with corresponding underlying file, determine it is each increase layer file change state, and according to The file status of the writable layers of each file change state pair the first container corresponding with first mirror image for increasing layer Synchronize amendment, comprising:
The file for increasing layer each in second mirror image is compared with corresponding underlying file according to sequence from top to bottom Compared with knowing that current the 6th file being not present in layer that increases is present in corresponding underlying file if comparing, by the described 6th File is deleted from the writable layers of the first container.
9. a kind of container processing of image upgrade characterized by comprising
Module is obtained, for obtaining the first mirror image before upgrading and after upgrading the second mirror image;
Compare determining module, for comparing the Mirror Info of first mirror image and second mirror image, described in determination Deletion layer of first mirror image relative to second mirror image, and/or, increase of second mirror image relative to first mirror image Layer;
Correction module, for according to sequence from top to bottom by first mirror image it is each delete layer file with it is corresponding under Layer file is compared, and determines each file change state for deleting layer, and according to each file change shape for deleting layer The file status of the writable layers of state pair the first container corresponding with first mirror image synchronizes amendment, and/or,
The file for increasing layer each in second mirror image is compared with corresponding underlying file according to sequence from top to bottom Compared with determining each file change state for increasing layer, and according to each file change state pair for increasing layer and described the The file status of the writable layers of the corresponding the first container of one mirror image synchronizes amendment.
10. a kind of computer equipment characterized by comprising memory, processor and storage on a memory and can handled The computer program run on device when the processor executes the computer program, is realized such as any one of claim 1-8 institute The container-treatment for the image upgrade stated.
11. a kind of non-transitorycomputer readable storage medium, is stored thereon with computer program, which is characterized in that the meter The container-treatment such as the described in any item image upgrades of claim 1-8 is realized when calculation machine program is executed by processor.
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 true CN110196728A (en) 2019-09-03
CN110196728B 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)

Cited By (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
CN111552496A (en) * 2020-05-07 2020-08-18 上海道客网络科技有限公司 System and method for realizing seamless upgrade of sidecar based on temporary container addition
CN113342378A (en) * 2021-06-25 2021-09-03 山东浪潮通软信息科技有限公司 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
WO2021232845A1 (en) * 2020-05-22 2021-11-25 国云科技股份有限公司 Container-based image updating and distribution method, and apparatus

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

Cited By (6)

* 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
CN111552496A (en) * 2020-05-07 2020-08-18 上海道客网络科技有限公司 System and method for realizing seamless upgrade of sidecar based on temporary container addition
WO2021232845A1 (en) * 2020-05-22 2021-11-25 国云科技股份有限公司 Container-based image updating and distribution method, and apparatus
CN113342378A (en) * 2021-06-25 2021-09-03 山东浪潮通软信息科技有限公司 Mirror image generation method, device and medium based on file system update
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

Also Published As

Publication number Publication date
CN110196728B (en) 2023-07-25

Similar Documents

Publication Publication Date Title
CN110196728A (en) The container-treatment and device of image upgrade
EP1915680B1 (en) Archiving data in a virtual application environment
US9880889B2 (en) Virtual application extension points
US8028006B2 (en) Method and apparatus for exchanging sub-hierarchical structures within a hierarchical file system
US11249745B2 (en) Image upgrade method and device
US9037541B2 (en) Metadata for data storage array
US7899795B1 (en) Method and system for recovering lost data volumes
US7334094B2 (en) Online clone volume splitting technique
US6857001B2 (en) Multiple concurrent active file systems
US8886995B1 (en) Fault tolerant state machine for configuring software in a digital computer
US8862600B2 (en) Content migration tool and method associated therewith
US20120191675A1 (en) Device and method for eliminating file duplication in a distributed storage system
US20170115909A1 (en) Data replica control
CN101375280A (en) Event structured file system (ESFS)
US10977134B2 (en) Restoration process to restore corrupted data of a volume
CN110515647A (en) A kind of static resource management method, device, equipment and storage medium
CN101228509B (en) Device and method for generating binary image
US20150302021A1 (en) Storage system
US20240004832A1 (en) System and method for providing a container environment in a single file
US9098730B2 (en) System and method for preserving electronically stored information
CN100504787C (en) Virtual executing method for installing software, and system
CN110096285A (en) Dispositions method, device, computer equipment and the storage medium of software systems
JP2008077478A (en) Storage control device, storage control method, storage device and storage control method by storage device
CN105243090A (en) Exclusive file acquisition method and system
US11886868B2 (en) Boot and update from runtime merged image fragments

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