Container mirror image query method and device
By using the attribute information of the target container image in the container image query to determine the initial layer identification sequence and looking for the association mirror in the mirror association relationship table, the accuracy and efficiency of the mirror association query in the prior art are solved, and efficient Mirror search.
Patent Information
- Application Number
- CN202410978228.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-19
- Publication Date
- 2024-11-12
AI Technical Summary
In the prior art, it is difficult to establish a mirror association relationship based on name and label query based on container images, and it relies on manual operations, resulting in poor query accuracy and effectiveness.
By determining the initial layer identification sequence based on the attribute information of the target container image, and looking for the association mirror in the mirror association relationship table, the precise query and efficient retrieval of the mirror are realized.
A mirror-related query based on arbitrary attribute information is realized, which improves the accuracy and efficiency of the query and reduces the dependence of manual operations.
Smart Images

Figure CN118939694A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, specifically to the field of container technology, and in particular to a container image query method and device. Background Art
[0002] If container image B is created based on container image A, and container image C is created based on container image B, in the prior art, if one wants to retrieve the associated container images B and C based on the name of image A alone, one can only rely on the names and tags of the container images.
[0003] If container image B and container C do not use consistent custom annotations in their names or labels, it is difficult to establish the association between container image A and container image B, and between container image B and container image C.
[0004] Moreover, this custom annotation completely relies on manual operation, which makes the accuracy and effectiveness of the associated image query poor. Summary of the invention
[0005] Embodiments of the present application provide a container image query method, apparatus, device, and storage medium.
[0006] According to a first aspect, an embodiment of the present application provides a container image query method, the method comprising: determining an initial layer identification sequence based on attribute information of a target container image; and determining an associated image in an image association table based on the initial layer identification sequence.
[0007] According to the second aspect, an embodiment of the present application provides a container image query device, which includes: a first determination module and a second determination module, wherein the first determination module is configured to determine an initial layer identification sequence based on attribute information of a target container image; and the second determination module is configured to determine an associated image in an image association relationship table based on the initial layer identification sequence.
[0008] According to a third aspect, an embodiment of the present application provides an electronic device, which includes one or more processors; a storage device on which one or more programs are stored, and when the one or more programs are executed by the one or more processors, the one or more processors implement a container image query method as in any embodiment of the first aspect.
[0009] According to a fourth aspect, an embodiment of the present application provides a computer-readable medium having a computer program stored thereon, which, when executed by a processor, implements a container image query method as in any embodiment of the first aspect.
[0010] The present application determines an initial layer identification sequence based on the attribute information of the target container image; based on the initial layer identification sequence, the associated image is determined in the image association relationship table, that is, the image association relationship table is obtained by using the data storage of historical container images, so that the user can determine the associated image of the target container image according to any attribute information of the target container image, thereby realizing accurate query and efficient retrieval of the associated image.
[0011] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] Figure 1 is an exemplary system architecture diagram to which the present application may be applied;
[0013] Figure 2 is a flowchart of an embodiment of a container image query method according to the present application;
[0014] Figure 3 It is a schematic diagram of an application scenario of the container image query method according to the present application;
[0015] Figure 4a is a flowchart of another embodiment of the container image query method according to the present application;
[0016] Figure 4b is a schematic diagram of another embodiment of a container image query method according to the present application;
[0017] Figure 4c is a schematic diagram of another embodiment of a container image query method according to the present application;
[0018] Figure 4d is a schematic diagram of another embodiment of the container image query method according to the present application;
[0019] Figure 4e is a schematic diagram of another embodiment of the container image query method according to the present application;
[0020] Figure 4f is a schematic diagram of another embodiment of the container image query method according to the present application;
[0021] Figure 5 is a flowchart of another embodiment of a container image query device according to the present application;
[0022] Figure 6 It is a structural diagram of a computer system suitable for implementing a server of an embodiment of the present application. DETAILED DESCRIPTION
[0023] The following is a description of exemplary embodiments of the present application in conjunction with the accompanying drawings, including various details of the embodiments of the present application to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present application. Similarly, for the sake of clarity and conciseness, the description of well-known functions and structures is omitted in the following description.
[0024] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0025] Figure 1 An exemplary system architecture 100 is shown to which an embodiment of the container image query method of the present application can be applied.
[0026] like Figure 1 As shown, the system architecture 100 may include terminal devices 101, 102, 103, a network 104 and a server 105. The network 104 is used to provide a medium for communication links between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.
[0027] The terminal devices 101, 102, 103 interact with the server 105 via the network 104 to receive or send messages, etc. Various application platforms may be installed on the terminal devices 101, 102, 103.
[0028] Terminal devices 101, 102, 103 can be hardware or software. When terminal devices 101, 102, 103 are hardware, they can be various electronic devices with display screens, including but not limited to mobile phones, laptops, and scanning devices. When terminal devices 101, 102, 103 are software, they can be installed in the electronic devices listed above. It can be implemented as multiple software or software modules (for example, to provide container image query services), or it can be implemented as a single software or software module. No specific limitation is made here.
[0029] Terminal devices 101, 102, and 103 are terminal devices that provide various services. For example, based on the attribute information of the target container image, an initial layer identification sequence is determined; based on the initial layer identification sequence, an associated image is determined in the image association table.
[0030] It should be noted that the server 105 can be hardware or software. When the server 105 is hardware, it can be implemented as a distributed server cluster consisting of multiple servers, or it can be implemented as a single server. When the server is software, it can be implemented as multiple software or software modules, or it can be implemented as a single software or software module. No specific limitation is made here.
[0031] It should be noted that the container image query method provided by the embodiment of the present disclosure can be executed by the terminal devices 101, 102, 103, and can also be executed by the server 105 and the terminal devices 101, 102, 103 in cooperation with each other. Accordingly, the various parts (such as various units, sub-units, modules, sub-modules) included in the container image query device can all be set in the terminal devices 101, 102, 103, and can also be set in the server 105 and the terminal devices 101, 102, 103 respectively.
[0032] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.
[0033] Figure 2 The process 200 of an embodiment of the container image query method that can be applied to the present application is shown. In this embodiment, the container image query method includes the following steps:
[0034] Step 201: Determine an initial layer identification sequence based on the attribute information of the target container image.
[0035] In this embodiment, the execution subject (such as Figure 1 The terminal devices 101, 102, 103 or the server 105 shown in the figure can monitor the query instructions input by the user using a wired connection or a wireless connection in real time or regularly, and the query instructions may include the attribute information of the target container image.
[0036] Among them, container image, such as Docker image, is a core concept in container technology. It is a lightweight, executable, independent software package that contains all the content required to run a certain software, including code, runtime environment, libraries, environment variables, and configuration files. Once the image is created, the content will not change, and running the image will generate one or more containers.
[0037] Here, a container image can include multiple image layers. Each image layer represents a step in the image building process, representing the execution result of an instruction in the Dockerfile (for example, RUN, ADD, COPY, etc.), or a layer inherited from other container images. The result of each step will be cached. If a certain image layer already exists, Docker will use the image layer in the cache to avoid unnecessary repeated construction. Multiple image layers are stacked from bottom to top to form a complete image.
[0038] An image layer may generally include the following: file system changes (e.g., adding, deleting, or modifying files), setting of environment variables, installation of software packages, and modification of configuration files.
[0039] The execution subject can determine the initial layer identification sequence based on the attribute information of the target container image and the mapping relationship table between the preset attribute information and the initial layer identification sequence; or the initial layer identification sequence can be determined based on the attribute information of the target container image and the preset output model, which is not limited in this application.
[0040] Among them, the preset output model can be trained based on attribute information samples marked with layer identification sequences.
[0041] The attribute information of the target container image may include, but is not limited to, the image name, image identifier, layer hash value of the image layer, layer content, command hash value, and command content.
[0042] Here, the initial layer identification sequence may be a subsequence of the layer identification sequence corresponding to the target container image, and the layer identification sequence is generated by sorting the layer identifications of the image layers included in the target container image according to the corresponding levels.
[0043] It should be noted that the initial layer identification sequence may be the same as the layer identification sequence corresponding to the target container image, or may be different from the layer identification sequence corresponding to the target container image, and this application does not limit this.
[0044] The layer ID is a unique identifier in the container image history. Every time a new layer (i.e., image layer) is added to the container image, a new layer ID is generated. Each layer has a layer ID associated with it, but layers at different levels may have the same layer ID, such as when layers at different levels are generated using the same Dockerfile command.
[0045] Step 202: Determine the associated image in the image association table based on the initial layer identification sequence.
[0046] In this embodiment, the execution subject may determine the image identifier of the associated image in the image association relationship table according to the initial layer identifier sequence.
[0047] Here, the image identifier of the associated image is usually different from the image identifier of the target container image.
[0048] Among them, the image association relationship table can be obtained by analyzing and storing historical container images. The image association relationship table can include image identifiers of multiple container images and layer identifier sequences corresponding to each image identifier. The layer identifier sequence can be generated by sorting the layer identifiers of the image layers according to the corresponding hierarchical levels.
[0049] Here, the initial layer identification sequence is a subsequence of the layer identification sequence corresponding to the image identification of the associated image.
[0050] In some optional methods, based on the initial layer identification sequence, determining the associated image in the image association relationship table includes: determining the image identification of the associated image in the image association relationship table according to the initial layer identification sequence; and determining the image name of the associated image in the image table according to the image identification of the associated image.
[0051] In this implementation, after obtaining the initial layer identification sequence, the execution subject can determine the image identification of the associated image in the image association relationship table according to the initial layer identification sequence, and determine the name of the associated image in the image table according to the image identification of the associated image.
[0052] The image table includes multiple image identifiers and corresponding image names.
[0053] This implementation method determines the image identifier of the associated image in the image association relationship table according to the initial layer identifier sequence; and determines the image name of the associated image in the image table according to the image identifier of the associated image, thereby determining the image name of the associated image.
[0054] Continue to see Figure 3 , Figure 3 It is a schematic diagram of an application scenario of the container image query method according to this embodiment.
[0055] exist Figure 3In the application scenario, the execution subject 301 may monitor the query instruction input by the user in real time or regularly, and the query instruction may include the attribute information of the target container image. In response to detecting the query instruction, the execution subject may determine the initial layer identification sequence based on the attribute information of the target container image, for example, three four, wherein the container image includes multiple image layers, the initial layer identification sequence is a subsequence of the layer identification sequence corresponding to the target container image, and the layer identification sequence is generated by the layer identification of the image layer of the container image according to the corresponding level sorting. Further, the execution subject may determine the associated image in the image association relationship table 302 based on the initial layer identification sequence, for example, the image corresponding to image identification 2 and image identification 3, wherein the initial layer identification sequence is a subsequence of the layer identification sequence corresponding to the image identification of the associated image, and the image association relationship table may have the fields: image identification, layer identification and level. The image association relationship table includes the image identifications of multiple container images and the corresponding layer identification sequences, such as the layer identification sequence corresponding to image identification 1 is one two three, the layer identification sequence corresponding to image identification 2 is one two three four, and the layer identification sequence corresponding to image identification 3 is one two three four five.
[0056] The container image query method disclosed in the present invention determines an initial layer identification sequence based on the attribute information of the target container image; based on the initial layer identification sequence, determines the associated image in the image association relationship table, thereby achieving accurate query and efficient retrieval of the associated image.
[0057] Figure 4a The process 400 of an embodiment of the container image query method that can be applied to the present application is shown. In this embodiment, the container image query method includes the following steps:
[0058] Step 401: Determine an initial layer identification sequence based on the attribute information of the target container image and the corresponding relationship table set.
[0059] In this embodiment, the execution subject may determine the initial layer identification sequence according to the attribute information of the target container image and the relationship table set corresponding to the attribute information.
[0060] Among them, the relationship table sets corresponding to different attribute information may be different. For example, if the attribute information includes the image name, the relationship table set may include an image table and an image association relationship table; if the attribute information includes the image identifier, the relationship table set may include an image association relationship table; if the attribute information includes a command content sequence, the relationship table set may include a first relationship table, and the first relationship table may include multiple layer identifiers and corresponding command hash values and command contents; if the attribute information includes a layer content sequence, the relationship table set may include a second relationship table, and the second relationship table may include multiple layer identifiers and corresponding layer hash values and layer contents, and so on.
[0061] The first image hash table may include multiple command hash values and corresponding layer identifiers, etc.
[0062] In some optional methods, an initial layer identification sequence is determined based on the attribute information of the target container image and the corresponding relationship table set, including: determining a specified image identifier in the image table according to the image name; and determining the initial layer identification sequence in the image association relationship table according to the specified image identifier.
[0063] In this implementation, the relationship table set may include: an image table and an image association relationship table. If the attribute information includes an image name, the execution subject may determine a specified image identifier in the image table according to the image name.
[0064] The image table may include multiple image identifiers and image names corresponding to the image identifiers.
[0065] It should be pointed out that the image table may also include image metadata information corresponding to the image identifier, such as the image download address, image version, image type (such as application, system, etc.), image source (such as third party, self-developed, etc.), and the number of image layers included.
[0066] Furthermore, the execution subject may determine the initial layer identifier sequence in the image association relationship table according to the specified image identifier.
[0067] Specifically, Figure 4b As shown, if the image name of the target container image is image A, the execution subject may first search the image table for the specified image identifier corresponding to image A, such as 1. Further, the execution subject may determine the initial layer identifier sequence in the image association table according to the specified image identifier, such as 1, 2, 3. Further, the execution subject may determine the image identifier of the associated image in the image association table according to the initial layer identifier sequence, such as 2, 3. Among them, the initial layer identifier sequence is a subsequence of the layer identifier sequence corresponding to the image identifier of the associated image.
[0068] This implementation method determines a designated image identifier in an image table according to an image name; and determines an initial layer identifier sequence in an image association table according to the designated image identifier, thereby realizing query of associated images based on image names.
[0069] In some optional ways, determining the initial layer identification sequence based on the attribute information of the target container image and the corresponding relationship table set includes: determining the initial layer identification sequence in the first image hash table according to the command hash value sequence.
[0070] In this implementation, the relationship table set may include: a first image hash table. If the attribute information includes a command hash value sequence, the execution subject may determine the initial layer identification sequence in the first image hash table according to the command hash value sequence.
[0071] Among them, the first image hash table can be constructed according to the command hash value of the container image that has been built historically, and can specifically include multiple command hash values and corresponding layer identifiers. In addition, the first image hash table can also include the layer size and layer status (whether it is an empty layer) corresponding to the command hash value.
[0072] Here, the command hash sequence can include one or more command hashes. The command hash is the hash of a specific command in the Dockerfile. It is calculated based on the text content of the command, including the command itself and all its parameters. When the command in the Dockerfile changes, the command hash will also change. The command hash is usually used to determine whether a command needs to be re-executed. If the command hash of the command is the same as the previous build, and the dependent layer hash has not changed, it is considered that the output of this command has been cached and does not need to be re-executed.
[0073] Specifically, Figure 4c As shown, the command hash value sequence is C1, C2. The execution subject can determine the initial layer identification sequence in the first image hash table according to the command hash value sequence, such as one, two. Further, the execution subject can determine the image identification of the associated image in the image association relationship table according to the initial layer identification sequence, that is, 1, 2, 3.
[0074] This implementation method determines the initial layer identification sequence in the first image hash table according to the command hash value sequence, thereby realizing the query of the associated image based on the command hash value sequence.
[0075] In some optional ways, determining the initial layer identification sequence based on the attribute information of the target container image and the corresponding relationship table set includes: determining the initial layer identification sequence in the second image hash table according to the layer hash value sequence.
[0076] In this implementation, the relationship table set may include: a second image hash table. If the attribute information includes a layer hash value sequence, the execution subject may determine an initial layer identification sequence in the second image hash table according to the layer hash value sequence.
[0077] The second image hash table can be constructed based on the layer hash value of the container image that has been built historically, and can specifically include multiple layer hash values and corresponding layer identifiers. In addition, the second image hash table can also include the layer size and layer status (whether it is an empty layer) corresponding to the layer hash value.
[0078] Here, the layer hash sequence can include one or more layer hashes, which are hashes of image layers that identify the contents of the layer. Whenever a new layer is created (for example, by executing a Dockerfile command), the layer hash of this layer is calculated. If the contents of two layers are the same, their layer hashes will also be the same, which means that they can share the underlying storage. Layer hashes are often used to determine whether caching can be utilized. If the layer hash of a layer during the build process is the same as a previously built layer, Docker will use the layer in the cache instead of rebuilding it.
[0079] Specifically, Figure 4d As shown, the layer hash value sequence is L3, L4. The execution subject can determine the initial layer identification sequence in the second image hash table according to the layer hash value sequence, such as three and four. Further, the execution subject can determine the image identification of the associated image in the image association relationship table according to the initial layer identification sequence, that is, 2, 3.
[0080] This implementation method determines the initial layer identification sequence in the second image hash table according to the layer hash value sequence, thereby realizing the query of the associated image based on the layer hash value sequence.
[0081] In some optional methods, an initial layer identification sequence is determined based on the attribute information of the target container image and the corresponding relationship table set, including: determining a command hash value sequence in the first image content table according to the command content sequence; determining an initial layer identification sequence in the first image hash table according to the command hash value sequence.
[0082] In this implementation, the relationship table set may include: a first mirror content table and a first mirror hash table. If the attribute information includes a command content sequence, the execution subject may determine a command hash value sequence in the first mirror content table according to the command content sequence.
[0083] The first image content table may be constructed according to the command content of the container image that has been constructed historically, and may specifically include multiple command contents and corresponding command hash values.
[0084] Here, the command content may include one or more command contents.
[0085] Furthermore, the execution subject may determine the initial layer identification sequence in the first image hash table according to the command hash value sequence.
[0086] The first image hash table includes multiple command hash values and corresponding layer identifiers.
[0087] Specifically, Figure 4eAs shown, the command content sequence is CC1, CC2. The execution subject can determine the command hash value sequence in the first image content table according to the command content sequence, such as C1, C2. Further, the execution subject can determine the initial layer identification sequence in the first image hash table according to the command hash value sequence, one, two. Further, the execution subject can determine the image identification of the associated image in the image association relationship table according to the initial layer identification sequence, that is, 1, 2, 3.
[0088] This implementation method determines a command hash value sequence in the first image content table according to the command content sequence; determines an initial layer identification sequence in the first image hash table according to the command hash value sequence, thereby realizing query of associated images based on the command content sequence.
[0089] In some optional methods, an initial layer identification sequence is determined based on the attribute information of the target container image and the corresponding relationship table set, including: determining a layer hash value sequence in the second image content table according to the layer content sequence; determining an initial layer identification sequence in the second image hash table according to the layer hash value sequence.
[0090] In this implementation, the relationship table set may include: a second image content table and a second image hash table. If the attribute information includes a layer content sequence, the execution subject may determine a layer hash value sequence in the second image content table according to the layer content sequence.
[0091] The second image content table may be constructed according to the layer content of the container image that has been constructed historically, and may specifically include multiple layer contents and corresponding layer hash values.
[0092] Here, the layer content sequence may include one or more layer contents.
[0093] Furthermore, the execution entity may determine an initial layer identification sequence in the second image hash table according to the layer hash value sequence.
[0094] The second image hash table includes multiple layer hash values and corresponding layer identifiers.
[0095] Specifically, Figure 4f As shown, the layer content sequence is LC3, LC4. The execution subject can determine the layer hash value sequence in the second image content table according to the layer content sequence, such as L3, L4. Further, the execution subject can determine the initial layer identification sequence in the second image hash table according to the layer hash value sequence, three, four. Further, the execution subject can determine the image identification of the associated image in the image association relationship table according to the initial layer identification sequence, that is, 2, 3.
[0096] This implementation method determines a layer hash value sequence in the second image content table according to the layer content sequence; determines an initial layer identification sequence in the second image hash table according to the layer hash value sequence, thereby implementing a query of associated images based on the layer content sequence.
[0097] Step 402: Determine the associated image in the image association table based on the initial layer identification sequence.
[0098] In this embodiment, the implementation details and technical effects of step 402 can refer to the description of step 202 and will not be repeated here.
[0099] from Figure 4a It can be seen that Figure 2 Compared with the corresponding embodiments, process 400 of the container image query method in this embodiment reflects the determination of the initial layer identification sequence based on the attribute information of the target container image and the corresponding relationship table set, and different attribute information corresponds to different relationship table sets; based on the initial layer identification sequence, the associated image is determined in the image association relationship table, which helps to support different attribute information for searching, and effectively improves the flexibility and efficiency of the associated image search.
[0100] Further references Figure 5 As an implementation of the methods shown in the above figures, the present application provides an embodiment of a container image query device, and the device embodiment is similar to Figure 2 Corresponding to the method embodiment shown, the device can be specifically applied to various electronic devices.
[0101] like Figure 5 As shown, the container image query device 500 of this embodiment includes: a first determination module 501 and a second determination module 502.
[0102] The first determination module 501 may be configured to determine an initial layer identification sequence based on the attribute information of the target container image.
[0103] The second determining module 502 may be configured to determine the associated image in the image association relationship table based on the initial layer identification sequence.
[0104] In some optional manners of this embodiment, the first determination module is further configured to determine the initial layer identification sequence based on the attribute information of the target container image and the corresponding relationship table set.
[0105] In some optional ways of this embodiment, the first determination module is further configured to determine a specified image identifier in the image table according to the image name; and determine an initial layer identifier sequence in the image association table according to the specified image identifier.
[0106] In some optional aspects of this embodiment, the first determination module is further configured to determine an initial layer identification sequence in the first image hash table according to the command hash value sequence.
[0107] In some optional manners of this embodiment, the first determination module is further configured to determine an initial layer identification sequence in the second image hash table according to the layer hash value sequence.
[0108] In some optional aspects of this embodiment, the first determination module is further configured to determine a command hash value sequence in the first image content table according to the command content sequence; and determine an initial layer identification sequence in the first image hash table according to the command hash value sequence.
[0109] In some optional ways of this embodiment, the first determination module is further configured to determine a layer hash value sequence in the second image history table according to the layer content sequence; and determine an initial layer identification sequence in the second image hash table according to the layer hash value sequence.
[0110] In some optional aspects of this embodiment, the second determination module is further configured to determine the image identifier of the associated image in the image association relationship table according to the initial layer identifier sequence; and determine the image name of the associated image in the image table according to the image identifier of the associated image.
[0111] It should be noted that the collection, collection, updating, analysis, processing, use, transmission, storage and other aspects of user personal information involved in the technical solution of this disclosure are in compliance with the provisions of relevant laws and regulations, are used for legitimate purposes, and do not violate public order and good morals. Necessary measures are taken for user personal information to prevent illegal access to user personal information data and maintain the security of user personal information, network security and national security.
[0112] According to an embodiment of the present application, the present application also provides an electronic device and a readable storage medium.
[0113] like Figure 6 , which is a block diagram of an electronic device of a container image query method according to an embodiment of the present application.
[0114] 600 is a block diagram of an electronic device according to a container image query method according to an embodiment of the present application. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present application described and / or required herein.
[0115] like Figure 6 As shown, the electronic device includes: one or more processors 601, a memory 602, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. The various components are interconnected using different buses and can be installed on a common mainboard or installed in other ways as needed. The processor can process instructions executed in the electronic device, including instructions stored in or on the memory to display the graphical information of the GUI on an external input / output device (such as a display device coupled to the interface). In other embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple electronic devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 6 A processor 601 is taken as an example.
[0116] The memory 602 is a non-transitory computer-readable storage medium provided in the present application. The memory stores instructions executable by at least one processor to enable the at least one processor to execute the container image query method provided in the present application. The non-transitory computer-readable storage medium of the present application stores computer instructions, which are used to enable a computer to execute the container image query method provided in the present application.
[0117] The memory 602 is a non-transient computer-readable storage medium that can be used to store non-transient software programs, non-transient computer executable programs and modules, such as program instructions / modules corresponding to the container image query method in the embodiment of the present application (for example, the attached Figure 5 The processor 601 executes various functional applications and data processing of the server by running the non-transient software programs, instructions and modules stored in the memory 602, that is, the container image query method in the above method embodiment is implemented.
[0118] The memory 602 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created by the use of the electronic device for container image query, etc. In addition, the memory 602 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory 602 may optionally include a memory remotely disposed relative to the processor 601, and these remote memories may be connected to the electronic device for container image query via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0119] The electronic device of the container image query method may further include: an input device 603 and an output device 604. The processor 601, the memory 602, the input device 603 and the output device 604 may be connected via a bus or other means. Figure 6 The example of connecting through bus is taken in the following.
[0120] The input device 603 can receive input digital or character information, such as a touch screen, a keypad, a mouse, a track pad, a touch pad, an indicator bar, one or more mouse buttons, a track ball, a joystick, and other input devices. The output device 604 may include a display device, an auxiliary lighting device (e.g., an LED), and a tactile feedback device (e.g., a vibration motor). The display device may include, but is not limited to, a liquid crystal display (LCD), a light emitting diode (LED) display, and a plasma display. In some embodiments, the display device may be a touch screen.
[0121] Various implementations of the systems and techniques described herein can be realized in digital electronic circuit systems, integrated circuit systems, dedicated ASICs (application specific integrated circuits), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0122] These computer programs (also referred to as programs, software, software applications, or code) include machine instructions for programmable processors and can be implemented using high-level procedural and / or object-oriented programming languages, and / or assembly / machine languages. As used herein, the terms "machine-readable medium" and "computer-readable medium" refer to any computer program product, device, and / or means (e.g., disk, optical disk, memory, programmable logic device (PLD)) for providing machine instructions and / or data to a programmable processor, including a machine-readable medium that receives machine instructions as a machine-readable signal. The term "machine-readable signal" refers to any signal for providing machine instructions and / or data to a programmable processor.
[0123] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0124] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.
[0125] A computer system may include clients and servers. Clients and servers are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship to each other.
[0126] According to the technical solution of the embodiment of the present application, accurate query and efficient retrieval of associated images are achieved.
[0127] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this application can be executed in parallel, sequentially or in different orders, as long as the expected results of the technical solution disclosed in this application can be achieved, and this document is not limited here.
[0128] The above specific implementations do not constitute a limitation on the protection scope of this application. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of this application should be included in the protection scope of this application.
Claims
1. A container image query method, the method comprising: Based on the attribute information of the target container image, an initial layer identification sequence is determined, wherein the container image includes multiple image layers, the initial layer identification sequence is a subsequence of the layer identification sequence corresponding to the target container image, and the layer identification sequence is generated by sorting the layer identifications of the image layers according to the corresponding hierarchical levels; Based on the initial layer identification sequence, an associated image is determined in an image association relationship table, wherein the image association relationship table includes image identifications of multiple container images and corresponding layer identification sequences, and the initial layer identification sequence is a subsequence of the layer identification sequence corresponding to the image identification of the associated image.
2. The method according to claim 1, wherein: The determining of the initial layer identification sequence based on the attribute information of the target container image includes: Based on the attribute information of the target container image and the corresponding relationship table set, an initial layer identification sequence is determined.
3. The method according to claim 2, wherein: The relationship table set includes: an image table and an image association relationship table, the attribute information includes an image name, and the attribute information based on the target container image and the corresponding relationship table set, determining the initial layer identification sequence, including: According to the image name, a specified image identifier is determined in the image table, wherein the image table includes multiple image identifiers and corresponding image names; An initial layer identifier sequence is determined in the image association relationship table according to the specified image identifier.
4. The method according to claim 2, wherein: The relationship table set includes: a first image hash table, the attribute information includes a command hash value sequence, and the attribute information based on the target container image and the corresponding relationship table set, determining the initial layer identification sequence, including: According to the command hash value sequence, an initial layer identifier sequence is determined in the first image hash table, where the first image hash table includes a plurality of command hash values and corresponding layer identifiers.
5. The method according to claim 2, wherein: The relationship table set includes: a second image hash table, the attribute information includes a layer hash value sequence, and the attribute information based on the target container image and the corresponding relationship table set, determining an initial layer identification sequence, including: According to the layer hash value sequence, an initial layer identifier sequence is determined in the second image hash table, where the second image hash table includes a plurality of layer hash values and corresponding layer identifiers.
6. The method according to claim 2, wherein: The relationship table set includes: a first image hash table and a first image content table, the attribute information includes a command content sequence, and the attribute information based on the target container image and the corresponding relationship table set, determining the initial layer identification sequence, including: According to the command content sequence, determining a command hash value sequence in the first image content table, wherein the first image content table includes a plurality of command contents and corresponding command hash values; According to the command hash value sequence, an initial layer identifier sequence is determined in the first image hash table, where the first image hash table includes a plurality of command hash values and corresponding layer identifiers.
7. The method according to claim 2, wherein: The relationship table set includes: a second image hash table and a second image content table, the attribute information includes a layer content sequence, and the attribute information based on the target container image and the corresponding relationship table set, determining an initial layer identification sequence, including: Determine a layer hash value sequence in the second image history table according to the layer content sequence, where the second image history table is used to store layer contents and corresponding layer hash values; According to the layer hash value sequence, an initial layer identifier sequence is determined in the second image hash table, and the second image hash table is used to store layer hash values and corresponding layer identifiers.
8. The method according to any one of claims 1 to 7, wherein: The determining, based on the initial layer identification sequence, an associated image in an image association relationship table includes: Determining the image identifier of the associated image in the image association relationship table according to the initial layer identifier sequence; The image name of the associated image is determined in the image table according to the image identifier of the associated image, and the image table includes multiple image identifiers and corresponding image names.
9. A container image query device, the device comprising: A first determination module is configured to determine an initial layer identification sequence based on attribute information of a target container image, wherein the container image includes multiple image layers, the initial layer identification sequence is a subsequence of a layer identification sequence corresponding to the target container image, and the layer identification sequence is generated by sorting the layer identifications of the image layers according to corresponding hierarchical levels; The second determination module is configured to determine the associated image in the image association relationship table based on the initial layer identification sequence, wherein the image association relationship table includes image identifications of multiple container images and corresponding layer identification sequences, and the initial layer identification sequence is a subsequence of the layer identification sequence corresponding to the image identification of the associated image.
10. An electronic device, characterized in that: include: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor so that the at least one processor can perform the method according to any one of claims 1 to 8.
11. A non-transitory computer-readable storage medium storing computer instructions, characterized in that: The computer instructions are used to cause the computer to execute the method according to any one of claims 1 to 8.
12. A computer program product, comprising a computer program, which, when executed by a processor, implements the method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Software container registry service
CN108369622A
Mirror image upgrading method and device
CN113760349A
Container mirror image construction method, system, device and equipment and storage medium
CN117130725A
System and method for distributed objects storage, management, archival, searching, retrieval and mining in private and public clouds and deep invisible webs
US20110307451A1
