Mirror stacking method, device, equipment, medium and program product
Through the mirror stacking method, multiple different images are superimposed on one target image, solving the problems of complex image development and waste of storage space in the prior art, realizing a simplified software delivery and deployment process, and improving user experience.
Patent Information
- Application Number
- CN202210394838.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-15
- Publication Date
- 2025-04-01
- Estimated Expiration
- 2042-04-15
AI Technical Summary
Existing image developers need to build and modify images for each institution or user to meet specific requirements, resulting in complex development, high error rates and waste of storage space.
A mirror stacking method is provided, allowing multiple different images to be superimposed on one target image, and by obtaining multiple images to be superimposed and superimposed according to preset rules when preset conditions are met, a target image that can be used for operation of the same container is generated.
Simplifies the software delivery and deployment process, improves user experience, reduces developer workload, and saves storage space.
Smart Images

Figure CN114936066B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a mirror stacking method, device, equipment, medium and program product. Background Art
[0002] An image is a special file system that contains all the materials for container operation, including executable files, dependent libraries, and operation-related configurations. The container can completely isolate the execution environment inside the container defined by the image from the outside of the container. Image developers generally build separate images for each organization (user) or modify images to meet the organization's (user's) special requirements for images, such as requiring that the image must be based on a specific operating system, or that a specified executable file must be embedded in the image, and to implement upgrades to applications (APPs). Summary of the invention
[0003] The embodiments of this specification provide an image stacking method, device, equipment, medium and program product, which do not require developers or organizations to modify the original image, and can facilitate organizations (users) to stack multiple different images together and run them in the same container, while simplifying the software delivery and deployment process and improving the user experience. The above technical solutions are as follows:
[0004] In a first aspect, an embodiment of the present specification provides a mirror stacking method, including:
[0005] Obtain N images to be superimposed, wherein N is a positive integer greater than or equal to 2;
[0006] When the N images to be superimposed meet preset conditions, the N images to be superimposed are superimposed according to preset rules to obtain a target image.
[0007] In a possible implementation, after obtaining the N images to be superimposed, and before superimposing the N images to be superimposed according to a preset rule when the N images to be superimposed meet a preset condition, the method further includes:
[0008] Determine whether the N images to be superimposed meet the preset conditions.
[0009] In a possible implementation, the preset conditions are: the N images to be superimposed include an image of the first type and N-1 images of the second type, and the first target fields of the N images to be superimposed are the same; the image of the first type is an image that can be run independently; the image of the second type is an image that cannot be run independently; the first target field is used to characterize the development environment of the image to be superimposed.
[0010] In a possible implementation, the N images to be superimposed are superimposed according to a preset rule to obtain a target image, including:
[0011] The N-1 second-type images are superimposed on the one first-type image to obtain a target image.
[0012] In a possible implementation, the step of superimposing the N-1 images of the second type onto the one image of the first type to obtain a target image includes:
[0013] The second target fields of the N-1 second-type images are concatenated with the second target field of the first-type image to obtain a target image; the second target field is used to represent the layer file information and internal environment information of the image to be superimposed.
[0014] In a possible implementation, the N images to be superimposed are superimposed according to a preset rule to obtain a target image, including:
[0015] Superimposing the first image of the second type among the N-1 images of the second type with the image of the first type to obtain a first target image;
[0016] Superimposing a second image of the second type among the N-1 images of the second type with the first target image to obtain a second target image;
[0017] Until the N-1th image among the N-1 second type images is superimposed with the N-2th target image to obtain the target image.
[0018] In a possible implementation, the step of superimposing the first image of the second type among the N-1 images of the second type with the image of the first type to obtain the first target image includes:
[0019] The second target field of the first image of the second type in the N-1th image of the second type is concatenated with the second target field of the image of the first type to obtain a first target image;
[0020] The step of superimposing the second image of the second type among the N-1 images of the second type with the first target image to obtain the second target image includes:
[0021] The second target field of the second image of the second type among the N-1 images of the second type is concatenated with the second target field of the first target image to obtain a second target image;
[0022] The above step of superimposing the N-1th image of the N-1 second type images with the N-2th target image to obtain the target image includes:
[0023] until the second target field of the N-1th image among the N-1 images of the second type is concatenated with the second target field of the N-2th target image to obtain the target image;
[0024] The second target field is used to represent the layer file information and internal environment information of the image to be superimposed.
[0025] In a possible implementation manner, the values of other fields in the target image except the second target field are the values of the other fields of any one of the N images to be superimposed.
[0026] In a possible implementation, when the N images to be superimposed meet a preset condition, the N images to be superimposed are superimposed according to a preset rule to obtain a target image, and the method further includes:
[0027] Import the above target image into the container and run it.
[0028] In a possible implementation, after the target image is input into the container for execution, the method further includes:
[0029] Delete the above target image.
[0030] In a second aspect, an embodiment of the present specification provides a mirror stacking device, the device comprising:
[0031] An acquisition module, used to acquire N images to be superimposed; the above N is a positive integer greater than or equal to 2;
[0032] The superposition module is used to superimpose the N images to be superimposed according to preset rules to obtain a target image when the N images to be superimposed meet preset conditions.
[0033] In a possible implementation, the above device further includes:
[0034] The judging module is used to judge whether the N images to be superimposed meet the preset conditions.
[0035] In a possible implementation, the preset conditions are: the N images to be superimposed include an image of the first type and N-1 images of the second type, and the first target fields of the N images to be superimposed are the same; the image of the first type is an image that can be run independently; the image of the second type is an image that cannot be run independently; the first target field is used to characterize the development environment of the image to be superimposed.
[0036] In a possible implementation, the superposition module is specifically used to superimpose the N-1 images of the second type onto the one image of the first type to obtain a target image.
[0037] In a possible implementation, the overlay module is specifically used to splice the second target fields of the N-1 second-type images with the second target field of the first-type image to obtain a target image; the second target field is used to characterize the layer file information and internal environment information of the image to be overlaid.
[0038] In a possible implementation, the superposition module is specifically used to superimpose the first image of the second type among the N-1 images of the second type with the image of the first type to obtain a first target image;
[0039] Superimposing a second image of the second type among the N-1 images of the second type with the first target image to obtain a second target image;
[0040] Until the N-1th image among the N-1 second type images is superimposed with the N-2th target image to obtain the target image.
[0041] In a possible implementation, the superposition module is specifically used for:
[0042] The second target field of the first image of the second type in the N-1th image of the second type is concatenated with the second target field of the image of the first type to obtain a first target image;
[0043] The second target field of the second image of the second type among the N-1 images of the second type is concatenated with the second target field of the first target image to obtain a second target image;
[0044] until the second target field of the N-1th image among the N-1 images of the second type is concatenated with the second target field of the N-2th target image to obtain the target image;
[0045] The second target field is used to represent the layer file information and internal environment information of the image to be superimposed.
[0046] In a possible implementation manner, the values of other fields in the target image except the second target field are the values of the other fields of any one of the N images to be superimposed.
[0047] In a possible implementation, the above device further includes:
[0048] The input module is used to input the above target image into the container for running.
[0049] In a possible implementation, the above device further includes:
[0050] The deletion module is used to delete the above target image.
[0051] In a third aspect, an embodiment of this specification provides an electronic device, including: a processor and a memory;
[0052] The processor is connected to the memory;
[0053] The above-mentioned memory is used to store executable program code;
[0054] The processor runs a program corresponding to the executable program code by reading the executable program code stored in the memory, so as to execute the method provided by the first aspect of the embodiment of this specification or any possible implementation of the first aspect.
[0055] In a fourth aspect, an embodiment of the present specification provides a computer storage medium, wherein the computer storage medium stores a plurality of instructions, wherein the instructions are suitable for being loaded by a processor and executing the method steps provided by the first aspect of the embodiment of the present specification or any possible implementation of the first aspect.
[0056] In a fifth aspect, an embodiment of the present specification provides a computer program product comprising instructions, which, when the above-mentioned computer program product runs on a computer or a processor, enables the above-mentioned computer or the above-mentioned processor to execute the mirror stacking method provided by the first aspect of the embodiment of the present specification or any possible implementation method of the first aspect.
[0057] In the embodiments of the present specification, at least two images to be superimposed can be obtained from a network or a server, and when the at least two images to be superimposed meet preset conditions, the at least two images to be superimposed are superimposed according to preset rules to obtain a target image, so that the developer does not need to modify the original image, but only needs to make a standard image and distribute it to all users (institutions). If a user (institution) has special needs to adjust the image content, it only needs to superimpose the corresponding image before running, and the image content can be easily fine-tuned, making the production and use of the image more flexible, and achieving the ability to superimpose multiple different images together and put them into the same container for running, simplifying the software delivery and deployment process, and improving the user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0058] In order to more clearly illustrate the technical solutions in the embodiments of this specification, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this specification. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0059] Figure 1 A schematic diagram of the architecture of a mirror stacking system provided as an exemplary embodiment of this specification;
[0060] Figure 2 A schematic diagram of a process of a mirror stacking method provided as an exemplary embodiment of this specification;
[0061] Figure 3A A schematic diagram of the structure of a first preset mapping table provided as an exemplary embodiment of this specification;
[0062] Figure 3B A schematic diagram of the structure of a second preset mapping table provided as an exemplary embodiment of this specification;
[0063] Figure 4A A schematic diagram of an image to be superimposed provided as an exemplary embodiment of this specification;
[0064] Figure 4B A schematic diagram of another image to be superimposed provided as an exemplary embodiment of this specification;
[0065] Figure 4C A schematic diagram of another image to be superimposed provided as an exemplary embodiment of this specification;
[0066] Figure 4D A schematic diagram of a target image provided as an exemplary embodiment of this specification;
[0067] Figure 5A A schematic diagram of a first target image provided as an exemplary embodiment of this specification;
[0068] Figure 5B A schematic diagram of another target image provided as an exemplary embodiment of this specification;
[0069] Figure 6 A schematic flow chart of another mirror stacking method provided as an exemplary embodiment of this specification;
[0070] Figure 7 A schematic diagram of the structure of a mirror stacking device provided as an exemplary embodiment of this specification;
[0071] Figure 8 A schematic diagram of the structure of an electronic device provided as an exemplary embodiment of this specification. DETAILED DESCRIPTION
[0072] The technical solutions in the embodiments of this specification will be described clearly and completely below in conjunction with the drawings in the embodiments of this specification.
[0073] The terms "first", "second", "third", etc. in this specification and claims and the above drawings are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units that are not listed, or may optionally include other steps or units inherent to these processes, methods, products or devices.
[0074] Please refer to Figure 1 , Figure 1 The following is a schematic diagram of the architecture of a mirror stacking system provided by an exemplary embodiment of this specification. Figure 1 As shown, the mirror stacking system may include: a terminal cluster and a server 120. Among them:
[0075] The terminal cluster may be a user terminal, specifically including one or more user terminals, wherein the multiple user terminals may include user terminal 110a, user terminal 110b, user terminal 110c, etc. A user version of the software may be installed in the terminal cluster to implement functions such as the user inputting the names of N images to be superimposed online and superimposing N images to be superimposed. Any user terminal in the terminal cluster may establish a data relationship with the network, and establish a data connection relationship with the server 120 through the network, to implement functions such as downloading N images to be superimposed from the server 120 through the network. Among them, any user terminal in the terminal cluster may be, but is not limited to, a mobile phone, tablet computer, laptop computer, or other device with the user version of the software installed.
[0076] The server 120 may be a server that can provide multiple images, and may send N images and other data corresponding to the names of N images to be superimposed to any user terminal in the network or terminal cluster. The server 120 may be, but is not limited to, a hardware server, a virtual server, a cloud server, and the like.
[0077] The network may be a medium that provides a communication link between the server 120 and any user terminal in the terminal cluster, or may be the Internet including network devices and transmission media, but is not limited thereto. The transmission medium may be a wired link (such as, but not limited to, coaxial cable, optical fiber, and digital subscriber line (DSL)) or a wireless link (such as, but not limited to, wireless fidelity (WIFI), Bluetooth, and mobile device network).
[0078] Understandably, Figure 1 The number of terminal clusters and servers 120 in the mirror stack system shown is only an example. In a specific implementation, the mirror stack system may include any number of user terminals and servers. This specification embodiment does not specifically limit this. For example, but not limited to, the server 120 may be a server cluster consisting of multiple servers.
[0079] Since traditional images are immutable, their contents cannot be changed once they are made, which lacks flexibility. If you want to make some fine-tuning to the contents of the image, you can only make a new image. That is, when an organization (user) has special requirements for the image or the APP needs to be upgraded, the developer needs to build a dedicated image or modify the image for each organization. This process is not only complicated but also prone to errors. In addition, each organization's dedicated image must be pushed to the server's central image warehouse for storage. These similar but not exactly the same images will waste a lot of storage space. In order to solve the above problems, we will combine Figure 1 , introduces a mirror stacking method provided by the embodiment of this specification. For details, please refer to Figure 2 , which is a flow chart of a mirror stacking method provided by an exemplary embodiment of this specification. Figure 2 As shown, the mirror stacking method includes the following steps:
[0080] Step 202: Obtain N images to be superimposed.
[0081] Specifically, the above-mentioned image to be superimposed is an image that needs to be superimposed. At least one of the above-mentioned images to be superimposed can be run simultaneously in the same container. In order to realize image superposition, distinguish which images can be superimposed together and which images cannot be superimposed together, developers can assign different types to different images, and compile different image names corresponding to images of different types and functions, so as to obtain multiple images to be superimposed that can meet the needs of most users after superposition. Developers can upload the above-mentioned multiple images to be superimposed to the network or server 120, so that the organization (user) can superimpose the images to be superimposed according to their needs, thereby greatly reducing the workload of developers and simplifying the software delivery and deployment process. At the same time, when the organization (user) has new needs, the developer only needs to make a relatively streamlined image to be superimposed and upload it to the network or server 120 according to the new needs of the organization (user), so as to avoid repeated construction of the image.
[0082] Optionally, when the user wants to implement certain specific functions, the user can select N images to be superimposed corresponding to the image functions required by the user according to the first preset mapping table, and input the names corresponding to the above N images to be superimposed into the terminal. The above first preset mapping table includes the names corresponding to the multiple images to be superimposed and the functions corresponding to the above multiple images to be superimposed one by one. After the terminal receives the above N image names, it can obtain the corresponding N images to be superimposed from the server 120 through the network according to the above N image names. The image stacking system in this specification is not limited to Figure 1 The structure shown may also include only a terminal, that is, after receiving the above N image names, the terminal may also directly obtain the corresponding N images to be superimposed from a database stored in the terminal according to the above N image names, and this specification does not limit this.
[0083] For example, Figure 3A As shown, it is a schematic diagram of the structure of a first preset mapping table provided by an exemplary embodiment of the present specification. When the user wants to implement function 2 and function 3, two images to be superimposed, whose image names (RepoTags) are centos2 and centos3 corresponding to function 2 and function 3 respectively, can be selected according to the first preset mapping table, and the image names of the two images to be superimposed can be input into the terminal, so that the terminal can obtain the corresponding two images to be superimposed from the server 120 through the network according to the two image names input by the user.
[0084] Optionally, the user can select a mirror group to be superimposed corresponding to the mirror function required by the user according to the second preset mapping table, and input all the N mirror names, i.e. all the mirror names, in the mirror group to be superimposed into the terminal. The second preset mapping table includes multiple mirror groups to be superimposed and functions corresponding to the multiple mirror groups to be superimposed. Each of the mirror groups to be superimposed includes mirror names corresponding to at least two mirrors to be superimposed. After the terminal receives the N mirror names, it can obtain the corresponding N mirrors to be superimposed from the server 120 through the network according to the N mirror names. The value of N is the number of corresponding mirror names to be superimposed in the mirror group to be superimposed selected by the user.
[0085] Specifically, the N images to be superimposed include an image of the first type and N-1 images of the second type, and the first target fields of the N images to be superimposed are the same.
[0086] Specifically, the first type of image is an image that can run independently. In the embodiments of this specification, the first type of image is referred to as a standard image. The layer file of the first type of image contains all the files required for execution, such as executable files, library files that the execution depends on, configuration files, etc. The first type of image includes an operating system file for the above executable file to run.
[0087] Specifically, the second type of image is an image that cannot be run independently. In the embodiments of this specification, the second type of image is called a Lite image. The second type of image is not bound to an operating system, and its layer file only contains a part of the files required for operation. Therefore, the second type of image cannot be run independently and must be superimposed with other first type images such as standard images containing operating system files.
[0088] Specifically, the first target field is used to characterize the development environment of the image to be superimposed. The first target field may include a processor architecture type (Architecture field) and an operating system type (operating system, OS field). The processor architecture type may include amd64 (x86-64), Intel 32-bit architecture (Intel Architecture 32-bit, IA-32), etc., which is not limited in the embodiments of this specification. The amd64 belongs to the 64-bit version of the X86 architecture, which is a 64-bit computer processor architecture. The IA-32 belongs to the 32-bit version of the X86 architecture, i.e., a processor architecture with a 32-bit memory address and a 32-bit data operand. The operating system type may include a Windows operating system, a Linux operating system, etc., which is not limited in the embodiments of this specification.
[0089] For example, Figure 3B As shown in FIG. 1 , it is a schematic diagram of the structure of a second preset mapping table provided by an exemplary embodiment of this specification. When the user wants to implement function 2 and function 3, the mirror group to be superimposed corresponding only to function 2 and function 3 can be selected according to the second preset mapping table. Figure 3B It can be seen that the image group to be superimposed corresponding to function 2 and function 3 includes two images to be superimposed with image names (RepoTags) centos2 and centos3, and the image to be superimposed with image name centos2 is a first type of image, and the image to be superimposed with image name centos3 is a second type of image. The image names of the above two images to be superimposed are input into the terminal in sequence, so that the terminal obtains the corresponding two images to be superimposed from the server 120 through the network according to the two image names received from the user input. At this time, the first target fields of the above two images to be superimposed are the same.
[0090] Step 204 : When the N images to be superimposed meet preset conditions, the N images to be superimposed are superimposed according to preset rules to obtain a target image.
[0091] Optionally, after obtaining N images to be superimposed according to the first preset mapping table, it is necessary to first determine whether the N images to be superimposed meet a preset condition. If the N images to be superimposed meet the preset condition, the N images to be superimposed are superimposed according to a preset rule to obtain a target image. The preset condition is: the N images to be superimposed include an image of the first type and N-1 images of the second type, and the first target fields of the N images to be superimposed are the same.
[0092] Optionally, when the N images to be superimposed obtained include an image of the first type and N-1 images of the second type, and the first target fields of the N images to be superimposed are the same, for example, the N images to be superimposed are obtained according to a second preset mapping table, it is not necessary to determine whether the N images to be superimposed meet preset conditions, and the N images to be superimposed can be directly superimposed according to preset rules to obtain the target image.
[0093] Optionally, when N images to be superimposed meet preset conditions, the N-1 second-type images can be superimposed on the one first-type image to obtain a target image. This is equivalent to splicing the second target fields of the N-1 second-type images with the second target fields of the first-type images, that is, splicing the second target fields of the N-1 second-type images to the back of the second target field of the first-type image in a preset order or randomly to obtain the target image. The values of other fields in the target image except the second target field, the image name field, the image size field and the image type field are the values of other fields of any one of the N images to be superimposed. The second target field is used to characterize the layer file information and internal environment information of the image to be superimposed. The preset order can be the order when the user inputs the N-1 second-type images, or it can be the ascending or descending order of the sizes of the N-1 second-type images, etc., which is not limited in this specification. The target image is a first-type image. The name of the target image can be randomly generated, as long as it does not repeat the names of the N images to be superimposed. The size of the target image may be the sum of the sizes of the N images to be superimposed, which is not specifically limited in this specification.
[0094] For example, Figure 4A-4C As shown in FIG. 1 , it is a schematic diagram of the structure of the image to be superimposed provided by an exemplary embodiment of this specification. When N=3, as Figure 4A-4CAs shown, the image to be superimposed centos1 is a first type (Standard) image, the images to be superimposed centos2 and centos3 are both second type (Lite) images, and the first target field 411 (Architecture field and Os field) of the above-mentioned image to be superimposed centos1, the first target field 421 (Architecture field and Os field) of the above-mentioned image to be superimposed centos2, and the first target field 431 (Architecture field and Os field) of the above-mentioned image to be superimposed centos3 are all the same, that is, the above-mentioned three images to be superimposed meet the preset conditions. If the preset order is to be The superimposed image centos2 is arranged at the back, and the image to be superimposed centos3 is arranged at the front. Then, the second target field 422 (Config.Env field 422a and RootFS.Layers field 422b) of the above-mentioned image to be superimposed centos2 and the second target field 432 (Config.Env field 432a and RootFS.Layers field 432b) of centos3 can be correspondingly spliced to the back of the second target field 412 (Config.Env field 412a and RootFS.Layers field 412b) of the above-mentioned image to be superimposed centos1 in the above-mentioned preset order, so as to obtain the following: Figure 4D The target image shown. That is, the content of the second target field 442 (Config.Env field 442a and RootFS.Layers field 442b) of the target image is as follows Figure 4D As shown. The type (Type) of the above target image is set to the first type (Standard). The size (Size) of the above target image can be the sum of the sizes of the above three images to be superimposed. Figure 4D As shown in the RepoTags field, the name of the target image can be composed of the names of the three images to be superimposed, that is, centos1-centos3-centos2. The name of the target image can also be a string of any length that is randomly composed of numbers, letters, underscores, etc. and does not repeat the names of the three images to be superimposed. This manual does not limit this. Figure 4D As shown, the other fields of the target image except the second target field, the image name field, the image size field and the image type field can adopt the values of other fields of the image to be superimposed centos2.
[0095] Optionally, when the N images to be superimposed meet the preset conditions, the first image of the second type in the N-1 images of the second type can be superimposed with the image of the first type to obtain a first target image, and then the second image of the second type in the N-1 images of the second type can be superimposed with the first target image to obtain a second target image, until the N-1th image of the N-1 images of the second type is superimposed with the N-2th target image to obtain a target image. This is equivalent to splicing the second target field of the first image of the second type in the N-1th image of the second type with the second target field of a first type image to obtain a first target image, and then splicing the second target field of the second image of the second type in the N-1 images of the second type with the second target field of the first target image to obtain a second target image, until the second target field of the N-1th image of the second type is spliced with the second target field of the N-2th target image to obtain a target image, and the values of other fields in the target image except the second target field are the values of other fields of any one of the N images to be superimposed. The second target field is used to characterize the layer file information and internal environment information of the image to be superimposed. The first target image, the second target image, the N-2 target image, and the target image are all images of the first type. The name of the target image can be randomly generated as long as it does not overlap with the names of the N images to be superimposed. The size of the target image can be the sum of the sizes of the N images to be superimposed, which is not specifically limited in this specification.
[0096] For example, when N=3, Figure 4A-4CAs shown, the image to be superimposed centos1 is an image of the first type (Standard), and the images to be superimposed centos2 and centos3 are both images of the second type (Lite), and the first target field 411 (Architecture field and Os field) of the above-mentioned image to be superimposed centos1, the first target field 421 (Architecture field and Os field) of the above-mentioned image to be superimposed centos2, and the first target field 431 (Architecture field and Os field) of the above-mentioned image to be superimposed centos3 are all the same, that is, the above-mentioned three images to be superimposed meet the preset conditions, and the second target field 422 (internal environment information, namely, Config.Env field 422a and layer file information, namely, RootFS.Layers field 422b) of the above-mentioned image to be superimposed centos2 can be correspondingly spliced to the second target field 412 (Config.Env field 412a and RootFS.Layers field 412b) of the above-mentioned image to be superimposed centos1, so as to obtain the following Figure 5A The first target image shown. The type (Type) of the first target image is set to the first type (Standard). The size (Size) of the first target image can be the sum of the sizes of the image to be superimposed centos1 and the image to be superimposed centos2. Figure 5A As shown in the RepoTags field in the above, the name of the first target image is dymbjx1. Figure 5A As shown, except for the second target field, image name field, image size field and image type field, the other fields of the first target image all adopt the values of the other fields of the image to be superimposed centos2. After obtaining the first target image, the second target field 432 (internal environment information, i.e., Config.Env field 432a and layer file information, i.e., RootFS.Layers field 432b) of the image to be superimposed centos3 can be correspondingly spliced to the back of the second target field 510 (Config.Env field 510a and RootFS.Layers field 510b) of the first target image dymbjx1, thereby obtaining the following: Figure 5B The target image shown. That is, the content of the second target field 520 (Config.Env field 520a and RootFS.Layers field 520b) of the target image is as follows Figure 5B As shown. The type (Type) of the above target image is set to the first type (Standard). The size (Size) of the above target image can be the sum of the sizes of the image to be superimposed centos3 and the first target image dymbjx1. Figure 5BAs shown in the RepoTags field in the above figure, the name of the target image is dymbjx2. Figure 5B As shown, the other fields of the target image except the second target field, the image name field, the image size field and the image type field all adopt the values of the other fields of the image to be superimposed centos3.
[0097] The embodiment of the present specification obtains N images to be superimposed from a server through a network, and when the above N images to be superimposed meet preset conditions, the above N images to be superimposed are superimposed according to preset rules to obtain a target image, so that the developer does not need to modify the original image, but only needs to make a standard image and distribute it to all users (institutions). If a user (institution) has special needs to adjust the image content, it only needs to superimpose the corresponding image before running, and the content of the image can be easily fine-tuned, making the production and use of the image more flexible, and realizing that multiple different images can be superimposed together and put into the same container for running, and the software delivery and deployment process is simplified, which improves the user experience.
[0098] Next, another mirror stacking method provided by the embodiment of this specification is introduced. Figure 6 , which is a flow chart of another mirror stacking method provided by an exemplary embodiment of this specification. Figure 6 As shown, the mirror stacking method includes the following steps:
[0099] Step 602: Obtain N images to be superimposed.
[0100] Specifically, step 602 is consistent with step 202 and will not be repeated here.
[0101] Step 604: When the N images to be superimposed meet a preset condition, the N images to be superimposed are superimposed according to a preset rule to obtain a target image.
[0102] Specifically, step 604 is consistent with step 204 and will not be repeated here.
[0103] Step 606: Import the target image into the container for execution.
[0104] Specifically, after obtaining the target image, the target image can be input into the container. When the container receives the target image, the layer file included in the target image can be directly run, thereby executing the instructions specified in the target image to implement the function of the target image, which is equivalent to implementing N images to be superimposed in one container at the same time. The container includes an application container engine (docker), coreos, etc., which is not limited in this specification.
[0105] Exemplarily, if N=2, the target image is obtained by superimposing two images to be superimposed, wherein the first image to be superimposed is a standard image, which can realize the basic function of viewing information, and the second image to be superimposed is a streamlined image, which corresponds to the function of deleting information. After the target is input into the container and run, the two functions of viewing information and deleting information can be realized.
[0106] Step 608, delete the target image.
[0107] Specifically, the target image can be a virtual image, that is, it does not need to be stored. This is equivalent to automatically deleting the target image after running in the container, thereby avoiding the storage of some similar but not completely identical images and saving a lot of storage space.
[0108] Optionally, after the target image is input into the container for running, the target image may be directly stored for the next running, which is not limited in this specification.
[0109] The embodiment of this specification obtains a target image by superimposing N images to be superimposed, and inputs the target image into a container for operation. It is possible to run one or more images simultaneously in one container without modifying or upgrading the original container, thereby simplifying the development and online process and improving the user experience. After the target image is run in the container, the target image will be automatically deleted, so that some similar but not completely identical images will not be stored, avoiding a large amount of storage space waste.
[0110] Please refer to Figure 7 , which is a structural schematic diagram of a mirror stacking device provided in an embodiment of this specification. The mirror stacking device 700 includes:
[0111] An acquisition module 710 is used to acquire N images to be superimposed, where N is a positive integer greater than or equal to 2;
[0112] The superposition module 720 is used to superimpose the N images to be superimposed according to a preset rule to obtain a target image when the N images to be superimposed meet a preset condition.
[0113] In a possible implementation, the apparatus 700 further includes:
[0114] The judging module is used to judge whether the N images to be superimposed meet the preset conditions.
[0115] In a possible implementation, the preset conditions are: the N images to be superimposed include an image of the first type and N-1 images of the second type, and the first target fields of the N images to be superimposed are the same; the image of the first type is an image that can be run independently; the image of the second type is an image that cannot be run independently; the first target field is used to characterize the development environment of the image to be superimposed.
[0116] In a possible implementation, the superposition module 720 is specifically configured to superimpose the N-1 images of the second type onto the one image of the first type to obtain a target image.
[0117] In a possible implementation, the overlay module 720 is specifically used to concatenate the second target fields of the N-1 second-type images with the second target field of the first-type image to obtain a target image; the second target field is used to represent the layer file information and internal environment information of the image to be overlaid.
[0118] In a possible implementation, the superposition module 720 is specifically used to superimpose the first image of the second type among the N-1 images of the second type with the image of the first type to obtain a first target image;
[0119] Superimposing a second image of the second type among the N-1 images of the second type with the first target image to obtain a second target image;
[0120] Until the N-1th image among the N-1 second type images is superimposed with the N-2th target image to obtain the target image.
[0121] In a possible implementation, the superposition module 720 is specifically used for:
[0122] The second target field of the first image of the second type in the N-1th image of the second type is concatenated with the second target field of the image of the first type to obtain a first target image;
[0123] The second target field of the second image of the second type among the N-1 images of the second type is concatenated with the second target field of the first target image to obtain a second target image;
[0124] until the second target field of the N-1th image among the N-1 images of the second type is concatenated with the second target field of the N-2th target image to obtain the target image;
[0125] The second target field is used to represent the layer file information and internal environment information of the image to be superimposed.
[0126] In a possible implementation manner, the values of other fields in the target image except the second target field are the values of the other fields of any one of the N images to be superimposed.
[0127] In a possible implementation, the apparatus 700 further includes:
[0128] The input module is used to input the above target image into the container for running.
[0129] In a possible implementation, the apparatus 700 further includes:
[0130] The deletion module is used to delete the above target image.
[0131] The division of each module in the above-mentioned mirror stacking device is only for illustration. In other embodiments, the mirror stacking device can be divided into different modules as needed to complete all or part of the functions of the above-mentioned mirror stacking device. The implementation of each module in the mirror stacking device provided in the embodiment of this specification can be in the form of a computer program. The computer program can be run on a terminal or a server. The program module constituted by the computer program can be stored in the memory of the terminal or the server. When the computer program is executed by the processor, all or part of the steps of the mirror stacking method described in the embodiment of this specification are implemented.
[0132] See also Figure 8 , Figure 8 This is a schematic diagram of the structure of an electronic device provided by an exemplary embodiment of this specification. Figure 8 As shown, the electronic device 800 may include: at least one processor 810 , at least one network interface 820 , a user interface 830 , a memory 840 , and at least one communication bus 850 .
[0133] The communication bus 850 may be used to realize the connection and communication among the above-mentioned components.
[0134] The user interface 830 may include a display screen (Display) and a camera (Camera), and the optional user interface may also include a standard wired interface and a wireless interface.
[0135] The network interface 820 may optionally include a Bluetooth module, a Near Field Communication (NFC) module, a Wireless Fidelity (Wi-Fi) module, and the like.
[0136] Among them, the processor 810 may include one or more processing cores. The processor 810 uses various interfaces and lines to connect various parts within the entire electronic device 800, and executes various functions and processes data of the routing electronic device 800 by running or executing instructions, programs, code sets or instruction sets stored in the memory 840, and calling data stored in the memory 840. Optionally, the processor 810 can be implemented in at least one hardware form of digital signal processing (Digital Signal Processing, DSP), field programmable gate array (Field-Programmable Gate Array, FPGA), and programmable logic array (Programmable Logic Array, PLA). The processor 810 can integrate one or a combination of a central processing unit (Central Processing Unit, CPU), a graphics processing unit (Graphics Processing Unit, GPU) and a modem. Among them, the CPU mainly processes the operating system, user interface and application programs; the GPU is responsible for rendering and drawing the content to be displayed on the display screen; the modem is used to process wireless communications. It can be understood that the above-mentioned modem may not be integrated into the processor 810, and it can be implemented separately through a chip.
[0137] Among them, the memory 840 may include a random access memory (Random Access Memory, RAM) and may also include a read-only memory (Read-Only Memory, ROM). Optionally, the memory 840 includes a non-transitory computer-readable medium. The memory 840 can be used to store instructions, programs, codes, code sets or instruction sets. The memory 840 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as obtaining an image to be superimposed, superimposing multiple images to be superimposed, etc.), instructions for implementing the above-mentioned various method embodiments, etc.; the data storage area may store data involved in the above-mentioned various method embodiments, etc. The memory 840 may also be optionally at least one storage device located away from the aforementioned processor 810. As Figure 8 As shown, the memory 840 as a computer storage medium may include an operating system, a network communication module, a user interface module, and an application program.
[0138] In some possible embodiments, the electronic device 800 may be the aforementioned mirror stacking device. Figure 8In the electronic device 800 shown, the user interface 830 is mainly used to provide an input interface for the user, such as buttons on the mirror stacking device, etc., to obtain instructions triggered by the user; and the processor 810 can be used to call the application stored in the memory 840 and specifically perform the following operations:
[0139] Obtain N images to be superimposed, wherein N is a positive integer greater than or equal to 2.
[0140] When the N images to be superimposed meet preset conditions, the N images to be superimposed are superimposed according to preset rules to obtain a target image.
[0141] In some possible embodiments, after the processor 810 obtains N images to be superimposed, before superimposing the N images to be superimposed according to a preset rule when the N images to be superimposed meet a preset condition, the processor 810 is further configured to execute:
[0142] Determine whether the N images to be superimposed meet the preset conditions.
[0143] In some possible embodiments, the preset conditions are: the N images to be superimposed include an image of the first type and N-1 images of the second type, and the first target fields of the N images to be superimposed are the same; the image of the first type is an image that can be run independently; the image of the second type is an image that cannot be run independently; the first target field is used to characterize the development environment of the image to be superimposed.
[0144] In some possible embodiments, when the processor 810 performs superposition of the N images to be superimposed according to a preset rule to obtain a target image, the processor 810 is specifically configured to perform:
[0145] The N-1 second-type images are superimposed on the one first-type image to obtain a target image.
[0146] In some possible embodiments, when the processor 810 sequentially superimposes the N-1 images of the second type onto the one image of the first type to obtain a target image, the processor 810 is specifically configured to execute:
[0147] The second target fields of the N-1 second-type images are concatenated with the second target field of the first-type image to obtain a target image; the second target field is used to represent the layer file information and internal environment information of the image to be superimposed.
[0148] In some possible embodiments, when the processor 810 performs superposition of the N images to be superimposed according to a preset rule to obtain a target image, the processor 810 is specifically configured to perform:
[0149] The first image of the second type among the N-1 images of the second type is superimposed on the image of the first type to obtain a first target image.
[0150] The second image of the second type among the N-1 images of the second type is superimposed on the first target image to obtain a second target image.
[0151] Until the N-1th image among the N-1 second type images is superimposed with the N-2th target image to obtain the target image.
[0152] In some possible embodiments, when the processor 810 performs superposition of the first image of the second type among the N-1 images of the second type with the image of the first type to obtain the first target image, the processor 810 is specifically configured to perform:
[0153] The second target field of the first second type image in the N-1th second type image is concatenated with the second target field of the first type image to obtain a first target image.
[0154] When the processor 810 performs superposition of the second image of the N-1 second images with the first target image to obtain the second target image, the processor 810 is specifically configured to perform:
[0155] The second target field of the second second type of image among the N-1 second type of images is concatenated with the second target field of the first target image to obtain a second target image.
[0156] The processor 810 executes until the N-1th image among the N-1 second-type images is superimposed with the N-2th target image to obtain the target image, and is specifically configured to execute:
[0157] Until the second target field of the N-1th image among the N-1 second-type images is concatenated with the second target field of the N-2th target image to obtain the target image.
[0158] The second target field is used to represent the layer file information and internal environment information of the image to be superimposed.
[0159] In some possible embodiments, the values of other fields in the target image except the second target field are the values of the other fields of any one of the N images to be superimposed.
[0160] In some possible embodiments, the processor 810 performs superimposing the N images to be superimposed according to a preset rule when the N images to be superimposed meet a preset condition to obtain a target image, and is further configured to perform:
[0161] Import the above target image into the container and run it.
[0162] In some possible embodiments, after the processor 810 executes the inputting of the target image into the container for execution, it is further configured to execute:
[0163] Delete the above target image.
[0164] The embodiments of this specification also provide a computer-readable storage medium, which stores instructions, and when the instructions are executed on a computer or a processor, the computer or the processor executes one or more steps in the above embodiments. If the components of the above mirror stacking device are implemented in the form of software functional units and sold or used as independent products, they can be stored in the above computer-readable storage medium.
[0165] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of this specification is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted through the computer-readable storage medium. The computer instructions can be transmitted from a website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (Digital Subscriber Line, DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server, data center, etc. that contains one or more available media integrated. The available medium may be a magnetic medium (eg, a floppy disk, a hard disk, a magnetic tape), an optical medium (eg, a digital versatile disc (DVD)), or a semiconductor medium (eg, a solid state disk (SSD)).
[0166] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. The aforementioned storage medium includes: ROM, RAM, magnetic disk or optical disk and other media that can store program codes. In the absence of conflict, the technical features in this embodiment and the implementation scheme can be combined arbitrarily.
[0167] The embodiments described above are merely preferred embodiments of this specification and are not intended to limit the scope of this specification. Without departing from the design spirit of this specification, various modifications and improvements made to the technical solutions of this specification by ordinary technicians in this field should fall within the scope of protection determined by the claims.
[0168] The above is a description of a specific embodiment of the present specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
Claims
1. A mirror stacking method, the method comprising: Get N images to be superimposed; N is a positive integer greater than or equal to 2; The image to be superimposed is an image that needs to be superimposed and is selected by a user from a plurality of images of different types and functions; When the N images to be superimposed meet a preset condition, superimposing the N images to be superimposed according to a preset rule to obtain a target image; After obtaining N images to be superimposed, and before superimposing the N images to be superimposed according to preset rules when the N images to be superimposed meet preset conditions, the method further includes: Determine whether the N images to be superimposed meet a preset condition; The preset conditions are: the N images to be superimposed include an image of the first type and N-1 images of the second type, and the first target fields of the N images to be superimposed are the same; the image of the first type is an image that can be run independently; the image of the second type is an image that cannot be run independently; the first target field is used to characterize the development environment of the image to be superimposed.
2. The method according to claim 1, wherein the N images to be superimposed are superimposed according to a preset rule to obtain a target image, comprising: The N-1 second-type images are superimposed on the one first-type image to obtain a target image.
3. The method according to claim 2, wherein the step of superimposing the N-1 second-type images onto the one first-type image to obtain a target image comprises: Concatenate the second target fields of the N-1 images of the second type with the second target field of the image of the first type to obtain a target image; The second target field is used to represent the layer file information and internal environment information of the image to be superimposed.
4. The method according to claim 1, wherein the N images to be superimposed are superimposed according to a preset rule to obtain a target image, comprising: Superimposing a first image of the second type among the N-1 images of the second type with the image of the first type to obtain a first target image; Superimposing a second image of the second type among the N-1 images of the second type with the first target image to obtain a second target image; Until the N-1th image among the N-1 second type images is superimposed with the N-2th target image to obtain the target image.
5. The method according to claim 4, wherein the step of superimposing a first image of the second type among the N-1 images of the second type with the image of the first type to obtain a first target image comprises: Concatenate the second target field of the first image of the second type in the N-1th image of the second type with the second target field of the first image of the first type to obtain a first target image; The step of superimposing a second image of the second type among the N-1 images of the second type with the first target image to obtain a second target image includes: splicing the second target field of the second image of the second type among the N-1 images of the second type with the second target field of the first target image to obtain a second target image; The step of superimposing the N-1th image among the N-1 images of the second type with the N-2th target image to obtain the target image includes: until the second target field of the N-1th image among the N-1 images of the second type is concatenated with the second target field of the N-2th target image to obtain the target image; The second target field is used to represent the layer file information and internal environment information of the image to be superimposed.
6. The method according to claim 3 or 5, wherein the values of other fields in the target image except the second target field are the values of the other fields of any one of the N images to be superimposed.
7. The method according to claim 1, wherein when the N images to be superimposed meet a preset condition, the N images to be superimposed are superimposed according to a preset rule to obtain a target image, the method further comprises: Import the target image into the container and run it.
8. The method according to claim 7, after inputting the target image into a container for running, the method further comprises: Delete the target image.
9. A mirror image stacking device, comprising: An acquisition module is used to acquire N images to be superimposed; N is a positive integer greater than or equal to 2; The image to be superimposed is an image that needs to be superimposed and is selected by a user from a plurality of images of different types and functions; A superposition module, configured to superimpose the N images to be superimposed according to a preset rule to obtain a target image when the N images to be superimposed meet a preset condition; The device also includes: A judging module, used to judge whether the N images to be superimposed meet a preset condition; The preset conditions are: the N images to be superimposed include an image of the first type and N-1 images of the second type, and the first target fields of the N images to be superimposed are the same; the image of the first type is an image that can be run independently; the image of the second type is an image that cannot be run independently; the first target field is used to characterize the development environment of the image to be superimposed.
10. The device according to claim 9, wherein the superposition module is specifically used to superimpose the N-1 second-type images onto the one first-type image to obtain a target image.
11. The device according to claim 10, wherein the overlay module is specifically used to splice the second target fields of the N-1 second-type images with the second target field of the first-type image to obtain a target image; the second target field is used to represent the layer file information and internal environment information of the image to be overlaid.
12. The device according to claim 9, wherein the superposition module is specifically used to superimpose a first second type of image among the N-1 second type of images with the first type of image to obtain a first target image; Superimposing a second image of the second type among the N-1 images of the second type with the first target image to obtain a second target image; Until the N-1th image among the N-1 second type images is superimposed with the N-2th target image to obtain the target image.
13. The device according to claim 12, wherein the superposition module is specifically used for: Concatenate the second target field of the first image of the second type in the N-1th image of the second type with the second target field of the first image of the first type to obtain a first target image; splicing the second target field of the second image of the second type among the N-1 images of the second type with the second target field of the first target image to obtain a second target image; until the second target field of the N-1th image among the N-1 images of the second type is concatenated with the second target field of the N-2th target image to obtain the target image; in, The second target field is used to represent the layer file information and internal environment information of the image to be superimposed.
14. The device according to claim 11 or 13, wherein the values of other fields in the target image except the second target field are the values of the other fields of any one of the N images to be superimposed.
15. The apparatus of claim 9, further comprising: The input module is used to input the target image into the container for running.
16. The apparatus of claim 15, further comprising: The deletion module is used to delete the target image.
17. An electronic device comprising: Processor and memory; The processor is connected to the memory; The memory is used to store executable program code; The processor runs a program corresponding to the executable program code by reading the executable program code stored in the memory, so as to execute the method according to any one of claims 1 to 8.
18. A computer storage medium storing a plurality of instructions, wherein the instructions are suitable for being loaded by a processor and executing the method steps according to any one of claims 1 to 8.
19. A computer program product comprising instructions, which, when the computer program product is run on a computer or a processor, causes the computer or the processor to perform the method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Mirror image processing method and device, electronic equipment and readable storage medium
CN113209633A