CN111124612B - Container mirror image upgrading method and device, electronic equipment and storage medium - Google Patents

Container mirror image upgrading method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN111124612B
CN111124612B CN201911328681.3A CN201911328681A CN111124612B CN 111124612 B CN111124612 B CN 111124612B CN 201911328681 A CN201911328681 A CN 201911328681A CN 111124612 B CN111124612 B CN 111124612B
Authority
CN
China
Prior art keywords
container mirror
container
mirror image
image
images
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
CN201911328681.3A
Other languages
Chinese (zh)
Other versions
CN111124612A (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.)
Beijing Inspur Data Technology Co Ltd
Original Assignee
Beijing Inspur Data Technology 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 Beijing Inspur Data Technology Co Ltd filed Critical Beijing Inspur Data Technology Co Ltd
Priority to CN201911328681.3A priority Critical patent/CN111124612B/en
Publication of CN111124612A publication Critical patent/CN111124612A/en
Application granted granted Critical
Publication of CN111124612B publication Critical patent/CN111124612B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/61Installation
    • G06F8/63Image based installation; Cloning; Build to order
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45562Creating, deleting, cloning virtual machine instances

Abstract

The application discloses a method, a device, equipment and a medium for upgrading container mirror images, which comprise the following steps: acquiring and analyzing a public configuration file; renaming the original container mirror image in the current operating system in batches by using a first preset script according to a naming rule defined in a public configuration file to obtain the named original container mirror image; based on defined mirror image naming rules and packaging parameters, utilizing a second preset script to package and name all newly created container mirror images in batches, and uploading all generated newly created container mirror image packages to a preset warehouse in batches; and determining the container mirror images to be upgraded which are matched with all newly-built container mirror image packages in the named original container mirror images by using the container mirror image names, and replacing the storage addresses of the container mirror images to be upgraded in batches by using the storage addresses of all newly-built container mirror image packages to finish the upgrading of the container mirror images. Automatic packing and batch processing of container mirror images are realized through the preset scripts, labor and time cost can be saved, and working efficiency is improved.

Description

