Mirror image layer file mounting method, device and equipment
After the first verification during the mount process of the image layer file, the non-compressed package format files are directly mounted and the compressed package format files are carried out for the second verification and mount, which solves the problem of low mount efficiency of the image layer file in the prior art and improves the image pulling efficiency.
Patent Information
- Application Number
- CN202411877288.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-18
- Publication Date
- 2025-04-15
AI Technical Summary
The prior art is inefficient in the mount process of mirror layer files, resulting in low image pulling efficiency.
By responding to the mirror pull request, the image layer file in the target file is obtained, and after confirming that the image layer file has passed the first verification, the image layer file in the non-compressed package format is directly mounted, and the image layer file in the compressed package format is performed for the second checksum mount process.
Improve the mount efficiency of the mirror layer file, thereby improving the efficiency of mirror pulling.
Smart Images

Figure CN119829076A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of cloud computing technology in the field of computer technology, and in particular to a method, device and equipment for mounting an image layer file. Background Art
[0002] When pulling a single-machine image, you need to obtain the image layer file, then mount the image layer file into the image layer; and then mount the image layer file onto the computer.
[0003] Furthermore, there is an urgent need for a solution that can complete the mounting of image layer files in a timely and fast manner. Summary of the invention
[0004] The present disclosure provides a method, apparatus and device for mounting image layer files.
[0005] According to a first aspect of the present disclosure, a method for mounting an image layer file is provided, comprising:
[0006] In response to an image pull request, obtaining a target file indicated by the image pull request, wherein the target file includes at least one image layer file; wherein the image pull request represents mounting processing of the target file;
[0007] After determining that the image layer file passes the first verification, the image layer file in the non-compressed package format is mounted, and the image layer file in the compressed package format is secondly verified and mounted.
[0008] According to a second aspect of the present disclosure, a device for mounting an image layer file is provided, comprising:
[0009] An acquisition unit, configured to, in response to an image pull request, acquire a target file indicated by the image pull request, wherein the target file includes at least one image layer file; wherein the image pull request indicates mounting processing of the target file;
[0010] The mounting unit is used to mount the image layer file in a non-compressed package format after determining that the image layer file passes the first verification, and perform a second verification and mounting process on the image layer file in a compressed package format.
[0011] According to a third aspect of the present disclosure, a computer program product is provided, comprising: a computer program, wherein the computer program is stored in a readable storage medium, at least one processor of an electronic device can read the computer program from the readable storage medium, and the at least one processor executes the computer program so that the terminal device executes the method described in the first aspect.
[0012] According to a fourth aspect of the present disclosure, an electronic device is provided, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the method described in the first aspect.
[0013] According to a fifth aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to cause the computer to execute the method described in the first aspect.
[0014] The technology disclosed in the present invention solves the problem of low image pulling efficiency.
[0015] 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
[0016] The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present disclosure.
[0017] Figure 1 is a schematic diagram according to a first embodiment of the present disclosure;
[0018] Figure 2 is a schematic diagram according to a second embodiment of the present disclosure;
[0019] Figure 3 is a schematic diagram according to a third embodiment of the present disclosure;
[0020] Figure 4 This is an example diagram of disk throughput comparison in the mounting process of the image layer file provided in the embodiment of the present disclosure;
[0021] Figure 5 is a schematic diagram according to a fourth embodiment of the present disclosure;
[0022] Figure 6 is a schematic diagram according to a fifth embodiment of the present disclosure;
[0023] Figure 7 This is an example diagram of time comparison corresponding to the mounting process of different image layer files provided by the embodiment of the present disclosure;
[0024] Figure 8 is a block diagram of a mounting device for an image layer file used to implement an embodiment of the present disclosure;
[0025] Fig. 9 is a block diagram of another image layer file mounting device for implementing an embodiment of the present disclosure;
[0026] Fig.10 is a schematic block diagram of an example electronic device 100 for implementing an embodiment of the present disclosure. DETAILED DESCRIPTION
[0027] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure 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 may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.
[0028] The present invention provides a method, device and apparatus for mounting an image layer file, which are applied to the field of cloud computing technology in the field of computer technology to improve the efficiency of image pulling.
[0029] Figure 1 Schematic diagram of the first embodiment of the present disclosure. Figure 1 As shown, the method for mounting an image layer file provided by the first embodiment of the present disclosure includes:
[0030] Step S101: In response to an image pull request, a target file indicated by the image pull request is obtained, where the target file includes at least one image layer file.
[0031] Specifically, in response to the image pull request, a target file indicated by the image pull request may be acquired, where the target file includes at least one image layer file.
[0032] Among them, the image pull request is a request to pull the target image, wherein the target file is the file of the target image, the image layer files included in the target file correspond to the image layers of the target image, and the number of image layer files corresponds to the number of image layers included in the target image.
[0033] Optionally, the image pull request represents downloading of the target file.
[0034] Among them, the present disclosure does not limit the process of obtaining the target file indicated by the image pull request, that is, downloading the target file. Optionally, the image can be pulled by a command line tool based on containerization technology. Among them, the present disclosure does not limit the command line tool based on containerization technology. Optionally, it can be Docker or docker pull.
[0035] Optionally, the target file can be obtained from the cloud or terminal storing the target file. Optionally, a target file download request can be sent to the cloud or terminal storing the target file to obtain the target file corresponding to the target file download request sent by the cloud or terminal storing the target file. Optionally, the target file download request includes but is not limited to: the name, version, label and other information of the image.
[0036] Among them, the image pull request represents the mounting process of the target file.
[0037] Optionally, after the target file is downloaded, it can be stored in the storage structure of OverlayFS. As an efficient storage driver, OverlayFS is widely used in container technology. In the process of storing the target file in the storage structure of OverlayFS, it needs to be presented in the image layer ImageLayers of the container root file system Container RootFS in the form of mounting, wherein the image layer is a read-only layer in OverlayFS, corresponding to the layer in the Docker image. These layers contain the basic data of the image and the changes in the construction process, wherein the read-only layer of the container root file system Container RootFS includes at least one image layer for mounting an image layer file in at least one image layer file, wherein when mounting at least one image layer file in each image layer, it is necessary to mount serially in a bottom-up order, that is, the previous layer can be mounted only after the next layer is mounted. Optionally, the container root file system Container RootFS also includes a writable layer Container Layers, where the writable layer is located in the upper layer of the read-only layer and is used to store all changes generated by the container during operation. Copy-on-Write (COW) is an important feature of OverlayFS. When a file in the writable layer is written, if the file exists in the read-only layer, OverlayFS will first copy the file from the read-only layer to the writable layer, and then modify the file in the writable layer. In this way, the data in the read-only layer remains unchanged, and all changes occur in the writable layer. Optionally, the container root file system Container RootFS also includes a merged view Merged View, where the merged view is located in the upper layer of the writable layer. This is the final file system view presented to the user by OverlayFS. It is obtained by merging multiple layers (including read-only layers and writable layers). When the user accesses the file system through this view, what he sees is the combined result of these layers. In container technologies such as Docker, Merged View corresponds to the mount point of the container, and the user accesses the file system in the container through this mount point.
[0038] Step S102: After determining that the image layer file passes the first verification, the image layer file in the non-compressed package format is mounted, and the image layer file in the compressed package format is secondly verified and mounted.
[0039] Specifically, after obtaining the target file indicated by the image pull request described in step S101, a first verification process can be performed on the image layer files included in the target file. If it is determined that at least one of the image layer files included in the target file fails the first verification process, a prompt message indicating that the first verification process failed is generated and presented.
[0040] The first verification is a process of verifying the image layer file according to its storage format. The present disclosure does not limit the process of performing the first verification. Optionally, the first verification can be performed by calculating the hash value of the image layer file.
[0041] Specifically, if it is determined that all the image layer files included in the target file pass the first verification process, then after determining that the image layer files pass the first verification, the image layer files in the non-compressed package format can be mounted, and the image layer files in the compressed package format can be secondly verified and mounted.
[0042] The image layer file included in the target file obtained in step S101 is an image layer file in a compressed package format, such as a tar.gz compressed package, or an image layer file in a non-compressed package format, such as a tar file package.
[0043] The image layer file to be mounted is a file in a non-compressed package format. Therefore, if the image layer file obtained in step S101 is a file in a compressed package format, it needs to be decompressed before mounting. The second verification is the process of verifying the image layer file to be mounted.
[0044] In the prior art, after determining that the image layer file has passed the first verification, no matter the image layer file obtained is an image layer file in a compressed package format or an image layer file in a non-compressed package format, each image layer file will be subjected to a second verification and mounting process to ensure the accuracy of the image layer file. However, performing a second verification and mounting process on each image layer file will result in low mounting efficiency of the image layer file, thereby causing the problem of low efficiency in image pulling.
[0045] Specifically, based on the above description of the mounting process and the second verification, in the embodiment provided by the present disclosure, if the acquired image layer file is a file in a non-compressed package format, then in the first verification process described above, the verification of the image layer file in the non-compressed package format has been completed, and therefore, the image layer file in the non-compressed package format can be directly mounted; if the acquired image layer file is a file in a compressed package format, then in the first verification process described above, only the verification of the image layer file in the compressed package format has been completed, and therefore, the image layer file in the compressed package format needs to be verified and mounted for the second time.
[0046] Optionally, based on the above description of the second check, before performing the second check and mounting processing on the image layer file in the compressed package format, the image layer file in the compressed package format may also be decompressed.
[0047] Among them, the present invention does not limit the process of mounting the image layer files in the non-compressed package format and performing a second check and mounting processing on the image layer files in the compressed package format. Optionally, different processing methods can be selected according to the actual storage format of each image layer file included in the target file to mount the image layer files in the non-compressed package format, and perform a second check and mounting processing on the image layer files in the compressed package format.
[0048] Optionally, during the second verification process of the image layer files in the compressed package format, if it is determined that at least one of the image layer files in the compressed package format has not passed the second verification process, a prompt message indicating that the second verification process has not passed is generated and presented.
[0049] In an embodiment of the present disclosure, by responding to an image pull request, a target file indicated by the image pull request is obtained, the target file includes at least one image layer file, and after determining that the image layer file passes the first verification, the image layer file in a non-compressed package format is mounted, and the image layer file in a compressed package format is secondly verified and mounted, wherein, after determining that the image layer file passes the first verification, only the image layer file in the compressed package format is secondly verified, which can improve the efficiency of mounting the image layer file on the basis of ensuring the accuracy of mounting the image layer file, and further improve the efficiency of image pulling.
[0050] It should be noted that the head model in this embodiment is not a head model for a specific user and cannot reflect the personal information of a specific user. It should be noted that the two-dimensional face image in this embodiment comes from a public data set.
[0051] In the technical solution of the present disclosure, the collection, storage, use, processing, transmission, provision and disclosure of user personal information involved are in compliance with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0052] In order to enable readers to more deeply understand the implementation principle of the present disclosure, the following Figure 2-Figure 9 right Figure 1 The illustrated embodiment is further refined.
[0053] Figure 2 is a schematic diagram according to the second embodiment of the present disclosure. Figure 2 As shown, the method for mounting an image layer file provided by the second embodiment of the present disclosure includes:
[0054] Step S201: In response to an image pull request, a target file indicated by the image pull request is obtained, where the target file includes at least one image layer file.
[0055] Among them, the image pull request represents the mounting process of the target file.
[0056] Specifically, for the detailed description of this step, reference may be made to the description of step S101, which will not be repeated here.
[0057] Step S202: After determining that the image layer file passes the first verification, if it is determined that the actual storage format of each image layer file is a non-compressed package format, each image layer file is serially mounted in the image layer corresponding to the image layer file.
[0058] Specifically, after determining that the image layer files pass the first verification, if it is determined that the actual storage format of each image layer file is a non-compressed package format, each image layer file can be serially mounted in the image layer corresponding to the image layer file.
[0059] Among them, based on the description of the second verification in step S102, after determining that the image layer file passes the first verification, if it is determined that the actual storage format of each image layer file is a non-compressed package format, it is determined that each image layer file does not need to be verified for the second time, and therefore, each image layer file can be directly mounted.
[0060] Among them, based on the description of OverlayFS and container root file system Container RootFS in step S101, when mounting the image layer file in the image layer of the container root file system Container RootFS, it is necessary to mount it serially from bottom to top. Therefore, in the process of directly mounting each image layer file described above, each image layer file can be serially mounted in the image layer corresponding to the image layer file.
[0061] In an embodiment of the present disclosure, by responding to an image pull request, a target file indicated by the image pull request is obtained, the target file includes at least one image layer file, and after determining that the image layer file passes the first verification, if it is determined that the actual storage format of each image layer file is a non-compressed package format, then each image layer file is serially mounted in the image layer corresponding to the image layer file, wherein, if it is determined that the actual storage format of each image layer file is a non-compressed package format, there is no need to decompress each image layer file, nor is there a need to perform a second verification process on each image layer file, therefore, the efficiency of mounting the image layer file can be improved, and the efficiency of image pulling can be further improved.
[0062] Figure 3 is a schematic diagram according to the third embodiment of the present disclosure. Figure 3 As shown, the method for mounting an image layer file provided in the third embodiment of the present disclosure includes:
[0063] Step S301: In response to an image pull request, a target file indicated by the image pull request is obtained, where the target file includes at least one image layer file.
[0064] Among them, the image pull request represents the mounting process of the target file.
[0065] Specifically, for the detailed description of this step, reference may be made to the description of step S101, which will not be repeated here.
[0066] Step S302: After determining that the image layer files pass the first verification, if it is determined that the actual storage format of each image layer file is a compressed package format, a second verification is performed on each image layer file in parallel.
[0067] Specifically, after it is determined that the image layer files pass the first verification, if it is determined that the actual storage format of each image layer file is a compressed package format, a second verification can be performed on each image layer file in parallel.
[0068] Among them, based on the description of the second verification in step S102, after determining that the image layer files pass the first verification, if it is determined that the actual storage format of each image layer file is a compressed package format, it is determined that each image layer file needs to be verified for the second time.
[0069] Among them, based on the description of OverlayFS and container root file system Container RootFS in step S101, when mounting the image layer file in the image layer in the container root file system Container RootFS, it is necessary to mount it serially from bottom to top, but it is not limited to the need to perform a second check on each image layer file in serial. Therefore, each image layer file can be checked twice in parallel to improve the efficiency of the secondary check, thereby improving the efficiency of mounting the image layer files and further improving the efficiency of image pulling.
[0070] Optionally, based on the description of the second check in step S102, the image layer files in the compressed package format may be decompressed before the second check and mounting process is performed on the image layer files in the compressed package format. If the second check is performed on each image layer file in parallel, each image layer file may be decompressed in parallel.
[0071] Figure 4 : is a disk throughput comparison example diagram of the mounting process of the image layer file provided by the embodiment of the present disclosure. Figure 4 (a) is the disk throughput of the image layer file mounting process when the image layer file is serially checked for the second time, where the disk throughput changes with time. Figure 4 (b) is the disk throughput of the image layer file mounting process when the image layer file is checked for the second time in parallel. Figure 4 (a) and Figure 4 (b) It can be seen that when the image layer file is checked for the second time in parallel, the disk throughput is greatly improved, which effectively shortens the mounting time of the image layer file. That is, the efficiency of mounting the image layer file is improved, and the efficiency of image pulling is further improved.
[0072] Optionally, the image layer file includes a first initial digest, where the first initial digest is a hash value determined based on the image layer file being in a non-compressed package format.
[0073] Specifically, the first initial summary is a hash value of the image layer file in a non-compressed package format determined during the construction process of the image layer file, and is stored in the cloud or terminal together with the image layer file, and is obtained locally when the image layer file is obtained.
[0074] Optionally, if the image layer file includes the first initial digest, the process of performing a second verification on each image layer file in parallel may include:
[0075] For each image layer file, execute the following steps in parallel:
[0076] First, the image layer file is decompressed to obtain a decompressed image layer file, and a hash value of the decompressed image layer file is calculated to obtain a first calculation summary.
[0077] Among them, the present disclosure does not limit the process of decompressing the image layer file to obtain the decompressed image layer file. Optionally, the process of decompressing the image layer file to obtain the decompressed image layer file corresponds to the compressed package format of the image layer file. Optionally, if the image layer file in the compressed package format is a tar.gz compressed package, the decompressed image layer file, that is, the image layer file in the non-compressed package format, is a tar file package.
[0078] The present disclosure does not limit the process of calculating the hash value of the decompressed image layer file to obtain the first calculation summary. Optionally, the hash value of the decompressed image layer file can be calculated based on the digest algorithm to obtain the first calculation summary. The present disclosure does not limit the digest algorithm. Optionally, it can be a secure hash algorithm (SHA), such as SHA-1, SHA-224, SHA-256, SHA-384, SHA-512, SHA-3, etc. Optionally, it can also be a message digest algorithm 5 (MD5).
[0079] Secondly, if the first calculated digest corresponding to the image layer file is consistent with the first initial digest, it is determined that the image layer file passes the second verification. If it is determined that the first calculated digest corresponding to the image layer file is inconsistent with the first initial digest, it is determined that the image layer file does not pass the second verification.
[0080] Specifically, if the first calculated digest corresponding to the image layer file is consistent with the first initial digest, it is determined that the hash value of the image layer file in the non-compressed package format determined during the construction of the image layer file is consistent with the hash value of the decompressed image layer file calculated before mounting, and it is determined that the image layer file passes the second verification. If it is determined that the first calculated digest corresponding to the image layer file is inconsistent with the first initial digest, it is determined that the hash value of the image layer file in the non-compressed package format determined during the construction of the image layer file is inconsistent with the hash value of the decompressed image layer file calculated before mounting, and it is determined that the image layer file does not pass the second verification.
[0081] Among them, in the process of performing the second verification on each image layer file in parallel, for each image layer file, a second verification is performed in parallel by comparing the first calculated summary with the first initial summary, which can complete the second verification more simply and efficiently, further improve the efficiency of mounting the image layer file, and thus further improve the efficiency of image pulling.
[0082] Optionally, the image layer file includes multiple sub-files, and the sub-files have a second initial digest, which is a hash value determined based on the sub-files being in a non-compressed package format.
[0083] Specifically, based on the above description of the first initial summary, the second initial summary is the hash value of the sub-file in the non-compressed package format determined during the construction of the image layer file, which is stored in the cloud or terminal together with the image layer file, and is obtained locally when the image layer file is obtained.
[0084] The present disclosure does not limit the number of sub-files included in the image layer file, and any number of sub-files that can constitute the image layer file can be used as the number of sub-files included in the image layer file provided by the present disclosure.
[0085] Optionally, if the image layer file includes multiple sub-files, and the sub-files have the second initial digest, the process of performing a second verification on each image layer file in parallel may include:
[0086] For each image layer file, execute the following steps in parallel:
[0087] First, for the current image layer file, each sub-file of the current image layer file is verified based on the second initial digest of the sub-file of the current image layer file.
[0088] The present disclosure does not limit the process of verifying each subfile of the current mirror layer file based on the second initial digest of the subfile of the current mirror layer file. Optionally, each subfile of the current mirror layer file can be verified serially based on the second initial digest of the subfile of the current mirror layer file. Optionally, each subfile of the current mirror layer file can also be verified in parallel based on the second initial digest of the subfile of the current mirror layer file.
[0089] Secondly, if it is determined that all subfiles of the current image layer file pass the verification, then it is determined that the current image layer file passes the second verification. If it is determined that any subfile of the current image layer file does not pass the verification, then it is determined that the current image layer file does not pass the second verification.
[0090] Specifically, if it is determined that all sub-files of the current image layer file have passed the verification, it is determined that the current image layer file has passed the second verification, and the mounting process described in step S303 can be continued.
[0091] Specifically, if it is determined that any subfile of the current image layer file fails the verification, it is determined that the current image layer file fails the second verification, and a prompt message indicating that the second verification fails can be generated and presented.
[0092] Among them, in the process of performing the second verification on each image layer file in parallel, if the image layer file includes multiple sub-files, performing the second verification on each image layer file in parallel through the second initial summary of the sub-file can complete the second verification more simply and efficiently, further improve the efficiency of mounting the image layer file, and thus further improve the efficiency of image pulling.
[0093] Optionally, the process of verifying each subfile of the current image layer file based on the second initial digest of the subfile of the current image layer file may include: serially verifying each subfile of the current image layer file based on the second initial digest of the subfile of the current image layer file.
[0094] Specifically, if each sub-file of the current image layer file is verified serially based on the second initial summary of the sub-file of the current image layer file, each image layer file only verifies one sub-file at the same time. While the mounting efficiency of the image layer files is improved in parallel between the image layers, the problem of excessive disk throughput caused by the parallel processing of the image layer files is avoided.
[0095] Alternatively, each sub-file of the current image layer file is verified based on the second initial digest of the sub-file of the current image layer file in parallel.
[0096] Optionally, the process of verifying each subfile of the current image layer file in parallel based on the second initial digest of the subfile of the current image layer file may include verifying each subfile of the current image layer file in full parallel based on the second initial digest of the subfile of the current image layer file, or verifying each subfile of the current image layer file in partial parallel based on the second initial digest of the subfile of the current image layer file.
[0097] Among them, full parallelism means that all sub-files of the image layer file are parallel. Optionally, the total memory size corresponding to all sub-files in the image layer file can be determined first. If the total memory size is determined to be less than the preset threshold, the full parallel method is selected for verification. Otherwise, the partial parallel method is selected. Among them, partial parallelism means that each sub-file in the image layer file is divided and processed according to the preset threshold, and the multiple sub-files after each division are verified in parallel, and the multiple sub-files divided together are verified serially.
[0098] Among them, based on the above description of the process of verifying each sub-file of the current image layer file in parallel based on the second initial summary of the sub-file of the current image layer file, the mounting efficiency of the image layer file can be further improved on the basis of avoiding the problem of excessive disk throughput caused by the parallel operation of each image layer file and improving the mounting efficiency of the image layer file in parallel between image layers.
[0099] Among them, if the sub-files of the current image layer file are verified serially based on the second initial summary of the sub-file of the current image layer file, then each image layer file only verifies one sub-file at the same time, which improves the mounting efficiency of the image layer files in parallel between the image layers, and avoids the problem of excessive disk throughput caused by the parallel operation of each image layer file. If the sub-files of the current image layer file are verified in parallel based on the second initial summary of the sub-file of the current image layer file, the mounting efficiency of the image layer file can be further improved on the basis of avoiding the problem of excessive disk throughput caused by the parallel operation of each image layer file and improving the mounting efficiency of the image layer files in parallel between the image layers. Based on the above description, the mounting efficiency of the image layer files can be improved, and the image pulling efficiency can be further improved.
[0100] Optionally, based on the second initial digest of the sub-file of the current image layer file, the process of verifying each sub-file of the current image layer file may include:
[0101] First, the sub-file of the current image layer is decompressed to obtain a decompressed sub-file, and a hash value of the decompressed sub-file is calculated to obtain a second calculation summary.
[0102] Among them, the specific description of this step in the present disclosure can refer to the above description of the process of decompressing the image layer file to obtain the decompressed image layer file, and calculating the hash value of the decompressed image layer file to obtain the first calculation summary, which will not be repeated here.
[0103] Secondly, if it is determined that the second calculated digest of the subfile is consistent with the second initial digest, then it is determined that the subfile passes the verification. If it is determined that the second calculated digest of the subfile is inconsistent with the second initial digest, then it is determined that the subfile fails the verification.
[0104] Among them, the specific description of this step in the present disclosure can refer to the above description of if the first calculation summary corresponding to the image layer file is consistent with the first initial summary, it is determined that the image layer file passes the second verification. If it is determined that the first calculation summary corresponding to the image layer file is inconsistent with the first initial summary, it is determined that the image layer file does not pass the second verification, which will not be repeated here.
[0105] Among them, based on the second initial summary of the sub-file of the current image layer file, in the process of verifying each sub-file of the current image layer file, a second verification is performed by comparing the second calculated summary with the second initial summary. This can complete the second verification more simply and efficiently, further improve the efficiency of mounting the image layer file, and thus further improve the efficiency of image pulling.
[0106] Step S303: After determining that the image layer file passes the second verification, the image layer file that passes the second verification is serially mounted in the image layer corresponding to the image layer file.
[0107] Specifically, after determining that each image layer file passes the second verification according to the process described in step S302, the image layer files that pass the second verification are serially mounted in the image layer corresponding to the image layer file.
[0108] Optionally, if it is determined that at least one of the image layer files has not passed the second verification, a prompt message indicating that the second verification process has not passed is generated and presented.
[0109] In an embodiment of the present disclosure, by responding to an image pull request, a target file indicated by the image pull request is obtained, the target file includes at least one image layer file, and after determining that the image layer file passes the first verification, if it is determined that the actual storage format of each image layer file is a compressed package format, a second verification is performed on each image layer file in parallel, and after determining that the image layer file passes the second verification, the image layer files that pass the second verification are serially mounted in the image layer corresponding to the image layer file, wherein, if it is determined that the actual storage format of each image layer file is a compressed package format, a second verification is performed on each image layer file in parallel, which improves the efficiency of the secondary verification, thereby improving the efficiency of mounting the image layer files, and further improving the efficiency of image pulling.
[0110] Figure 5 is a schematic diagram according to the fourth embodiment of the present disclosure. Figure 5 As shown, the method for mounting an image layer file provided by the fourth embodiment of the present disclosure includes:
[0111] Step S501: In response to an image pull request, a target file indicated by the image pull request is obtained, where the target file includes at least one image layer file.
[0112] Among them, the image pull request represents the mounting process of the target file.
[0113] Specifically, for the detailed description of this step, reference may be made to the description of step S101, which will not be repeated here.
[0114] Step S502: After determining that the image layer file passes the first verification, the image layer file in the non-compressed package format is mounted according to the mounting order of the image layer file, and the image layer file in the compressed package format is mounted after a second verification.
[0115] Specifically, after determining that the image layer files pass the first verification, if it is determined that the actual storage format of each image layer file includes both compressed package format and non-compressed package format, the image layer files in non-compressed package format can be mounted according to the mounting order of the image layer files, and the image layer files in compressed package format can be mounted after a second verification.
[0116] The mounting order of the image layer files is the order of serially mounting the image layer files described in the above embodiment.
[0117] Specifically, if the actual storage format of the image layer file is a non-compressed package format, as described in step S202, it is determined that the image layer file does not need to be verified a second time, and therefore, the image layer file can be directly mounted.
[0118] Specifically, if the actual storage format of the image layer file is a compressed package format, as described in step S302, it is determined that the image layer file needs to be verified for the second time, so the image layer file in the compressed package format can be verified for the second time before being mounted. Optionally, before the image layer file in the compressed package format is verified for the second time, the image layer file in the compressed package format can be decompressed.
[0119] In an embodiment of the present disclosure, by responding to an image pull request, a target file indicated by the image pull request is obtained, the target file includes at least one image layer file, and after determining that the image layer file passes the first verification, the image layer file in a non-compressed package format is mounted according to the mounting order of the image layer file, and the image layer file in a compressed package format is mounted after a second verification, wherein, if it is determined that each image layer file includes a file whose actual storage format is a non-compressed package format, there is no need to decompress the image layer file in the non-compressed package format, nor is there a need to perform a second verification on the image layer file in the non-compressed package format, thereby improving the efficiency of mounting the image layer file, and further improving the efficiency of image pulling.
[0120] Figure 6 is a schematic diagram according to the fifth embodiment of the present disclosure. Figure 6 As shown, the method for mounting an image layer file provided in the fifth embodiment of the present disclosure includes:
[0121] Step S601: In response to an image pull request, a target file indicated by the image pull request is obtained, where the target file includes at least one image layer file.
[0122] Among them, the image pull request represents the mounting process of the target file.
[0123] Specifically, for the detailed description of this step, reference may be made to the description of step S101, which will not be repeated here.
[0124] Step S602: After determining that the image layer file passes the first verification, a second verification is performed on the image layer files in the compressed package formats in parallel.
[0125] Specifically, after determining that the image layer files have passed the first verification, if it is determined that the actual storage format of each image layer file includes both compressed package format and non-compressed package format, if the image layer files are mounted according to the mounting process of the image layer files described in step S502, only the process of performing a secondary verification on the image layer files in the non-compressed package format can be reduced, and the mounting efficiency of the image layer files cannot be effectively improved. Figure 3 The description in the illustrated embodiment can perform a second check on the image layer files in each compressed package format in parallel, thereby further improving the efficiency of the second check, thereby improving the efficiency of mounting the image layer files, and further improving the efficiency of image pulling. Among them, the description of the process of performing a second check on the image layer files in each compressed package format in parallel can refer to the description of the process of performing a second check on the image layer files in parallel in step S302, which will not be repeated here.
[0126] Optionally, if it is determined that at least one of the image layer files in the compression package formats has not passed the second verification, a prompt message indicating that the second verification process has not passed is generated and presented.
[0127] Optionally, if it is determined that there is only one image layer file in the compressed package format, then the process of performing secondary verification on the image layer files in the compressed package format in parallel is meaningless, that is, the effect of improving the efficiency of mounting the image layer files is the same as Figure 5 The effect is the same in the illustrated embodiment.
[0128] Step S603: according to the mounting order of the image layer files, the image layer files in the non-compressed package format and the image layer files in the compressed package format that have passed the second verification are serially mounted in the image layer corresponding to the image layer files.
[0129] Specifically, after performing a second check on the image layer files in each compressed package format in parallel, the image layer files in the non-compressed package format and the image layer files in the compressed package format that passed the second check can be serially mounted in the image layer corresponding to the image layer file according to the mounting order of the image layer files.
[0130] For the description of the mounting order of the image layer files, reference may be made to the description in step S502 and will not be repeated here.
[0131] Figure 7 : is an example diagram of the time comparison corresponding to the mounting process of different image layer files provided by the embodiment of the present disclosure. Figure 7 (a) Figure 2 The time display diagram corresponding to the mounting process of the image layer file provided in the illustrated embodiment, wherein the mounting process of the image layer file includes three image layer files, and each image layer file is in a non-compressed package format. Figure 7 (b) Figure 3 The time display diagram corresponding to the mounting process of the image layer file provided in the illustrated embodiment, wherein the mounting process of the image layer file includes three image layer files, and each image layer file is in a compressed package format. Figure 7 (c) Figure 5 The time display diagram corresponding to the mounting process of the image layer file provided in the illustrated embodiment, wherein the mounting process of the image layer file includes three image layer files, and the first layer image layer file and the second layer image layer file are in compressed package format, and the third layer image layer file is in non-compressed package format. Figure 7 (d) Figure 6 The time display diagram corresponding to the mounting process of the image layer file provided in the illustrated embodiment, wherein the mounting process of the image layer file includes three image layer files, and the first layer image layer file and the second layer image layer file are in compressed package format, and the third layer image layer file is in non-compressed package format.
[0132] In an embodiment of the present disclosure, by responding to an image pull request, a target file indicated by the image pull request is obtained, the target file includes at least one image layer file, and after determining that the image layer file passes the first verification, a second verification is performed on the image layer files in each compressed package format in parallel, and according to the mounting order of the image layer files, the image layer files in a non-compressed package format and the image layer files in a compressed package format that pass the second verification are serially mounted in the image layer corresponding to the image layer file, wherein, if it is determined that each image layer file includes a file whose actual storage format is a compressed package format, the image layer files in each compressed package format are subjected to a second verification process in parallel, which can improve the efficiency of the second verification process, thereby improving the efficiency of mounting the image layer files, and further improving the efficiency of image pulling.
[0133] In some embodiments, the image layer file includes a first initial digest and a third initial digest.
[0134] The first initial digest is a hash value determined based on the image layer file being in a non-compressed package format. For a description of the first initial digest, reference may be made to the description in step S302 and will not be repeated here.
[0135] The third initial digest is a hash value determined based on the actual storage format of the image layer file.
[0136] Specifically, the third initial digest is a hash value of the actual storage format of the image layer file determined during the construction process of the image layer file, which is stored in the cloud or terminal together with the image layer file, and is obtained locally when the image layer file is obtained. Based on the description in step S102, the actual storage format of the image layer file can be a compressed package format or a non-compressed package format.
[0137] Among them, through the first initial digest and the second initial digest, the hash value corresponding to the actual storage format of the image layer file and the hash value corresponding to the non-compressed package format can be known, and the first and second checks of the image layer file can be accurately completed, thereby improving the accuracy of image pulling.
[0138] In some embodiments, before mounting the image layer file in a non-compressed package format and performing a second check and mounting process on the image layer file in a compressed package format, the process includes:
[0139] According to the first initial digest and the third initial digest of the image layer file, an actual storage format of the image layer file is determined, wherein the actual storage format is a non-compressed package format or a compressed package format.
[0140] Specifically, before mounting the image layer file in the non-compressed package format and performing the second check and mounting process on the image layer file in the compressed package format, it is necessary to determine the actual storage format of the image layer file. Therefore, the actual storage format of the image layer file can be determined based on the first initial digest and the third initial digest of the image layer file.
[0141] Among them, the present disclosure does not limit the process of determining the actual storage format of the image layer file according to the first initial digest and the third initial digest of the image layer file. Optionally, the actual storage format of the image layer file can be determined according to the size relationship between the first initial digest and the third initial digest.
[0142] Among them, based on the description of the first initial digest and the third initial digest in the above embodiment, the first initial digest is a hash value determined based on the image layer file being in a non-compressed package format, and the third initial digest is a hash value determined based on the actual storage format of the image layer file. Therefore, according to the size relationship between the first initial digest and the third initial digest, the actual storage format of the image layer file can be accurately determined, thereby improving the mounting efficiency of the image layer file and further improving the efficiency of image pulling.
[0143] Optionally, the process of determining the actual storage format of the image layer file according to the first initial digest and the third initial digest of the image layer file may include: if it is determined that the first initial digest of the image layer file is consistent with the third initial digest, determining that the actual storage format of the image layer file is a non-compressed package format.
[0144] Specifically, if it is determined that the first initial digest of the image layer file is consistent with the third initial digest, then the hash value determined based on the image layer file being in a non-compressed package format is determined to be the same as the hash value determined based on the actual storage format of the image layer file, then it can be determined that the actual storage format of the image layer file is a non-compressed package format.
[0145] If it is determined that the first initial digest and the third initial digest of the image layer file are inconsistent, it is determined that the actual storage format of the image layer file is a compressed package format.
[0146] Specifically, if it is determined that the first initial digest of the image layer file is inconsistent with the third initial digest, it is determined that the hash value determined based on the image layer file being in a non-compressed package format is different from the hash value determined based on the actual storage format of the image layer file, then it can be determined that the actual storage format of the image layer file is a non-compressed package format.
[0147] Among them, since the first initial digest is a hash value determined based on the image layer file being in a non-compressed package format, and the third initial digest is a hash value determined based on the actual storage format of the image layer file, the actual storage format of the image layer file can be determined simply by determining whether the first initial digest is the same as the third initial digest, thereby improving the mounting efficiency of the image layer file and further improving the efficiency of image pulling.
[0148] In some embodiments, the process of determining that the image layer file passes the first verification may include:
[0149] First, the hash value of the image layer file is calculated to obtain the third calculation summary.
[0150] The present disclosure does not limit the process of calculating the hash value of the image layer file to obtain the third calculation summary. Optionally, the process of calculating the hash value of the decompressed image layer file in step S302 to obtain the first calculation summary can be referred to, which is not described here. The image layer file for calculating the hash value here can be an image layer file in a non-compressed package format or an image layer file in a compressed package format.
[0151] If it is determined that the third calculated digest of the image layer file is consistent with the third initial digest, it is determined that the image layer file passes the first verification.
[0152] Among them, if it is determined that the third calculated summary of the image layer file is consistent with the third initial summary, it is determined that the image layer file passes the first verification, it is determined that the hash value determined based on the actual storage format of the image layer file during the construction process of the image layer file is consistent with the calculated hash value of the image layer file, it is determined that the downloaded image layer file is consistent with the image layer file stored in the cloud or the terminal, and it is determined that the image layer file passes the first verification.
[0153] If it is determined that the third calculated digest of the image layer file is inconsistent with the third initial digest, it is determined that the image layer file fails the first verification.
[0154] Among them, if it is determined that the third calculated summary of the image layer file is inconsistent with the third initial summary, it is determined that the image layer file has not passed the first verification, it is determined that the hash value determined based on the actual storage format of the image layer file during the construction process of the image layer file is inconsistent with the hash value of the image layer file calculated, it is determined that the downloaded image layer file is inconsistent with the image layer file stored in the cloud or the terminal, and it is determined that the image layer file has not passed the first verification.
[0155] Among them, in the process of determining whether the image layer file passes the first verification, the first verification is performed by comparing the third calculated summary with the third initial summary, which can complete the first verification more simply and efficiently, further improve the efficiency of mounting the image layer file, and thus further improve the efficiency of image pulling.
[0156] Figure 8 is a block diagram of a mounting device for an image layer file used to implement an embodiment of the present disclosure, such as Figure 8 As shown, the image layer file mounting device 800 provided in the sixth embodiment of the present disclosure includes:
[0157] The acquisition unit 801 is used to respond to the image pull request and acquire the target file indicated by the image pull request, wherein the target file includes at least one image layer file; wherein the image pull request represents mounting processing of the target file;
[0158] The mounting unit 802 is used to mount the image layer file in the non-compressed package format after determining that the image layer file passes the first verification, and perform a second verification and mounting process on the image layer file in the compressed package format.
[0159] In some embodiments, the mounting unit 802 includes a first mounting module 803, which is used to serially mount each image layer file in the image layer corresponding to the image layer file if it is determined that the actual storage format of each image layer file is a non-compressed package format.
[0160] In some embodiments, the mounting unit 802 also includes a second mounting module 804, which is used to perform a second check on each image layer file in parallel if it is determined that the actual storage format of each image layer file is a compressed package format; after determining that the image layer file passes the second check, the image layer file that passes the second check is serially mounted in the image layer corresponding to the image layer file.
[0161] In some embodiments, the image layer file includes a first initial digest, which is a hash value determined based on the image layer file being in a non-compressed package format; the second mounting module 804 includes a first execution submodule 806, which is used to execute the following steps in parallel for each image layer file: decompress the image layer file to obtain a decompressed image layer file; and calculate the hash value of the decompressed image layer file to obtain a first calculation digest; if the first calculation digest corresponding to the image layer file is consistent with the first initial digest, it is determined that the image layer file passes the second verification; if it is determined that the first calculation digest corresponding to the image layer file is inconsistent with the first initial digest, it is determined that the image layer file does not pass the second verification.
[0162] In some embodiments, the image layer file includes multiple sub-files, and the sub-files have a second initial digest, which is a hash value determined based on the sub-files being in a non-compressed package format; the second mounting module 804 includes a second execution sub-module 807, which is used to execute the following steps in parallel for each image layer file: for the current image layer file, based on the second initial digest of the sub-files of the current image layer file, verify each sub-file of the current image layer file; if it is determined that each sub-file of the current image layer file passes the verification, it is determined that the current image layer file passes the second verification; if it is determined that any sub-file of the current image layer file does not pass the verification, it is determined that the current image layer file does not pass the second verification.
[0163] In some embodiments, the second execution submodule 807 is specifically used to verify each subfile of the current image layer file in series based on the second initial summary of the subfile of the current image layer file; or, in parallel, verify each subfile of the current image layer file based on the second initial summary of the subfile of the current image layer file.
[0164] In some embodiments, the second execution submodule 807 is further specifically used to decompress the subfile of the current image layer to obtain a decompressed subfile, and calculate the hash value of the decompressed subfile to obtain a second calculation summary; if it is determined that the second calculation summary of the subfile is consistent with the second initial summary, it is determined that the subfile passes the verification; if it is determined that the second calculation summary of the subfile is inconsistent with the second initial summary, it is determined that the subfile fails the verification.
[0165] In some embodiments, the image layer file in a non-compressed package format is mounted, and the image layer file in a compressed package format is secondly checked and mounted, including:
[0166] According to the mounting order of the image layer files, the image layer files in the non-compressed package format are mounted, and the image layer files in the compressed package format are mounted after a second verification.
[0167] In some embodiments, the mounting unit 802 also includes a third mounting module 805, which is used to perform a second check on the image layer files in each compressed package format in parallel; according to the mounting order of the image layer files, the image layer files in the non-compressed package format and the image layer files in the compressed package format that pass the second check are serially mounted in the image layer corresponding to the image layer file.
[0168] In some embodiments, the image layer file includes a first initial digest and a third initial digest; the first initial digest is a hash value determined based on the image layer file being in a non-compressed package format, and the third initial digest is a hash value determined based on the actual storage format of the image layer file.
[0169] In some embodiments, the mounting unit 802 further includes a determination module 808, which is used to determine the actual storage format of the image layer file according to the first initial digest and the third initial digest of the image layer file; wherein the actual storage format is a non-compressed package format or a compressed package format.
[0170] In some embodiments, the determination module 808 is specifically used to determine that if it is determined that the first initial digest of the image layer file is consistent with the third initial digest, then determine that the actual storage format of the image layer file is a non-compressed package format; if it is determined that the first initial digest of the image layer file is inconsistent with the third initial digest, then determine that the actual storage format of the image layer file is a compressed package format.
[0171] In some embodiments, the determination module 808 is further specifically used to calculate the hash value of the image layer file to obtain a third calculated summary; if it is determined that the third calculated summary of the image layer file is consistent with the third initial summary, it is determined that the image layer file passes the first verification; if it is determined that the third calculated summary of the image layer file is inconsistent with the third initial summary, it is determined that the image layer file fails the first verification.
[0172] Fig. 9 It is a block diagram of another image layer file mounting device used to implement the embodiment of the present disclosure.
[0173] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium and a computer program product.
[0174] According to an embodiment of the present disclosure, the present disclosure also provides a computer program product, which includes: a computer program, the computer program is stored in a readable storage medium, at least one processor of an electronic device can read the computer program from the readable storage medium, and at least one processor executes the computer program so that the terminal device executes the solution provided by any of the above embodiments.
[0175] Fig.10 1 is a schematic block diagram of an example electronic device 100 for implementing an embodiment of the present disclosure. 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 disclosure described and / or claimed herein.
[0176] like Fig.10As shown, the device 100 includes a computing unit 101, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 102 or a computer program loaded from a storage unit 108 into a random access memory (RAM) 103. In the RAM 103, various programs and data required for the operation of the device 100 can also be stored. The computing unit 101, the ROM 102, and the RAM 103 are connected to each other via a bus 104. An input / output (I / O) interface 105 is also connected to the bus 104.
[0177] A number of components in the device 100 are connected to the I / O interface 105, including: an input unit 106, such as a keyboard, a mouse, etc.; an output unit 107, such as various types of displays, speakers, etc.; a storage unit 108, such as a disk, an optical disk, etc.; and a communication unit 109, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 109 allows the device 100 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0178] The computing unit 101 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 101 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 101 performs the various methods and processes described above, such as the mounting method of the image layer file. For example, in some embodiments, the mounting method of the image layer file may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 108. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 100 via the ROM 102 and / or the communication unit 109. When the computer program is loaded into the RAM 103 and executed by the computing unit 101, one or more steps of the mounting method of the image layer file described above may be performed. Alternatively, in other embodiments, the computing unit 101 may be configured to execute the mounting method of the image layer file in any other appropriate manner (e.g., by means of firmware).
[0179] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), 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.
[0180] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0181] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0182] 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).
[0183] 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.
[0184] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship between the client and the server is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services ("Virtual Private Server", or "VPS" for short). The server may also be a server of a distributed system, or a server combined with a blockchain.
[0185] 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 disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.
[0186] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. 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 modification, equivalent substitution and improvement made within the spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.
Claims
1. A method for mounting an image layer file, comprising: In response to an image pull request, obtaining a target file indicated by the image pull request, wherein the target file includes at least one image layer file; wherein the image pull request represents mounting processing of the target file; After determining that the image layer file passes the first verification, the image layer file in the non-compressed package format is mounted, and the image layer file in the compressed package format is secondly verified and mounted.
2. The method according to claim 1, wherein: The mounting process of the image layer file in the non-compressed package format and the second verification and mounting process of the image layer file in the compressed package format include: If it is determined that the actual storage formats of the image layer files are all non-compressed package formats, then the image layer files are serially mounted in the image layer corresponding to the image layer files.
3. The method according to claim 1, wherein: The mounting process of the image layer file in the non-compressed package format and the second verification and mounting process of the image layer file in the compressed package format include: If it is determined that the actual storage formats of the image layer files are all compressed package formats, then the image layer files are verified for the second time in parallel; After determining that the image layer file passes the second verification, the image layer file that passes the second verification is serially mounted in the image layer corresponding to the image layer file.
4. The method according to claim 3, wherein: The image layer file includes a first initial digest, which is a hash value determined based on the image layer file being in a non-compressed package format; the parallel second verification of each of the image layer files includes: For each of the image layer files, execute the following steps in parallel: Decompressing the image layer file to obtain a decompressed image layer file; and calculating a hash value of the decompressed image layer file to obtain a first calculation summary; If the first calculated digest corresponding to the image layer file is consistent with the first initial digest, it is determined that the image layer file passes the second verification; if it is determined that the first calculated digest corresponding to the image layer file is inconsistent with the first initial digest, it is determined that the image layer file does not pass the second verification.
5. The method according to claim 3, wherein: The image layer file includes a plurality of sub-files, each of which has a second initial digest, which is a hash value determined based on the sub-file being in a non-compressed package format; and the parallel second verification of each of the image layer files includes: For each of the image layer files, execute the following steps in parallel: For the current image layer file, based on the second initial digest of the sub-file of the current image layer file, verify each sub-file of the current image layer file; If it is determined that all subfiles of the current image layer file pass the verification, then it is determined that the current image layer file passes the second verification; if it is determined that any subfile of the current image layer file does not pass the verification, then it is determined that the current image layer file does not pass the second verification.
6. The method according to claim 5, wherein: The verifying each sub-file of the current image layer file based on the second initial digest of the sub-file of the current image layer file includes: Serially verifying each sub-file of the current image layer file based on the second initial digest of the sub-file of the current image layer file; Alternatively, each sub-file of the current image layer file is verified based on the second initial digest of the sub-file of the current image layer file in parallel.
7. The method according to claim 5 or 6, wherein: The verifying each sub-file of the current image layer file based on the second initial digest of the sub-file of the current image layer file includes: Decompressing the sub-file of the current image layer to obtain a decompressed sub-file, and calculating a hash value of the decompressed sub-file to obtain a second calculation summary; If it is determined that the second calculated digest of the subfile is consistent with the second initial digest, the subfile is determined to have passed the verification; if it is determined that the second calculated digest of the subfile is inconsistent with the second initial digest, the subfile is determined to have failed the verification.
8. The method according to claim 1, wherein: The mounting process of the image layer file in the non-compressed package format and the second verification and mounting process of the image layer file in the compressed package format include: According to the mounting order of the image layer files, the image layer files in the non-compressed package format are mounted, and the image layer files in the compressed package format are mounted after a second verification.
9. The method according to claim 1, wherein: The mounting process of the image layer file in the non-compressed package format and the second verification and mounting process of the image layer file in the compressed package format include: Perform a second verification on the image layer files in each compressed package format in parallel; According to the mounting order of the image layer files, the image layer files in the non-compressed package format and the image layer files in the compressed package format that have passed the second verification are serially mounted in the image layer corresponding to the image layer files.
10. The method according to any one of claims 1 to 9, wherein: The image layer file includes a first initial digest and a third initial digest; the first initial digest is a hash value determined based on the image layer file being in a non-compressed package format, and the third initial digest is a hash value determined based on an actual storage format of the image layer file.
11. The method according to claim 10, wherein: The method includes: before mounting the image layer file in the non-compressed package format and performing a second check and mounting process on the image layer file in the compressed package format; According to the first initial digest and the third initial digest of the image layer file, an actual storage format of the image layer file is determined; wherein the actual storage format is a non-compressed package format or a compressed package format.
12. The method according to claim 11, wherein: The determining, according to the first initial digest and the third initial digest of the image layer file, an actual storage format of the image layer file comprises: If it is determined that the first initial digest of the image layer file is consistent with the third initial digest, determining that the actual storage format of the image layer file is a non-compressed package format; If it is determined that the first initial digest and the third initial digest of the image layer file are inconsistent, it is determined that the actual storage format of the image layer file is a compressed package format.
13. The method according to any one of claims 1 to 12, wherein: The determining that the image layer file passes the first verification includes: Calculate the hash value of the image layer file to obtain a third calculation summary; If it is determined that the third calculated digest of the image layer file is consistent with the third initial digest, then it is determined that the image layer file passes the first verification; If it is determined that the third calculated digest of the image layer file is inconsistent with the third initial digest, it is determined that the image layer file fails the first verification.
14. A device for mounting an image layer file, comprising: An acquisition unit, configured to, in response to an image pull request, acquire a target file indicated by the image pull request, wherein the target file includes at least one image layer file; wherein the image pull request indicates mounting processing of the target file; The mounting unit is used to mount the image layer file in a non-compressed package format after determining that the image layer file passes the first verification, and perform a second verification and mounting process on the image layer file in a compressed package format.
15. The method according to claim 14, wherein: The mounting unit includes a first mounting module, which is used to serially mount each of the image layer files in the image layer corresponding to the image layer file if it is determined that the actual storage format of each of the image layer files is a non-compressed package format.
16. The method according to claim 14, wherein: The mounting unit also includes a second mounting module, which is used to perform a second verification on each of the image layer files in parallel if it is determined that the actual storage format of each of the image layer files is a compressed package format; after determining that the image layer file passes the second verification, the image layer files that pass the second verification are serially mounted in the image layer corresponding to the image layer file.
17. The method according to claim 16, wherein: The image layer file includes a first initial digest, which is a hash value determined based on that the image layer file is in a non-compressed package format; the second mounting module includes a first execution submodule, which is used to execute the following steps in parallel for each of the image layer files: decompress the image layer file to obtain a decompressed image layer file; and calculate the hash value of the decompressed image layer file to obtain a first calculation digest; if the first calculation digest corresponding to the image layer file is consistent with the first initial digest, it is determined that the image layer file passes the second verification; if it is determined that the first calculation digest corresponding to the image layer file is inconsistent with the first initial digest, it is determined that the image layer file does not pass the second verification.
18. The method according to claim 16, wherein: The image layer file includes a plurality of sub-files, each of the sub-files having a second initial digest, wherein the second initial digest is a hash value determined based on the sub-files being in a non-compressed package format; The second mounting module includes a second execution submodule, which is used to execute the following steps in parallel for each of the image layer files: for the current image layer file, based on the second initial summary of the subfile of the current image layer file, verify each subfile of the current image layer file; If it is determined that all subfiles of the current image layer file pass the verification, then it is determined that the current image layer file passes the second verification; if it is determined that any subfile of the current image layer file does not pass the verification, then it is determined that the current image layer file does not pass the second verification.
19. The method according to claim 18, wherein: The second execution submodule is specifically used to verify each subfile of the current image layer file in series based on the second initial summary of the subfile of the current image layer file; or, in parallel, verify each subfile of the current image layer file based on the second initial summary of the subfile of the current image layer file.
20. The method according to claim 18 or 19, wherein: The second execution submodule is further specifically used to decompress the subfile of the current image layer to obtain a decompressed subfile, and calculate the hash value of the decompressed subfile to obtain a second calculation summary; if it is determined that the second calculation summary of the subfile is consistent with the second initial summary, it is determined that the subfile passes the verification; if it is determined that the second calculation summary of the subfile is inconsistent with the second initial summary, it is determined that the subfile fails the verification.
21. The method according to claim 14, wherein: The image layer files in non-compressed package format are mounted, and the image layer files in compressed package format are checked and mounted for the second time, including: According to the mounting order of the image layer files, the image layer files in the non-compressed package format are mounted, and the image layer files in the compressed package format are mounted after a second verification.
22. The method according to claim 14, wherein: The mounting unit further includes a third mounting module, which is used to perform a second verification on the image layer files in the compressed package format in parallel; According to the mounting order of the image layer files, the image layer files in the non-compressed package format and the image layer files in the compressed package format that have passed the second verification are serially mounted in the image layer corresponding to the image layer files.
23. The method according to any one of claims 14 to 22, wherein: The image layer file includes a first initial digest and a third initial digest; the first initial digest is a hash value determined based on the image layer file being in a non-compressed package format, and the third initial digest is a hash value determined based on an actual storage format of the image layer file.
24. The method according to claim 23, wherein: The mounting unit also includes a determination module, which is used to determine the actual storage format of the image layer file according to the first initial digest and the third initial digest of the image layer file; wherein the actual storage format is a non-compressed package format or a compressed package format.
25. The method according to claim 24, wherein: The determination module is specifically used to determine that the actual storage format of the image layer file is a non-compressed package format if it is determined that the first initial digest of the image layer file is consistent with the third initial digest; if it is determined that the first initial digest of the image layer file is inconsistent with the third initial digest, determine that the actual storage format of the image layer file is a compressed package format.
26. The method according to any one of claims 14 to 25, wherein: The determination module is further specifically used to calculate the hash value of the image layer file to obtain a third calculation summary; if it is determined that the third calculation summary of the image layer file is consistent with the third initial summary, it is determined that the image layer file passes the first verification; if it is determined that the third calculation summary of the image layer file is inconsistent with the third initial summary, it is determined that the image layer file fails the first verification.
27. An electronic device comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 13.
28. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to cause the computer to execute the method according to any one of claims 1-13.
29. A computer program product, comprising a computer program, which, when executed by a processor, implements the steps of the method according to any one of claims 1 to 13.