Container mirror image upgrading method and device, electronic equipment and storage medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method and an apparatus for upgrading a container image, an electronic device, and a computer-readable storage medium.
Background
With the development of information technology, cloud computing has gradually become a development hotspot in the industry. Under the background that container technology is well developed, the advantages of convenience and high efficiency of the container for providing services for users in the cloud computing field are gradually highlighted, and meanwhile, the maintenance work of the container cluster also brings huge work burden to operation and maintenance personnel. When the container mirror image is upgraded, a large amount of manpower and time cost are undoubtedly consumed in the traditional manual upgrading mode, and the working efficiency is low.
Therefore, how to provide an effective container image upgrading method is a problem to be solved by those skilled in the art.
Disclosure of Invention
The application aims to provide a container mirror image upgrading method and device, an electronic device and a computer readable storage medium, so that labor and time cost are effectively saved, and working efficiency is remarkably improved.
In order to achieve the above object, the present application provides a method for upgrading a container image, including:
acquiring and analyzing a public configuration file to obtain a mirror image naming rule and a mirror image packaging parameter defined in the public configuration file;
renaming the original container mirror images generated in the current operating system in batches by utilizing a first preset script according to the naming rule to obtain the named original container mirror images;
based on the mirror image naming rule and the packing parameters, utilizing a second preset script to pack and name all newly created container mirror images in batches, and uploading all generated newly created container mirror image packages to a preset warehouse in batches;
and determining the container mirror images to be upgraded in the named original container mirror images, which are matched with all the newly-built container mirror image packages, by using the container mirror image names, and replacing the storage addresses of the container mirror images to be upgraded in batches by using the storage addresses of all the newly-built container mirror image packages to complete the upgrading of the container mirror images.
Optionally, the renaming, in batches, the original container mirror image that has been generated in the current operating system by using the first preset script according to the naming rule to obtain the named original container mirror image includes:
acquiring all original container images which are generated in a current operating system;
determining a first system architecture and a first project branch to which each original container mirror belongs, and a first creation time corresponding to each original container mirror;
and renaming all the original container mirror images in batches by using the first preset script according to the combination mode of the first system architecture, the first project branch and the first creation time to obtain the named original container mirror images.
Optionally, the determining, by using the container mirror name, the container mirror image to be upgraded in the named original container mirror image, which is matched with all the newly-built container mirror image packages, includes:
determining a second system architecture and a second project branch to which each newly-built container mirror image package belongs according to the container mirror image name of the newly-built container mirror image package;
searching whether the named original container mirror images with the same first system architecture and the same second system architecture and the same first item branch and the same second item branch exist in all the named original container mirror images;
if so, determining the original container mirror image after the current naming as the container mirror image to be upgraded.
Optionally, the method further includes:
and calling a Restful interface of the preset warehouse by using a third preset script according to the deletion request, and deleting the corresponding target container mirror images in the preset warehouse in batches.
Optionally, the calling, according to the deletion request, a Restful interface of the preset warehouse by using a third preset script to delete the corresponding target container mirror images in the preset warehouse in batch includes:
determining a searching mode aiming at the target container mirror image according to the deleting request; the searching mode comprises any one or combination of any several of a mode of searching according to keywords, a mode of searching according to wildcards and a mode of searching according to regular expressions;
and determining all target container mirror images based on the searching mode, and calling Restful interfaces of the preset warehouse by using the third preset script to delete all the target container mirror images in batches.
Optionally, the replacing, in batches, the storage addresses of the container images to be upgraded by using the storage addresses of all the newly-built container image packages, and before the upgrading of the container images is completed, the method further includes:
receiving a self-defined upgrading mode through a preset input interface so as to upgrade the container mirror image based on the upgrading mode; the upgrading mode comprises any one or combination of gray scale upgrading, smooth upgrading and rolling upgrading.
In order to achieve the above object, the present application provides a container image upgrading apparatus, including:
the configuration analysis module is used for acquiring and analyzing a public configuration file to obtain a mirror image naming rule and a mirror image packaging parameter defined in the public configuration file;
the mirror image naming module is used for renaming the original container mirror images generated in the current operating system in batches by utilizing a first preset script according to the naming rule to obtain the named original container mirror images;
the mirror image packaging module is used for packaging and naming all newly created container mirror images in batches by utilizing a second preset script based on the mirror image naming rule and the packaging parameters, and uploading all generated newly created container mirror image packages to a preset warehouse in batches;
and the mirror image upgrading module is used for determining the mirror images of the containers to be upgraded, which are matched with all the newly-built container mirror image packages, in the named original container mirror images by using the container mirror image names, and replacing the storage addresses of the container mirror images to be upgraded in batches by using the storage addresses of all the newly-built container mirror image packages to complete the upgrading of the container mirror images.
Optionally, the mirror naming module includes:
the system comprises an original mirror image acquisition unit, a storage unit and a processing unit, wherein the original mirror image acquisition unit is used for acquiring all original container mirror images which are generated in a current operating system;
the system comprises a framework branch determining unit, a first item branch determining unit and a first creating time determining unit, wherein the framework branch determining unit is used for determining a first system framework and a first item branch to which each original container mirror belongs and a first creating time corresponding to each original container mirror;
and the batch renaming unit is used for renaming all the original container mirror images in batches by using the first preset script according to the combination mode of the first system architecture, the first project branch and the first creation time to obtain the named original container mirror images.
To achieve the above object, the present application provides an electronic device including:
a memory for storing a computer program;
a processor for implementing the steps of any of the container image upgrade methods disclosed above when executing the computer program.
To achieve the above object, the present application provides a computer-readable storage medium, on which a computer program is stored, the computer program, when executed by a processor, implementing the steps of any one of the container image upgrading methods disclosed in the foregoing.
According to the scheme, the container image upgrading method provided by the application comprises the following steps: acquiring and analyzing a public configuration file to obtain a mirror image naming rule and a mirror image packaging parameter defined in the public configuration file; renaming the original container mirror images generated in the current operating system in batches by utilizing a first preset script according to the naming rule to obtain the named original container mirror images; based on the mirror image naming rule and the packing parameters, utilizing a second preset script to pack and name all newly created container mirror images in batches, and uploading all generated newly created container mirror image packages to a preset warehouse in batches; and determining the container mirror images to be upgraded in the named original container mirror images, which are matched with all the newly-built container mirror image packages, by using the container mirror image names, and replacing the storage addresses of the container mirror images to be upgraded in batches by using the storage addresses of all the newly-built container mirror image packages to complete the upgrading of the container mirror images.
According to the method and the device, when the container mirror image is upgraded, the first preset script can be used for renaming the original container mirror image in batches, the second preset script is used for packing and naming all newly created container mirror images in batches, and all generated newly created container mirror image packages are uploaded to the preset warehouse in batches. The container mirror image to be upgraded is determined, and the storage address of the container mirror image to be upgraded is correspondingly replaced by the storage address of the newly-built container mirror image package, so that the upgrading of the container mirror image is realized. That is, this application realizes the automatic packing of container mirror image through predetermineeing the script, and can carry out batch processing to a plurality of container mirror images, has effectively saved manpower and time cost, is showing and is improving work efficiency. The application also discloses a container mirror image upgrading device, an electronic device and a computer readable storage medium, and the technical effects can be realized.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the application.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a flowchart of a method for upgrading a container image according to an embodiment of the present disclosure;
fig. 2 is a flowchart of another container image upgrading method disclosed in an embodiment of the present application;
fig. 3 is a structural diagram of a container image upgrading apparatus disclosed in an embodiment of the present application;
fig. 4 is a block diagram of an electronic device disclosed in an embodiment of the present application;
fig. 5 is a block diagram of another electronic device disclosed in the embodiments of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
In the prior art, when the container mirror image is upgraded, a large amount of manpower and time cost are undoubtedly consumed in the traditional manual upgrading mode, and the working efficiency is low
Therefore, the embodiment of the application discloses a container mirror image upgrading method, so that the labor and time cost is effectively saved, and the working efficiency is obviously improved.
Referring to fig. 1, a method for upgrading a container image disclosed in an embodiment of the present application includes:
s101: acquiring and analyzing a public configuration file to obtain a mirror image naming rule and a mirror image packaging parameter defined in the public configuration file;
in the embodiment of the application, a common configuration file for configuring a container image is obtained first. The manner of obtaining the common configuration file may include, but is not limited to, importing the file through a preset interface, or generating the common configuration file in real time. After the public configuration file is acquired, the public configuration file is analyzed to acquire the mirror naming rule and the mirror packaging parameters defined in the public configuration file.
S102: renaming the original container mirror images generated in the current operating system in batches by utilizing a first preset script according to the naming rule to obtain the named original container mirror images;
it should be noted that, in the embodiment of the present application, a first preset script is provided, where the first preset script is specifically used to rename a mirror image in a batch. After the public configuration file is analyzed to obtain the mirror naming rule, the first preset script can be called to automatically perform batch renaming operation on the original container mirror which is generated in the current operating system. The original container mirror image and the newly-built container mirror image can use the same mirror image naming rule by renaming the existing original container mirror image according to the mirror image naming rule, so that the corresponding relation between the original container mirror image and the newly-built container mirror image can be clearly and quickly determined through the mirror image name.
S103: based on the mirror image naming rule and the packing parameters, utilizing a second preset script to pack and name all newly created container mirror images in batches, and uploading all generated newly created container mirror image packages to a preset warehouse in batches;
specifically, for a newly created container mirror image, the embodiment of the present application may further specifically provide a second preset script, where the second preset script is used to package and name the newly created container mirror image in batches based on defined mirror image naming rules and packaging parameters, generate a newly created container mirror image package after packaging, and upload all the newly created container mirror image packages to a preset warehouse in batches.
S104: and determining the container mirror images to be upgraded in the named original container mirror images, which are matched with all the newly-built container mirror image packages, by using the container mirror image names, and replacing the storage addresses of the container mirror images to be upgraded in batches by using the storage addresses of all the newly-built container mirror image packages to complete the upgrading of the container mirror images.
In this step, because the renamed original container mirror image and the newly-built container mirror image use the same mirror image naming rule, the renamed original container mirror image matched with all the newly-built container mirror image packages in the renamed original container mirror image can be directly determined based on the container mirror image name, namely the container mirror image to be upgraded, and then the storage address of the container mirror image to be upgraded is replaced by the storage address of the newly-built container mirror image package, namely the upgrading of the container mirror image is realized. In specific implementation, the replacement process of the storage address can also adopt a batch replacement mode, so that the working time can be further reduced.
It should be noted that, in order to further enable the new container mirror image package to take effect, after the address batch replacement is performed, whether the current system adopts a hot update mode or not can be judged, and if so, the pod restart is not required; if not, the pod needs to be restarted to validate the newly created container image package. The pod is specifically a minimum deployable unit which can create and manage Kubernets calculation and is composed of one or more containers.
It can be understood that the embodiment of the application can also realize batch deletion aiming at container images. Specifically, a third preset script for realizing batch deletion is provided in advance, and after a deletion request for the container images is obtained, a Restful interface of a preset warehouse can be called by using the third preset script according to the deletion request, so as to perform batch deletion on the corresponding target container images in the preset warehouse. In a possible implementation manner, the process of implementing batch deletion by using the third preset script according to the deletion request may specifically include: determining a searching mode aiming at the mirror image of the target container according to the deleting request; and determining all target container mirror images based on the searching mode, and calling a Restful interface of a preset warehouse by using a third preset script to delete all the target container mirror images in batches. The search method may include, but is not limited to: the search mode is carried out according to the keywords, the search mode is carried out according to the wildcards, and the search mode is carried out according to the regular expressions.
As a preferred implementation manner, in the embodiment of the present application, before the storage addresses of all newly-built container image packages are used to replace the storage addresses of the container images to be upgraded in batch and upgrade the container images is completed, a preset input interface may be further provided, and an upgrade manner defined by a user is received based on the preset input interface, so that the container images may be upgraded based on the upgrade manner required by the user. Specifically, the upgrading method may include, but is not limited to: gray scale upgrade, smooth upgrade, rolling upgrade, etc.
According to the method and the device, when the container mirror image is upgraded, the first preset script can be used for renaming the original container mirror image in batches, the second preset script is used for packing and naming all newly created container mirror images in batches, and all generated newly created container mirror image packages are uploaded to the preset warehouse in batches. The container mirror image to be upgraded is determined, and the storage address of the container mirror image to be upgraded is correspondingly replaced by the storage address of the newly-built container mirror image package, so that the upgrading of the container mirror image is realized. That is, this application realizes the automatic packing of container mirror image through predetermineeing the script, and can carry out batch processing to a plurality of container mirror images, has effectively saved manpower and time cost, is showing and is improving work efficiency.
The embodiment of the application discloses another container image upgrading method, and compared with the previous embodiment, the embodiment further explains and optimizes the technical scheme. Referring to fig. 2, specifically:
s201: acquiring and analyzing a public configuration file to obtain a mirror image naming rule and a mirror image packaging parameter defined in the public configuration file;
s202: acquiring all original container images which are generated in a current operating system;
s203: determining a first system architecture and a first project branch to which each original container mirror belongs, and a first creation time corresponding to each original container mirror;
s204: renaming all the original container mirror images in batches by using the first preset script according to the combination mode of the first system architecture, the first project branch and the first creation time to obtain the named original container mirror images;
in the embodiment of the present application, a specific mirror naming rule is adopted, that is, a combination of a system architecture to which a container mirror belongs, a project branch, and corresponding creation time is used as a name of the container mirror. Therefore, when the original container mirror images need to be renamed, a first system architecture and a first project branch which each original container mirror image belongs to and a first creation time corresponding to each original container mirror image are determined, and then the combination of the three parameters is used as an original container mirror image name according to a mirror image naming rule to obtain the named original container mirror images.
S205: based on the mirror image naming rule and the packing parameters, utilizing a second preset script to pack and name all newly created container mirror images in batches, and uploading all generated newly created container mirror image packages to a preset warehouse in batches;
s206: determining a second system architecture and a second project branch to which each newly-built container mirror image package belongs according to the container mirror image name of the newly-built container mirror image package;
s207: searching whether the named original container mirror images with the same first system architecture and the same second system architecture and the same first item branch and the same second item branch exist in all the named original container mirror images; if yes, go to step S208;
s208: determining the mirror image of the original container after the current naming as the mirror image of the container to be upgraded;
in specific implementation, the system architecture and the project branch to which each new container mirror package belongs can be obtained according to the container mirror name of the new container mirror package, so that whether the named original container mirror images with the first system architecture identical to the second system architecture and the first project branch identical to the second project branch exist in all the named original container mirror images can be searched. If the named original container mirror image exists, the fact that the named original container mirror image has a corresponding newly-built container mirror image package is indicated, and the named original container mirror image can be determined as the container mirror image to be upgraded so that a subsequent storage address replacement process can be expanded.
It can be understood that, after finding the named original container mirror image with the same first system architecture and the same second system architecture and the same first project branch and the same second project branch, it may also be compared whether the creation time of the named original container mirror image is the same as the creation time of the newly created container mirror image package, and if so, it indicates that the two mirror images are the same version, and replacement and upgrade are not needed.
It should be noted that, in the embodiment of the present application, a specific mirror naming rule is provided, and in a specific implementation, other mirror naming rules may be set according to business requirements, which is not specifically limited in this embodiment.
S209: and replacing the storage addresses of the container images to be upgraded in batches by using the storage addresses of all the newly-built container image packages to finish upgrading the container images.
In the following, a container image upgrading apparatus provided in an embodiment of the present application is introduced, and a container image upgrading apparatus described below and a container image upgrading method described above may be referred to each other.
Referring to fig. 3, a container image upgrading apparatus provided in an embodiment of the present application includes:
a configuration analysis module 301, configured to obtain and analyze a public configuration file to obtain a mirror naming rule and a mirror packaging parameter defined in the public configuration file;
the mirror image naming module 302 is used for renaming the original container mirror images generated in the current operating system in batches by utilizing a first preset script according to the naming rule to obtain the named original container mirror images;
the mirror image packaging module 303 is configured to package and name all newly created container mirror images in batches by using a second preset script based on the mirror image naming rule and the packaging parameters, and upload all generated newly created container mirror image packages to a preset warehouse in batches;
and the mirror image upgrading module 304 is configured to determine, by using container mirror image names, container mirror images to be upgraded in the named original container mirror images, where the container mirror images to be upgraded are matched with all the newly-built container mirror image packages, and replace, in batches, storage addresses of the container mirror images to be upgraded by using storage addresses of all the newly-built container mirror image packages, so as to complete upgrading of the container mirror images.
For the specific implementation process of the modules 301 to 304, reference may be made to the corresponding content disclosed in the foregoing embodiments, and details are not repeated here.
On the basis of the foregoing embodiment, as a preferred implementation manner, the mirror naming module 302 may specifically include:
the system comprises an original mirror image acquisition unit, a storage unit and a processing unit, wherein the original mirror image acquisition unit is used for acquiring all original container mirror images which are generated in a current operating system;
the system comprises a framework branch determining unit, a first item branch determining unit and a first creating time determining unit, wherein the framework branch determining unit is used for determining a first system framework and a first item branch to which each original container mirror belongs and a first creating time corresponding to each original container mirror;
and the batch renaming unit is used for renaming all the original container mirror images in batches by using the first preset script according to the combination mode of the first system architecture, the first project branch and the first creation time to obtain the named original container mirror images.
The present application further provides an electronic device, and as shown in fig. 4, an electronic device provided in an embodiment of the present application includes:
a memory 100 for storing a computer program;
the processor 200, when executing the computer program, may implement the steps provided by the above embodiments.
Specifically, the memory 100 includes a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and computer-readable instructions, and the internal memory provides an environment for the operating system and the computer-readable instructions in the non-volatile storage medium to run. The processor 200 may be a Central Processing Unit (CPU), a controller, a microcontroller, a microprocessor or other data Processing chip in some embodiments, and provides computing and controlling capability for the electronic device, and when executing the computer program stored in the memory 100, the steps of the container image upgrading method disclosed in any of the foregoing embodiments may be implemented.
On the basis of the above embodiment, as a preferred implementation, referring to fig. 5, the electronic device further includes:
and an input interface 300 connected to the processor 200, for acquiring computer programs, parameters and instructions imported from the outside, and storing the computer programs, parameters and instructions into the memory 100 under the control of the processor 200. The input interface 300 may be connected to an input device for receiving parameters or instructions manually input by a user. The input device may be a touch layer covered on a display screen, or a button, a track ball or a touch pad arranged on a terminal shell, or a keyboard, a touch pad or a mouse, etc.
And a display unit 400 connected to the processor 200 for displaying data processed by the processor 200 and for displaying a visualized user interface. The display unit 400 may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode) touch panel, or the like.
And a network port 500 connected to the processor 200 for performing communication connection with each external terminal device. The communication technology adopted by the communication connection can be a wired communication technology or a wireless communication technology, such as a mobile high definition link (MHL) technology, a Universal Serial Bus (USB), a High Definition Multimedia Interface (HDMI), a wireless fidelity (WiFi), a bluetooth communication technology, a low power consumption bluetooth communication technology, an ieee802.11 s-based communication technology, and the like.
While FIG. 5 shows only an electronic device having the assembly 100 and 500, those skilled in the art will appreciate that the configuration shown in FIG. 5 does not constitute a limitation of the electronic device, and may include fewer or more components than shown, or some components may be combined, or a different arrangement of components.
The present application also provides a computer-readable storage medium, which may include: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk. The storage medium has a computer program stored thereon, and the computer program realizes the steps of the container image upgrading method disclosed in any one of the foregoing embodiments when executed by a processor.
When the container mirror image is upgraded, the method and the system can firstly utilize the first preset script to rename the original container mirror image in batches, utilize the second preset script to package and name all newly created container mirror images in batches, and upload all newly created container mirror image packages generated to a preset warehouse in batches. The container mirror image to be upgraded is determined, and the storage address of the container mirror image to be upgraded is correspondingly replaced by the storage address of the newly-built container mirror image package, so that the upgrading of the container mirror image is realized. That is, this application realizes the automatic packing of container mirror image through predetermineeing the script, and can carry out batch processing to a plurality of container mirror images, has effectively saved manpower and time cost, is showing and is improving work efficiency.
The embodiments are described in a progressive manner in the specification, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other. For the system disclosed by the embodiment, the description is relatively simple because the system corresponds to the method disclosed by the embodiment, and the relevant points can be referred to the method part for description. It should be noted that, for those skilled in the art, it is possible to make several improvements and modifications to the present application without departing from the principle of the present application, and such improvements and modifications also fall within the scope of the claims of the present application.
It is further noted that, in the present specification, relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.

Claims (8)

1. A method for upgrading a container image is characterized by comprising the following steps:
acquiring and analyzing a public configuration file to obtain a mirror image naming rule and a mirror image packaging parameter defined in the public configuration file;
renaming the original container mirror images generated in the current operating system in batches by utilizing a first preset script according to the mirror image naming rule to obtain the named original container mirror images, wherein the renaming method comprises the following steps: acquiring all original container images which are generated in a current operating system; determining a first system architecture and a first project branch to which each original container mirror belongs, and a first creation time corresponding to each original container mirror; renaming all the original container mirror images in batches by using the first preset script according to the combination mode of the first system architecture, the first project branch and the first creation time to obtain the named original container mirror images;
based on the mirror image naming rule and the packing parameters, utilizing a second preset script to pack and name all newly created container mirror images in batches, and uploading all generated newly created container mirror image packages to a preset warehouse in batches;
and determining the container mirror images to be upgraded in the named original container mirror images, which are matched with all the newly-built container mirror image packages, by using the container mirror image names, and replacing the storage addresses of the container mirror images to be upgraded in batches by using the storage addresses of all the newly-built container mirror image packages to complete the upgrading of the container mirror images.
2. The method for upgrading a container image according to claim 1, wherein the determining, by using a container image name, the container image to be upgraded in the named original container image, which matches with all the newly created container image packages, comprises:
determining a second system architecture and a second project branch to which each newly-built container mirror image package belongs according to the container mirror image name of the newly-built container mirror image package;
searching whether the named original container mirror images with the same first system architecture and the same second system architecture and the same first item branch and the same second item branch exist in all the named original container mirror images;
if so, determining the original container mirror image after the current naming as the container mirror image to be upgraded.
3. The container image upgrade method according to claim 1, further comprising:
and calling a Restful interface of the preset warehouse by using a third preset script according to the deletion request, and deleting the corresponding target container mirror images in the preset warehouse in batches.
4. The method for upgrading the container image according to claim 3, wherein the calling a Restful interface of the preset warehouse by using a third preset script according to the deletion request to delete the corresponding target container images in the preset warehouse in batch comprises:
determining a searching mode aiming at the target container mirror image according to the deleting request; the searching mode comprises any one or combination of any several of a mode of searching according to keywords, a mode of searching according to wildcards and a mode of searching according to regular expressions;
and determining all target container mirror images based on the searching mode, and calling Restful interfaces of the preset warehouse by using the third preset script to delete all the target container mirror images in batches.
5. The method for upgrading a container image according to any one of claims 1 to 4, wherein the step of replacing the storage addresses of the container images to be upgraded in batch by using the storage addresses of all the newly-built container image packages further comprises, before the step of upgrading the container images, the steps of:
receiving a self-defined upgrading mode through a preset input interface so as to upgrade the container mirror image based on the upgrading mode; the upgrading mode comprises any one or combination of gray scale upgrading, smooth upgrading and rolling upgrading.
6. A container image upgrade apparatus, comprising:
the configuration analysis module is used for acquiring and analyzing a public configuration file to obtain a mirror image naming rule and a mirror image packaging parameter defined in the public configuration file;
the mirror image naming module is used for renaming the original container mirror images generated in the current operating system in batches by utilizing a first preset script according to the mirror image naming rule to obtain the named original container mirror images; the mirror naming module comprises: the system comprises an original mirror image acquisition unit, a storage unit and a processing unit, wherein the original mirror image acquisition unit is used for acquiring all original container mirror images which are generated in a current operating system; the system comprises a framework branch determining unit, a first item branch determining unit and a first creating time determining unit, wherein the framework branch determining unit is used for determining a first system framework and a first item branch to which each original container mirror belongs and a first creating time corresponding to each original container mirror; the batch renaming unit is used for renaming all the original container mirror images in batches by using the first preset script according to the combination mode of the first system architecture, the first project branch and the first creation time to obtain the named original container mirror images;
the mirror image packaging module is used for packaging and naming all newly created container mirror images in batches by utilizing a second preset script based on the mirror image naming rule and the packaging parameters, and uploading all generated newly created container mirror image packages to a preset warehouse in batches;
and the mirror image upgrading module is used for determining the mirror images of the containers to be upgraded, which are matched with all the newly-built container mirror image packages, in the named original container mirror images by using the container mirror image names, and replacing the storage addresses of the container mirror images to be upgraded in batches by using the storage addresses of all the newly-built container mirror image packages to complete the upgrading of the container mirror images.
7. An electronic device, comprising:
a memory for storing a computer program;
a processor for implementing the steps of the container image upgrade method according to any one of claims 1 to 5 when executing the computer program.
8. A computer-readable storage medium, having stored thereon a computer program which, when being executed by a processor, carries out the steps of the container image upgrade method according to any one of claims 1 to 5.
CN201911328681.3A 2019-12-20 2019-12-20 Container mirror image upgrading method and device, electronic equipment and storage medium Active CN111124612B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911328681.3A CN111124612B (en) 2019-12-20 2019-12-20 Container mirror image upgrading method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911328681.3A CN111124612B (en) 2019-12-20 2019-12-20 Container mirror image upgrading method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN111124612A CN111124612A (en) 2020-05-08
CN111124612B true CN111124612B (en) 2022-04-22

Family

ID=70500790

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911328681.3A Active CN111124612B (en) 2019-12-20 2019-12-20 Container mirror image upgrading method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN111124612B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111752676B (en) * 2020-05-28 2022-06-21 苏州浪潮智能科技有限公司 Docker-based homonymous mirror image removing method, system, terminal and storage medium
CN111414612B (en) * 2020-06-05 2020-10-16 腾讯科技(深圳)有限公司 Security protection method and device for operating system mirror image and electronic equipment

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102495733A (en) * 2011-12-08 2012-06-13 方正国际软件有限公司 Methods for detecting compatibility of application program and relevant database script and performing upgrading maintenance on application program and relevant database script
CN102541593A (en) * 2011-12-20 2012-07-04 福建星网视易信息系统有限公司 Rapid comparison method of versions of remote files

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8209680B1 (en) * 2003-04-11 2012-06-26 Vmware, Inc. System and method for disk imaging on diverse computers
US20060271885A1 (en) * 2005-05-25 2006-11-30 Montana State University Automatic database entry and data format modification

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102495733A (en) * 2011-12-08 2012-06-13 方正国际软件有限公司 Methods for detecting compatibility of application program and relevant database script and performing upgrading maintenance on application program and relevant database script
CN102541593A (en) * 2011-12-20 2012-07-04 福建星网视易信息系统有限公司 Rapid comparison method of versions of remote files

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
云计算实验平台虚拟机镜像的管理与维护;金永霞等;《实验技术与管理》;20171117;第34卷(第11期);第103-105页 *

Also Published As

Publication number Publication date
CN111124612A (en) 2020-05-08

Similar Documents

Publication Publication Date Title
CN103092665B (en) Immediate updating device and immediate updating method
US20140164391A1 (en) Data block saving system and method
CN108874924B (en) Method and device for creating search service and computer-readable storage medium
WO2019019769A1 (en) Service function implementation method, device, computer apparatus and storage medium
CN108536745B (en) Shell-based data table extraction method, terminal, equipment and storage medium
CN109194714B (en) File pushing method and device, terminal device and storage medium
CN111124612B (en) Container mirror image upgrading method and device, electronic equipment and storage medium
US20130311143A1 (en) System and method for generating a lighting plan
CN110880136A (en) Recommendation method, system, equipment and storage medium for matched product
CN110555073A (en) data processing method and device, electronic equipment and storage medium
CN112256348B (en) Cloud service platform creation method and system, electronic equipment and storage medium
CN111596911B (en) Method, device, computer equipment and storage medium for generating control
CN103379476A (en) Terminal and contact information updating method
CN111068328A (en) Game advertisement configuration table generation method, terminal device and medium
CN110020231A (en) Webpage capture method and device thereof
CN105765533A (en) Method and apparatus for firmware virtualization
US8856740B2 (en) Implementing multiple versions of a plug-in concurrently
CN111866158B (en) Routing method, routing device, computer equipment and storage medium
CN111443910A (en) Skin rendering method and device, electronic equipment and computer storage medium
CN110807002B (en) Report generation method, system and equipment based on workflow and storage medium
CN111008106B (en) Server monitoring management method and device, electronic equipment and storage medium
CN112149035A (en) Website static resource processing method and device
CN105187562A (en) System and method for operating remote file
CN103123651A (en) Method of rapidly searching multiple same-kind paper, device and mobile equipment
CN113918437A (en) User behavior data analysis method and device, computer equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant