WO2023087693A1 - Mirror image transmission method and apparatus, electronic device, and storage medium - Google Patents

Mirror image transmission method and apparatus, electronic device, and storage medium Download PDF

Info

Publication number
WO2023087693A1
WO2023087693A1 PCT/CN2022/099354 CN2022099354W WO2023087693A1 WO 2023087693 A1 WO2023087693 A1 WO 2023087693A1 CN 2022099354 W CN2022099354 W CN 2022099354W WO 2023087693 A1 WO2023087693 A1 WO 2023087693A1
Authority
WO
WIPO (PCT)
Prior art keywords
harbor
node
mirror
image
warehouse
Prior art date
Application number
PCT/CN2022/099354
Other languages
French (fr)
Chinese (zh)
Inventor
侯昌龙
陈相如
张宇峰
李忠
Original Assignee
中电信数智科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 中电信数智科技有限公司 filed Critical 中电信数智科技有限公司
Publication of WO2023087693A1 publication Critical patent/WO2023087693A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/61Installation
    • G06F8/63Image based installation; Cloning; Build to order
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1095Replication or mirroring of data, e.g. scheduling or transport for data synchronisation between network nodes

Definitions

  • the present application relates to the technical field of image storage, and in particular, relates to an image transmission method, device, electronic equipment, and storage medium.
  • the Harbor mirror warehouse management system In order to manage images in enterprises, the Harbor mirror warehouse management system is often deployed. However, as time goes by, when a new version of the Harbor mirror warehouse management system appears, the enterprise often uses the new version of the Harbor mirror warehouse management system to use Newly added functions, however, due to problems in the interface between different versions of the Harbor mirror warehouse management system, the mirror image of the old version of the Harbor mirror warehouse management system cannot use the self-generated function of the Harbor mirror warehouse management system to mirror the new version of Harbor Importing images into the warehouse management system can only rely on the staff to use container tools to import the images in the old version of the Harbor mirror warehouse management system into the new version of the Harbor mirror warehouse management system one by one, which is very inefficient and requires a lot of human resources .
  • the application provides a mirror image transmission method, device, electronic equipment and storage medium to solve the problem of the low efficiency of importing the mirror image in the old version of the Harbor mirror warehouse management system into the new version of the Harbor mirror warehouse management system in the prior art and the need to occupy A lot of human resource issues.
  • the present application provides a mirror image transmission method, including: obtaining the mirror image in the first Harbor node; downloading the mirror image to a preset directory; uploading each mirror image in the preset directory to the second Harbor A mirror repository whose mirror repository name in the node is the same as that of the mirror repository in the first Harbor node.
  • the image in the first Harbor node by downloading the image in the first Harbor node to a preset directory, and then uploading the image from the preset directory to the image warehouse name in the second Harbor node is the same as that of the image in the first Harbor node.
  • the mirror warehouse in the Harbor node has the same name as the mirror warehouse, so that the mirror image in the first Harbor node can be transferred to the second Harbor node, and there is no need to transfer the mirror image through ports of different versions of Harbor nodes. Therefore, even if the first Harbor node and the second Harbor node The versions of the two Harbor nodes are different, and the image in the first Harbor node can also be uploaded to the second Harbor node.
  • this solution can realize image transmission without relying on staff, which not only saves human resources, but also improves image transmission. efficiency.
  • the acquiring the image in the first Harbor node includes: acquiring the identity information of the first Harbor node; converting the identity information into a pre-configured Set the format and encode to obtain coded data; send the coded data to the first Harbor node, so that the first Harbor node performs identity verification based on the coded data; when the identity verification is passed, obtain the Mirroring in the first Harbor node.
  • the subsequent first Harbor node by converting the identity information of the first Harbor node into a preset format, it is convenient for the subsequent first Harbor node to perform identity verification, and encoding the identity information can ensure the security of the identity information, so that both The first Harbor node performs identity verification based on encoded data, which can also ensure the security of identity information.
  • the acquiring the image in the first Harbor node includes: traversing all the image warehouses in the first Harbor node, and obtaining the images under each image warehouse. All the artifact directories of each artifact directory; traverse all the images in each artifact directory to obtain the images in the first Harbor node.
  • the name of the image warehouse in the second Harbor node uploading each image in the preset directory is the same as that of the image in the first
  • the mirror warehouse with the same name as the mirror warehouse in the Harbor node includes: obtaining the identity information of the second Harbor node; converting the identity information into a preset format and encoding to obtain encoded data; sending the encoded data to The second Harbor node, so that the second Harbor node performs identity verification based on the encoded data; when the identity verification is passed, each image in the preset directory is uploaded to the image in the second Harbor node A mirror warehouse whose warehouse name is the same as that of the mirror warehouse in the first Harbor node.
  • the second Harbor node by converting the identity information of the second Harbor node into a preset format, it is convenient for the second Harbor node to perform identity verification, thereby ensuring that the image is imported into the correct Harbor node, and the identity information is encoded to ensure that Security of identity information.
  • the name of the image warehouse in the second Harbor node uploading each image in the preset directory is the same as that of the image in the first
  • the mirror warehouse with the same name as the mirror warehouse in the Harbor node includes: judging whether there is a mirror warehouse with the same name as the mirror warehouse in the first Harbor node in the second Harbor node; When the node does not have a mirror warehouse with the same name as the mirror warehouse in the first Harbor node, create a mirror warehouse in the second Harbor node with the name of the mirror warehouse in the first Harbor node The same mirror warehouse; uploading the mirror image to the mirror warehouse whose mirror warehouse name in the second Harbor node is the same as the mirror warehouse name of the mirror image in the first Harbor node.
  • the name of the image warehouse in the second Harbor node uploading each image in the preset directory is the same as that of the image in the first
  • the mirror warehouse with the same name as the mirror warehouse in the Harbor node includes: determining that there is a mirror warehouse with the same name as the mirror warehouse in the first Harbor node in the second Harbor node; uploading the mirror image to A mirror repository whose name in the second Harbor node is the same as that of the mirror repository in the first Harbor node.
  • the storage location of the image in the second Harbor node is the same as that in the first Harbor node.
  • the storage location is the same in , which is convenient for subsequent use of the image.
  • the present application provides an image transmission device, including an acquisition module, a download module, and an upload module, the acquisition module is used to acquire the image in the first Harbor node; the download module is used to download the image to a preset directory; The uploading module is used to upload each image in the preset directory to a mirror warehouse whose mirror warehouse name in the second Harbor node is the same as the mirror warehouse name of the mirror image in the first Harbor node.
  • the acquisition module is also used to acquire the identity information of the first Harbor node; convert the identity information into a preset format and encode it , to obtain coded data; send the coded data to the first Harbor node, so that the first Harbor node performs identity verification based on the coded data; when the identity verification is passed, obtain the mirror image.
  • the embodiment of the present application also provides an electronic device, including: a memory and a processor, the memory is connected to the processor; the memory is used to store programs; the processor is used to call The program stored in the memory is used to execute the method provided in the above embodiment of the first aspect and/or in combination with any possible implementation manner of the embodiment of the above first aspect.
  • the embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored.
  • the computer program When the computer program is run by a computer, it executes the above-mentioned embodiment of the first aspect and/or combines the above-mentioned first The method provided by any possible implementation manner of the aspect embodiment.
  • Fig. 1 is a schematic diagram of the principle of image transmission between a first Harbor node and a second Harbor node using an image transmission tool shown in an embodiment of the present application;
  • FIG. 2 is a schematic flow diagram of a mirror image transmission method shown in an embodiment of the present application
  • FIG. 3 is a schematic flow diagram of authenticating the identity information of a first Harbor node shown in an embodiment of the present application
  • FIG. 4 is a schematic flow diagram of obtaining a mirror image in a first Harbor node shown in an embodiment of the present application
  • FIG. 5 is a schematic flow diagram of uploading an image in a preset directory to a second Harbor node shown in an embodiment of the present application;
  • FIG. 6 is a structural block diagram of an image transmission device shown in an embodiment of the present application.
  • FIG. 7 is a schematic structural diagram of an electronic device shown in an embodiment of the present application.
  • docker In the prior art, to import the images in the old version of the Harbor node into the new version of the Harbor node, only docker (container) can be used to import the images in the old version of the Harbor node into the new version of the Harbor node one by one.
  • the process It is: first open port 80 of the old version of the Harbor node, enter one of the mirror warehouses, then copy a mirror pull (pull) address, and then use docker to use pull to pull the mirror image corresponding to the pull address from the mirror warehouse.
  • This application provides a tool for bypassing Harbor to import images through the tools of the api (interface).
  • Figure 1 the existing technology cannot directly import The image in the first Harbor node is imported into the second Harbor node, and the tool provided by this solution can export the image from the image warehouse in the first Harbor node, store it in the preset directory, and then import the image in the preset directory
  • the node deployed by the tool can share other Harbor nodes, and the Harbor node refers to the Harbor mirror warehouse management system deployed on the electronic device.
  • FIG. 2 is an image transmission method provided by an embodiment of the present application. The steps included in it will be described below in conjunction with FIG. 2 .
  • the identity information of the first Harbor node needs to be authenticated, wherein the process of authenticating the identity information of the first Harbor node may be to first acquire the identity of the first Harbor node information, and then convert the obtained identity information into a preset format and encode it to obtain encoded data, and then send the encoded data to the first Harbor node, so that the first Harbor node can perform identity verification based on the encoded data.
  • the process of authenticating the identity information of the first Harbor node may be to first acquire the identity of the first Harbor node information, and then convert the obtained identity information into a preset format and encode it to obtain encoded data, and then send the encoded data to the first Harbor node, so that the first Harbor node can perform identity verification based on the encoded data.
  • FIG. 3 is a schematic flowchart of authenticating the identity information of the first Harbor node shown in an embodiment of the present application.
  • the process of obtaining the identity information of the first Harbor node may be to find the identity information of the first Harbor node from a list with multiple Harbor node identity information stored in advance, wherein the list may be a yaml list, and the yaml The list can store the identity information of multiple Harbor nodes at the same time.
  • the yaml list storing the identity information of two Harbor nodes is shown in Table 1.
  • the identity information of two Harbor nodes named 120 and number 140 are stored, and the identity information of each Harbor node includes Harbor node name (name), Harbor node address (address), Username (username), password (password), for example, the Harbor node whose node name is 120, its node address is https://172.16.29.120, its username is admin, and its password is xxxxxxx.
  • the identity information of the first Harbor node may be a user name and a password.
  • the user name and password are converted into a preset format, and then encoded to obtain encoded data.
  • the preset format can be set according to actual needs.
  • the preset format can be [username]:[password].
  • the username and password can be numbers or passwords. It is a combination of numbers and letters, and the "username" and "password” in the above preset format are only data indicating that the preset format is in the corresponding position.
  • the specific encoding method for encoding the identity information converted into the preset format can also be set according to actual needs, for example, it can be base64 encoding, and the specific encoding method is not limited here.
  • the process of sending the coded data to the first Harbor node may be to put the coded data into the request header of the request to the first Harbor node, and after the first Harbor node receives the request, it can start from the request
  • the encoded data is obtained in the request header.
  • the coded data may be directly sent to the first Harbor node, and the specific manner of sending the coded data to the first Harbor node may be set according to actual requirements, and is not limited here.
  • the process of obtaining the mirror image in the first Harbor node may be to first traverse all mirror warehouses in the first Harbor node to obtain all artifact directories under each mirror warehouse, and then traverse all artifact directories under each artifact directory. All images are obtained from the images in the first Harbor node. By traversing all artifact directories in each mirror warehouse, all images in the mirror warehouse can be obtained, and then all the mirror images in the mirror warehouse can be completely imported into the second Harbor node.
  • obtaining the mirror image in the first Harbor node may be to obtain mirror image information representing the storage location of the mirror image in the first Harbor node and its own attributes from the first Harbor node, and the mirror image information may include the mirror image in the first Harbor node.
  • the storage address, image version information, and image content information in the node do not limit the specific content of the image information here, as long as the image corresponding to the image information can be downloaded from the first Harbor node according to the obtained image information.
  • the preset directory may be /tmp/images, and the image downloaded to this directory will be stored in the /tmp/image directory in the format of [image-id]/, for example, /tmp/images/sha256: 84a9c2a56336659b21f2c3c8fc671ce7a76042588491d186924732e9bb5b969f, here is just an example for easy understanding, and should not be used as a display of this application.
  • each image file in the preset directory includes image layer files and image information files of the image, wherein the image information file includes image layer, startup parameters, By default, data such as directories are hung.
  • both the image layer file and the image information file conform to the OCI (Open Container Initiative, open container standard) standard.
  • Two Harbor nodes perform identity authentication, wherein, the process of performing identity authentication on the second Harbor node can be: first obtain the identity information of the second Harbor node, and then convert the obtained identity information into a preset format and encode it to obtain encoded data , and then send the coded data to the second Harbor node, so that the second Harbor node performs identity verification based on the coded data, and when the identity verification passes, upload each image in the preset directory to the mirror image in the second Harbor node A mirror warehouse whose warehouse name is the same as that of the mirror warehouse in the first Harbor node.
  • the identity authentication process for the second Harbor node is the same as the identity authentication process for the first Harbor node described above, which is a brief description and will not be repeated here.
  • the process of uploading each mirror image in the preset directory to the mirror warehouse whose mirror warehouse name in the second Harbor node is the same as the mirror warehouse name of the mirror image in the first Harbor node may be as follows: First judge whether there is a mirror warehouse with the same name as the mirror warehouse in the first Harbor node in the second Harbor node, and there is no mirror warehouse in the second Harbor node with the same name as the mirror warehouse in the first Harbor node , create a mirror warehouse in the second Harbor node with the same name as the mirror warehouse in the first Harbor node, and then upload the mirror to the mirror warehouse in the second Harbor node.
  • FIG. 5 is a schematic flowchart of uploading the image in the preset directory to the second Harbor node shown in the embodiment of the present application.
  • the image in the preset directory can be pushed through docker in the second Harbor node to the second Harbor node.
  • the images in the preset directory can be uploaded to the second Harbor node in sequence according to the time sequence in which the images are downloaded from the first Harbor node; or, it can be in After the image is downloaded from the first Harbor node, the image is immediately uploaded to the second Harbor node; or, multiple images can be uploaded to the second Harbor node at the same time.
  • the preset directory is deleted to prevent image leakage.
  • the second Harbor node After uploading all the images in the preset directory to the second Harbor node, determine whether to import all the images in the first Harbor node to the second Harbor node, if there are still unimported images in the first Harbor node The image in the second Harbor node obtains the image in the first Harbor node again, wherein the process of obtaining the image in the first Harbor node has been clearly described above, and will not be repeated here.
  • the first Harbor node and the second Harbor node are Harbor nodes of different versions, for example, the first Harbor node can be an old version Harbor node, and the second Harbor node can be a new version Harbor node; or, it can be The first Harbor node is a new version of Harbor node, and the second Harbor node is an old version of Harbor node.
  • FIG. 6 shows an image transmission device 100 according to an embodiment of the present application.
  • the image transmission device includes an acquisition module 110 , a download module 120 , and an upload module 130 .
  • the obtaining module 110 is configured to obtain the image in the first Harbor node.
  • the download module 120 is configured to download the image to a preset directory.
  • the uploading module 130 is configured to upload each image in the preset directory to a mirror warehouse whose mirror warehouse name in the second Harbor node is the same as the mirror warehouse name of the mirror image in the first Harbor node.
  • the acquiring module 110 is also used to acquire the identity information of the first Harbor node; convert the identity information into a preset format and encode to obtain encoded data; send the encoded data to the first Harbor node, so that the first Harbor node performs identity verification based on the coded data; when the identity verification passes, acquire the image in the first Harbor node.
  • the acquisition module 110 is also used to traverse all mirror warehouses in the first Harbor node to obtain all artifact directories under each mirror warehouse; traverse all mirror images under each artifact directory to obtain the artifact directories in the first Harbor node. mirror image.
  • the upload module 130 is specifically used to obtain the identity information of the second Harbor node; convert the identity information into a preset format and encode it to obtain encoded data; send the encoded data to the second Harbor node, To make the second Harbor node perform identity verification based on the encoded data; when the identity verification is passed, each image in the preset directory is uploaded to the name of the image warehouse in the second Harbor node and the image is in the A mirror warehouse with the same name as the mirror warehouse in the first Harbor node.
  • the upload module 130 is specifically used to judge whether there is a mirror warehouse with the same name as the mirror warehouse in the first Harbor node in the second Harbor node; When the mirror warehouse with the same name as the mirror warehouse in the first Harbor node, create a mirror warehouse with the same name as the mirror warehouse in the first Harbor node in the second Harbor node; The mirror image is uploaded to the mirror warehouse whose mirror warehouse name in the second Harbor node is the same as the mirror warehouse name of the mirror image in the first Harbor node.
  • the upload module 130 is specifically used to determine that the second Harbor node has a mirror warehouse with the same name as the mirror warehouse where the mirror image is located in the first Harbor node; upload the mirror image to the second Harbor node A mirror warehouse whose name is the same as that of the mirror image in the first Harbor node.
  • the mirror image transmission device 100 provided by the embodiment of the present application has the same realization principle and technical effect as the embodiment of the mirror image transfer method described above.
  • the parts not mentioned in the device embodiment can be implemented with reference to the mirror image transfer method described above. corresponding content in the example.
  • FIG. 7 is an electronic device 200 provided in an embodiment of the present application.
  • the electronic device 200 includes: a transceiver 210 , a memory 220 , a communication bus 230 , and a processor 240 .
  • the components of the transceiver 210, the memory 220, and the processor 240 are directly or indirectly electrically connected to each other to realize data transmission or interaction. For example, these components can be electrically connected to each other through one or more communication buses 230 or signal lines.
  • the transceiver 210 is used for sending and receiving data.
  • the memory 220 is used to store computer programs, for example, the software function modules shown in FIG. 6 are stored, that is, the image transmission device 100 .
  • the image transmission apparatus 100 includes at least one software function module that can be stored in the memory 220 in the form of software or firmware (firmware) or solidified in the operating system (operating system, OS) of the electronic device 200 .
  • the processor 240 is configured to execute an executable module stored in the memory 220 , such as a software function module or a computer program included in the image transmission apparatus 100 . For example, obtain the mirror image in the first Harbor node; download the mirror image to a preset directory; upload each mirror image in the preset directory to the mirror warehouse name in the second Harbor node and the mirror image in the first Harbor node A mirror warehouse with the same name as the mirror warehouse in a Harbor node.
  • an executable module stored in the memory 220 , such as a software function module or a computer program included in the image transmission apparatus 100 . For example, obtain the mirror image in the first Harbor node; download the mirror image to a preset directory; upload each mirror image in the preset directory to the mirror warehouse name in the second Harbor node and the mirror image in the first Harbor node A mirror warehouse with the same name as the mirror warehouse in a Harbor node.
  • memory 220 can be, but not limited to, random access memory (Random Access Memory, RAM), read-only memory (Read Only Memory, ROM), programmable read-only memory (Programmable Read-Only Memory, PROM), can Erasable Programmable Read-Only Memory (EPROM), Electric Erasable Programmable Read-Only Memory (EEPROM), etc.
  • RAM Random Access Memory
  • ROM read-only memory
  • PROM programmable read-only memory
  • EPROM Erasable Programmable Read-Only Memory
  • EEPROM Electric Erasable Programmable Read-Only Memory
  • the processor 240 may be an integrated circuit chip with signal processing capability.
  • the above-mentioned processor can be a general-purpose processor, including a central processing unit (Central Processing Unit, CPU), a network processor (Network Processor, NP), etc.; it can also be a digital signal processor (Digital Signal Processor, DSP), a dedicated integrated Circuit (Application Specific Integrated Circuit, ASIC), Field Programmable Gate Array (Field Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
  • Various methods, steps, and logic block diagrams disclosed in the embodiments of the present application may be implemented or executed.
  • the general purpose processor may be a microprocessor or the processor 240 may be any conventional processor or the like.
  • the above-mentioned electronic device 200 includes but not limited to a personal computer, a server, and the like.
  • the embodiment of the present application also provides a non-volatile computer-readable storage medium (hereinafter referred to as storage medium), on which a computer program is stored, and when the computer program is run by a computer such as the above-mentioned electronic device 200, the The image transfer method shown above.
  • storage medium a non-volatile computer-readable storage medium (hereinafter referred to as storage medium), on which a computer program is stored, and when the computer program is run by a computer such as the above-mentioned electronic device 200, the The image transfer method shown above.

Abstract

The present application provides a mirror image transmission method and apparatus, an electronic device and a storage medium, which belong to the technical field of mirror image warehouses. The mirror image transmission method comprises: acquiring a mirror image in a first Harbor node; downloading the mirror image to a preset directory; and uploading each mirror image in the preset directory to a mirror image warehouse in a second Harbor node the mirror image warehouse name of which is the same as the mirror image warehouse name of the mirror image in the first Harbor node. In the present solution, mirror images do not need to be transmitted by means of ports of Harbor nodes of different versions, and thus even if the versions of the first Harbor node and the second Harbor node are different, the mirror image in the first Harbor node may be uploaded to the second Harbor node. Moreover, in the present solution, mirror image transmission may be achieved without relying on members of staff, which not only saves human resources, but also improves the transmission efficiency of mirror images.

Description

镜像传输方法、装置、电子设备及存储介质Image transmission method, device, electronic equipment and storage medium 技术领域technical field
本申请涉及镜像仓库的技术领域,具体而言,涉及一种镜像传输方法、装置、电子设备及存储介质。The present application relates to the technical field of image storage, and in particular, relates to an image transmission method, device, electronic equipment, and storage medium.
背景技术Background technique
在企业中为了管理镜像,往往会部署Harbor镜像仓库管理系统,但是随着时间推移,当Harbor镜像仓库管理系统出现了新的版本后,企业往往会使用新版本的Harbor镜像仓库管理系统,以使用新增加的功能,但是,由于不同版本的Harbor镜像仓库管理系统之间的接口存在问题,会导致旧版本的Harbor镜像仓库管理系统的镜像无法利用Harbor镜像仓库管理系统自生功能往新版本的Harbor镜像仓库管理系统中导入镜像,只能依靠工作人员使用容器工具将旧版本的Harbor镜像仓库管理系统中的镜像一个一个导入新版本的Harbor镜像仓库管理系统中,效率很低,并且需要占用大量人力资源。In order to manage images in enterprises, the Harbor mirror warehouse management system is often deployed. However, as time goes by, when a new version of the Harbor mirror warehouse management system appears, the enterprise often uses the new version of the Harbor mirror warehouse management system to use Newly added functions, however, due to problems in the interface between different versions of the Harbor mirror warehouse management system, the mirror image of the old version of the Harbor mirror warehouse management system cannot use the self-generated function of the Harbor mirror warehouse management system to mirror the new version of Harbor Importing images into the warehouse management system can only rely on the staff to use container tools to import the images in the old version of the Harbor mirror warehouse management system into the new version of the Harbor mirror warehouse management system one by one, which is very inefficient and requires a lot of human resources .
发明内容Contents of the invention
本申请提供一种镜像传输方法、装置、电子设备及存储介质,以解决现有技术将旧版本的Harbor镜像仓库管理系统中的镜像导入新版本的Harbor镜像仓库管理系统中效率低,且需要占用大量人力资源的问题。The application provides a mirror image transmission method, device, electronic equipment and storage medium to solve the problem of the low efficiency of importing the mirror image in the old version of the Harbor mirror warehouse management system into the new version of the Harbor mirror warehouse management system in the prior art and the need to occupy A lot of human resource issues.
第一方面,本申请提供一种镜像传输方法,包括:获取第一Harbor节点中的镜像;将所述镜像下载至预设目录;将所述预设目录中的每一个镜像上传至第二Harbor节点中的镜像仓库名称与该镜像在所述第一Harbor节点中的镜像仓库名称相同的镜像仓库。In the first aspect, the present application provides a mirror image transmission method, including: obtaining the mirror image in the first Harbor node; downloading the mirror image to a preset directory; uploading each mirror image in the preset directory to the second Harbor A mirror repository whose mirror repository name in the node is the same as that of the mirror repository in the first Harbor node.
本申请实施例中,通过将第一Harbor节点中的镜像下载至预设目录,然后从该预设目录中将镜像上传至第二Harbor节点中的镜像仓库名称与所述镜像在所述第一Harbor节点中的镜像仓库名称相同的镜像仓库,从而实现将第一Harbor节点中的镜像传输至第二Harbor节点中,无需通过不同版本Harbor节点的端口传输镜像,因此,即使第一Harbor节点和第二Harbor节点的版本不同,也能实现将第一Harbor节点中的镜像上传至第二Harbor节点,并且,本方案无需依靠工作人员即可实现镜像传输,不仅节省了人力资源,还提高了镜像传输效率。In this embodiment of the present application, by downloading the image in the first Harbor node to a preset directory, and then uploading the image from the preset directory to the image warehouse name in the second Harbor node is the same as that of the image in the first Harbor node. The mirror warehouse in the Harbor node has the same name as the mirror warehouse, so that the mirror image in the first Harbor node can be transferred to the second Harbor node, and there is no need to transfer the mirror image through ports of different versions of Harbor nodes. Therefore, even if the first Harbor node and the second Harbor node The versions of the two Harbor nodes are different, and the image in the first Harbor node can also be uploaded to the second Harbor node. Moreover, this solution can realize image transmission without relying on staff, which not only saves human resources, but also improves image transmission. efficiency.
结合上述第一方面提供的技术方案,在一些可能的实施方式中,所述获取第一Harbor节点中的镜像,包括:获取所述第一Harbor节点的身份信息;将所述身份信息转换为预设格式 并进行编码,得到编码数据;将所述编码数据发送给所述第一Harbor节点,以使所述第一Harbor节点基于所述编码数据进行身份验证;在身份验证通过时,获取所述第一Harbor节点中的镜像。In combination with the technical solution provided in the first aspect above, in some possible implementation manners, the acquiring the image in the first Harbor node includes: acquiring the identity information of the first Harbor node; converting the identity information into a pre-configured Set the format and encode to obtain coded data; send the coded data to the first Harbor node, so that the first Harbor node performs identity verification based on the coded data; when the identity verification is passed, obtain the Mirroring in the first Harbor node.
本申请实施例中,通过将第一Harbor节点的身份信息转换为预设格式,便于后续第一Harbor节点进行身份验证,而对身份信息进行编码,可以保证身份信息的安全,从而使得既能使第一Harbor节点基于编码数据进行身份验证,也能保证身份信息的安全性。In the embodiment of this application, by converting the identity information of the first Harbor node into a preset format, it is convenient for the subsequent first Harbor node to perform identity verification, and encoding the identity information can ensure the security of the identity information, so that both The first Harbor node performs identity verification based on encoded data, which can also ensure the security of identity information.
结合上述第一方面提供的技术方案,在一些可能的实施方式中,所述获取第一Harbor节点中的镜像,包括:遍历所述第一Harbor节点中的所有镜像仓库,得到每一个镜像仓库下的所有artifact目录;遍历每一个artifact目录下的所有镜像,得到所述第一Harbor节点中的镜像。In combination with the technical solution provided in the first aspect above, in some possible implementation manners, the acquiring the image in the first Harbor node includes: traversing all the image warehouses in the first Harbor node, and obtaining the images under each image warehouse. All the artifact directories of each artifact directory; traverse all the images in each artifact directory to obtain the images in the first Harbor node.
本申请实施例中,通过遍历第一Harbor节点中的所有镜像仓库,以及遍历每一个镜像仓库下的所有artifact目录,可以保证最终得到第一Harbor节点中的所有镜像信息,使得最终能实现将第一Harbor节点中的所有镜像导入第二Harbor节点中。In the embodiment of the present application, by traversing all mirror warehouses in the first Harbor node, and traversing all artifact directories under each mirror warehouse, it can be guaranteed that all mirror information in the first Harbor node will be finally obtained, so that the first Harbor node can finally be realized. All images in one Harbor node are imported into the second Harbor node.
结合上述第一方面提供的技术方案,在一些可能的实施方式中,所述将所述预设目录中的每一个镜像上传至第二Harbor节点中的镜像仓库名称与该镜像在所述第一Harbor节点中的镜像仓库名称相同的镜像仓库,包括:获取所述第二Harbor节点的身份信息;将所述身份信息转换为预设格式并进行编码,得到编码数据;将所述编码数据发送给所述第二Harbor节点,以使所述第二Harbor节点基于所述编码数据进行身份验证;在身份验证通过时,将所述预设目录中的每一个镜像上传至第二Harbor节点中的镜像仓库名称与该镜像在所述第一Harbor节点中的镜像仓库名称相同的镜像仓库。In combination with the technical solution provided in the first aspect above, in some possible implementation manners, the name of the image warehouse in the second Harbor node uploading each image in the preset directory is the same as that of the image in the first The mirror warehouse with the same name as the mirror warehouse in the Harbor node includes: obtaining the identity information of the second Harbor node; converting the identity information into a preset format and encoding to obtain encoded data; sending the encoded data to The second Harbor node, so that the second Harbor node performs identity verification based on the encoded data; when the identity verification is passed, each image in the preset directory is uploaded to the image in the second Harbor node A mirror warehouse whose warehouse name is the same as that of the mirror warehouse in the first Harbor node.
本申请实施例中,通过将第二Harbor节点的身份信息转换为预设格式,便于后续第二Harbor节点进行身份验证,从而保证将镜像导入正确的Harbor节点,而对身份信息进行编码,可以保证身份信息的安全。In the embodiment of this application, by converting the identity information of the second Harbor node into a preset format, it is convenient for the second Harbor node to perform identity verification, thereby ensuring that the image is imported into the correct Harbor node, and the identity information is encoded to ensure that Security of identity information.
结合上述第一方面提供的技术方案,在一些可能的实施方式中,所述将所述预设目录中的每一个镜像上传至第二Harbor节点中的镜像仓库名称与该镜像在所述第一Harbor节点中的镜像仓库名称相同的镜像仓库,包括:判断所述第二Harbor节点是否存在与所述镜像在所述第一Harbor节点中所在镜像仓库名称相同的镜像仓库;在所述第二Harbor节点不存在与所述镜像在所述第一Harbor节点中所在镜像仓库名称相同的镜像仓库时,在所述第二Harbor节点中创建与所述镜像在所述第一Harbor节点中所在镜像仓库名称相同的镜像仓库;将所述镜像上传至所述第二Harbor节点中的镜像仓库名称与所述镜像在所述第一Harbor节点中的镜像仓库 名称相同的镜像仓库。In combination with the technical solution provided in the first aspect above, in some possible implementation manners, the name of the image warehouse in the second Harbor node uploading each image in the preset directory is the same as that of the image in the first The mirror warehouse with the same name as the mirror warehouse in the Harbor node includes: judging whether there is a mirror warehouse with the same name as the mirror warehouse in the first Harbor node in the second Harbor node; When the node does not have a mirror warehouse with the same name as the mirror warehouse in the first Harbor node, create a mirror warehouse in the second Harbor node with the name of the mirror warehouse in the first Harbor node The same mirror warehouse; uploading the mirror image to the mirror warehouse whose mirror warehouse name in the second Harbor node is the same as the mirror warehouse name of the mirror image in the first Harbor node.
本申请实施例中,在将镜像导入第二Harbor节点之前,先判断第二Harbor节点是否存在与待导入镜像在第一Harbor节点中所在镜像仓库名称相同的镜像仓库,在不存在时,先建立与待导入镜像在第一Harbor节点中所在镜像仓库名称相同的镜像仓库,然后将待导入镜像导入新建立的镜像仓库,从而保证该镜像在第二Harbor节点中的存储位置与在第一Harbor节点中的存储位置相同。In the embodiment of the present application, before importing the mirror image into the second Harbor node, first judge whether there is a mirror warehouse with the same name as the mirror warehouse in the first Harbor node where the mirror image to be imported exists in the second Harbor node, and if it does not exist, create it first The mirror warehouse with the same name as the mirror warehouse where the image to be imported is located in the first Harbor node, and then import the mirror to be imported into the newly created mirror warehouse, so as to ensure that the storage location of the mirror in the second Harbor node is the same as that in the first Harbor node The same storage location in .
结合上述第一方面提供的技术方案,在一些可能的实施方式中,所述将所述预设目录中的每一个镜像上传至第二Harbor节点中的镜像仓库名称与该镜像在所述第一Harbor节点中的镜像仓库名称相同的镜像仓库,包括:确定所述第二Harbor节点存在与所述镜像在所述第一Harbor节点中所在镜像仓库的名称相同的镜像仓库;将所述镜像上传至所述第二Harbor节点中的镜像仓库名称与所述镜像在所述第一Harbor节点中的镜像仓库名称相同的镜像仓库。In combination with the technical solution provided in the first aspect above, in some possible implementation manners, the name of the image warehouse in the second Harbor node uploading each image in the preset directory is the same as that of the image in the first The mirror warehouse with the same name as the mirror warehouse in the Harbor node includes: determining that there is a mirror warehouse with the same name as the mirror warehouse in the first Harbor node in the second Harbor node; uploading the mirror image to A mirror repository whose name in the second Harbor node is the same as that of the mirror repository in the first Harbor node.
本申请实施例中,通过将待导入镜像导入与待导入镜像在第一Harbor节点中所在镜像仓库名称相同的镜像仓库,从而保证该镜像在第二Harbor节点中的存储位置与在第一Harbor节点中的存储位置相同,便于后续使用该镜像。In the embodiment of the present application, by importing the image to be imported into the image repository with the same name as the image repository in the first Harbor node, it is ensured that the storage location of the image in the second Harbor node is the same as that in the first Harbor node. The storage location is the same in , which is convenient for subsequent use of the image.
第二方面,本申请提供一种镜像传输装置,包括获取模块、下载模块、上传模块,获取模块用于获取第一Harbor节点中的镜像;下载模块用于将所述镜像下载至预设目录;上传模块用于将所述预设目录中的每一个镜像上传至第二Harbor节点中的镜像仓库名称与该镜像在所述第一Harbor节点中的镜像仓库名称相同的镜像仓库。In a second aspect, the present application provides an image transmission device, including an acquisition module, a download module, and an upload module, the acquisition module is used to acquire the image in the first Harbor node; the download module is used to download the image to a preset directory; The uploading module is used to upload each image in the preset directory to a mirror warehouse whose mirror warehouse name in the second Harbor node is the same as the mirror warehouse name of the mirror image in the first Harbor node.
结合上述第二方面提供的技术方案,在一些可能的实施方式中,所述获取模块,还用于获取所述第一Harbor节点的身份信息;将所述身份信息转换为预设格式并进行编码,得到编码数据;将所述编码数据发送给所述第一Harbor节点,以使所述第一Harbor节点基于所述编码数据进行身份验证;在身份验证通过时,获取所述第一Harbor节点中的镜像。In combination with the technical solution provided by the second aspect above, in some possible implementation manners, the acquisition module is also used to acquire the identity information of the first Harbor node; convert the identity information into a preset format and encode it , to obtain coded data; send the coded data to the first Harbor node, so that the first Harbor node performs identity verification based on the coded data; when the identity verification is passed, obtain the mirror image.
第三方面,本申请实施例还提供了一种电子设备,包括:存储器和处理器,所述存储器和所述处理器连接;所述存储器,用于存储程序;所述处理器,用于调用存储于所述存储器中的程序,以执行如上述第一方面实施例和/或结合上述第一方面实施例的任一种可能的实施方式提供的方法。In the third aspect, the embodiment of the present application also provides an electronic device, including: a memory and a processor, the memory is connected to the processor; the memory is used to store programs; the processor is used to call The program stored in the memory is used to execute the method provided in the above embodiment of the first aspect and/or in combination with any possible implementation manner of the embodiment of the above first aspect.
第四方面,本申请实施例还提供了一种计算机可读存储介质,其上存储有计算机程序,所述计算机程序被计算机运行时,执行如上述第一方面实施例和/或结合上述第一方面实施例的任一种可能的实施方式提供的方法。In the fourth aspect, the embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is run by a computer, it executes the above-mentioned embodiment of the first aspect and/or combines the above-mentioned first The method provided by any possible implementation manner of the aspect embodiment.
附图说明Description of drawings
为了更清楚地说明本申请实施例的技术方案,下面将对实施例中所需要使用的附图作简单地介绍,应当理解,以下附图仅示出了本申请的某些实施例,因此不应被看作是对范围的限定,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他相关的附图。In order to more clearly illustrate the technical solutions of the embodiments of the present application, the accompanying drawings that are required in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present application, and thus It should be regarded as a limitation on the scope, and those skilled in the art can also obtain other related drawings based on these drawings without creative work.
图1为本申请实施例示出的一种利用镜像传输工具在第一Harbor节点与第二Harbor节点之间进行镜像传输的原理示意图;Fig. 1 is a schematic diagram of the principle of image transmission between a first Harbor node and a second Harbor node using an image transmission tool shown in an embodiment of the present application;
图2为本申请实施例示出的一种镜像传输方法的流程示意图;FIG. 2 is a schematic flow diagram of a mirror image transmission method shown in an embodiment of the present application;
图3为本申请实施例示出的一种认证第一Harbor节点的身份信息的流程示意图;FIG. 3 is a schematic flow diagram of authenticating the identity information of a first Harbor node shown in an embodiment of the present application;
图4为本申请实施例示出的一种获取第一Harbor节点中的镜像的流程示意图;FIG. 4 is a schematic flow diagram of obtaining a mirror image in a first Harbor node shown in an embodiment of the present application;
图5为本申请实施例示出的一种将预设目录中的镜像上传至第二Harbor节点的流程示意图;FIG. 5 is a schematic flow diagram of uploading an image in a preset directory to a second Harbor node shown in an embodiment of the present application;
图6为本申请实施例示出的一种镜像传输装置的结构框图;FIG. 6 is a structural block diagram of an image transmission device shown in an embodiment of the present application;
图7为本申请实施例示出的一种电子设备的结构示意图。FIG. 7 is a schematic structural diagram of an electronic device shown in an embodiment of the present application.
具体实施方式Detailed ways
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行描述。The technical solutions in the embodiments of the present application will be described below with reference to the drawings in the embodiments of the present application.
应注意到:相似的标号和字母在下面的附图中表示类似项,因此,一旦某一项在一个附图中被定义,则在随后的附图中不需要对其进行进一步定义和解释。同时,在本申请的描述中诸如“第一”、“第二”等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。It should be noted that like numerals and letters denote similar items in the following figures, therefore, once an item is defined in one figure, it does not require further definition and explanation in subsequent figures. Meanwhile, in the description of the present application, relative terms such as "first", "second", etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply that these entities or operations, any such actual relationship or order exists. Furthermore, the term "comprises", "comprises" or any other variation thereof is intended to cover a non-exclusive inclusion such that a process, method, article, or apparatus comprising a set of elements includes not only those elements, but also includes elements not expressly listed. other elements of or also include elements inherent in such a process, method, article, or device. Without further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article or apparatus comprising said element.
再者,本申请中术语“和/或”,仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。Furthermore, the term "and/or" in this application is only an association relationship describing associated objects, indicating that there may be three relationships, for example, A and/or B may indicate: A exists alone, and A and B exist simultaneously. B, there are three situations of B alone.
下面将结合附图对本申请的技术方案进行清楚、完整地描述。The technical solutions of the present application will be clearly and completely described below in conjunction with the accompanying drawings.
现有技术中,将旧版本的Harbor节点中的镜像导入新版本的Harbor节点中,只能使用docker(容器)将旧版本的Harbor节点中的镜像一个一个导入新版本的Harbor节点中,其过程为:首先打开旧版本的Harbor节点的80端口,进入其中的一个镜像仓库,然后复制一个镜像的pull(拉取)地址,然后利用docker使用pull从镜像仓库中拉取该pull地址对应的镜像,将该镜像下载至本地,接着利用docker使用push将本地的镜像上传到新版本的Harbor节点中的镜像仓库,完成一个镜像的导入,然后重复上述步骤,直至将旧版本Harbor节点中的所有镜像全部导入新版本Harbor节点中。该方法只能依靠工作人员使用docker将旧版本的Harbor镜像仓库管理系统中的镜像一个一个导入新版本的Harbor镜像仓库管理系统中,效率很低,并且需要占用大量人力资源。因此,本方案提供一种镜像传输方法解决现有技术存在的效率底下,且需要占用大量人力资源的问题。In the prior art, to import the images in the old version of the Harbor node into the new version of the Harbor node, only docker (container) can be used to import the images in the old version of the Harbor node into the new version of the Harbor node one by one. The process It is: first open port 80 of the old version of the Harbor node, enter one of the mirror warehouses, then copy a mirror pull (pull) address, and then use docker to use pull to pull the mirror image corresponding to the pull address from the mirror warehouse. Download the image to the local, then use docker to upload the local image to the mirror warehouse in the new version of the Harbor node, complete the import of a mirror, and then repeat the above steps until all the images in the old version of the Harbor node are all Import the new version of Harbor node. This method can only rely on the staff to use docker to import the images in the old version of the Harbor mirror warehouse management system into the new version of the Harbor mirror warehouse management system one by one, which is very inefficient and requires a lot of human resources. Therefore, this solution provides a mirror image transmission method to solve the problems of low efficiency and need to occupy a large amount of human resources existing in the prior art.
本申请提供了一种绕开Harbor之间通过api(接口)自带工具导入镜像的工具,为了便于理解,请参阅图1,如图1所示,现有技术无法通过api自带工具直接将第一Harbor节点中的镜像导入第二Harbor节点中,而本方案提供的工具可以从第一Harbor节点中的镜像仓库中导出镜像,并存放至预设目录,然后将预设目录中的镜像导入第二Harbor节点中的镜像仓库中,其中,该工具部署的节点可以共享其他Harbor节点,Harbor节点是指部署在电子设备上的Harbor镜像仓库管理系统。This application provides a tool for bypassing Harbor to import images through the tools of the api (interface). For ease of understanding, please refer to Figure 1. As shown in Figure 1, the existing technology cannot directly import The image in the first Harbor node is imported into the second Harbor node, and the tool provided by this solution can export the image from the image warehouse in the first Harbor node, store it in the preset directory, and then import the image in the preset directory In the mirror warehouse in the second Harbor node, the node deployed by the tool can share other Harbor nodes, and the Harbor node refers to the Harbor mirror warehouse management system deployed on the electronic device.
请参阅图2,图2为本申请实施例提供的一种镜像传输方法,下面将结合图2对其所包含的步骤进行说明。Please refer to FIG. 2 . FIG. 2 is an image transmission method provided by an embodiment of the present application. The steps included in it will be described below in conjunction with FIG. 2 .
S100:获取第一Harbor节点中的镜像。S100: Obtain the image in the first Harbor node.
从第一Harbor节点中获取镜像,以便于将获取到的镜像上传至第二Harbor节点,例如,通过本申请提供的工具从第一Harbor节点中获取镜像。Obtain the image from the first Harbor node, so as to upload the obtained image to the second Harbor node, for example, obtain the image from the first Harbor node through the tools provided in this application.
一种实施方式下,获取第一Harbor节点中的镜像之前,还需要认证第一Harbor节点的身份信息,其中,认证第一Harbor节点的身份信息的过程可以是,首先获取第一Harbor节点的身份信息,然后将获取的身份信息转换为预设格式并进行编码,得到编码数据,再将该编码数据发送给第一Harbor节点,以使第一Harbor节点基于该编码数据进行身份验证,在身份验证通过时,获取第一Harbor节点中的镜像。为了便于理解上述的认证第一Harbor节点的身份信息的过程,请参阅图3,图3为本申请实施例示出的一种认证第一Harbor节点的身份信息的流程示意图。In one embodiment, before obtaining the mirror image in the first Harbor node, the identity information of the first Harbor node needs to be authenticated, wherein the process of authenticating the identity information of the first Harbor node may be to first acquire the identity of the first Harbor node information, and then convert the obtained identity information into a preset format and encode it to obtain encoded data, and then send the encoded data to the first Harbor node, so that the first Harbor node can perform identity verification based on the encoded data. When passing, obtain the image in the first Harbor node. In order to facilitate understanding of the above process of authenticating the identity information of the first Harbor node, please refer to FIG. 3 . FIG. 3 is a schematic flowchart of authenticating the identity information of the first Harbor node shown in an embodiment of the present application.
可选的,获取第一Harbor节点的身份信息的过程可以是,从预先存储有多个Harbor节点身份信息的列表中找到第一Harbor节点的身份信息,其中,该列表可以是yaml列表,通过yaml列表可以同时保存多个Harbor节点的身份信息,一种实施方式下,存储有2个Harbor节点身份信息的yaml列表如表1所示。Optionally, the process of obtaining the identity information of the first Harbor node may be to find the identity information of the first Harbor node from a list with multiple Harbor node identity information stored in advance, wherein the list may be a yaml list, and the yaml The list can store the identity information of multiple Harbor nodes at the same time. In one embodiment, the yaml list storing the identity information of two Harbor nodes is shown in Table 1.
表1Table 1
namename address address usernameusername passwordpassword
120120 https://172.16.29.120https://172.16.29.120 adminadmin xxxxxxxxxxxxxxx
140140 https://172.16.29.140https://172.16.29.140 testtest xxxxxxxxxxxxxxx
表1所示的yaml列表中,存储有名称为120和编号为140的两个Harbor节点的身份信息,且每个Harbor节点的身份信息包括Harbor节点名称(name)、Harbor节点地址(address)、用户名(username)、密码(password),例如,节点名称为120的Harbor节点,其节点地址为https://172.16.29.120,其用户名为admin,其密码为xxxxxxx。In the yaml list shown in Table 1, the identity information of two Harbor nodes named 120 and number 140 are stored, and the identity information of each Harbor node includes Harbor node name (name), Harbor node address (address), Username (username), password (password), for example, the Harbor node whose node name is 120, its node address is https://172.16.29.120, its username is admin, and its password is xxxxxxx.
其中,第一Harbor节点的身份信息可以是用户名和密码,在获取到用户名和密码后,将用户名和密码转换为预设格式,然后进行编码,得到编码数据。其中,预设格式可以根据实际需求设置,例如,预设格式可以是[用户名]:[密码],此处不对预设格式的实际要求做限制,其中,用户名和密码可以是数字,也可以是数字和字母的组合,上述预设格式中的“用户名”、“密码”仅为表示该预设格式在对应位置的数据。对转换为预设格式后的身份信息进行编码的具体编码方式也可以根据实际需求设置,例如,可以是base64编码,此处不对具体的编码方式做限制。Wherein, the identity information of the first Harbor node may be a user name and a password. After obtaining the user name and password, the user name and password are converted into a preset format, and then encoded to obtain encoded data. Among them, the preset format can be set according to actual needs. For example, the preset format can be [username]:[password]. There is no limit to the actual requirements of the preset format here. The username and password can be numbers or passwords. It is a combination of numbers and letters, and the "username" and "password" in the above preset format are only data indicating that the preset format is in the corresponding position. The specific encoding method for encoding the identity information converted into the preset format can also be set according to actual needs, for example, it can be base64 encoding, and the specific encoding method is not limited here.
可选的,将编码数据发送给第一Harbor节点的过程可以是,将编码数据放入对第一Harbor节点的请求的请求头中,在第一Harbor节点接收到请求后,即可从该请求的请求头中获得该编码数据。或者,也可以是直接将编码数据发送给第一Harbor节点,将编码数据发送给第一Harbor节点的具体方式可以根据实际需求设置,此处不做限制。Optionally, the process of sending the coded data to the first Harbor node may be to put the coded data into the request header of the request to the first Harbor node, and after the first Harbor node receives the request, it can start from the request The encoded data is obtained in the request header. Alternatively, the coded data may be directly sent to the first Harbor node, and the specific manner of sending the coded data to the first Harbor node may be set according to actual requirements, and is not limited here.
一种实施方式下,获取第一Harbor节点中的镜像的过程可以是,首先遍历第一Harbor节点中的所有镜像仓库,得到每一个镜像仓库下的所有artifact目录,然后遍历每一个artifact目录下的所有镜像,得到第一Harbor节点中的镜像。通过遍历每一个镜像仓库中的所有artifact目录,可以得到镜像仓库中的所有镜像,进而能实现将镜像仓库中的所有镜像完整导入到第二Harbor节点中。In one embodiment, the process of obtaining the mirror image in the first Harbor node may be to first traverse all mirror warehouses in the first Harbor node to obtain all artifact directories under each mirror warehouse, and then traverse all artifact directories under each artifact directory. All images are obtained from the images in the first Harbor node. By traversing all artifact directories in each mirror warehouse, all images in the mirror warehouse can be obtained, and then all the mirror images in the mirror warehouse can be completely imported into the second Harbor node.
为便于理解上述获取第一Harbor节点中的镜像的过程,请参阅图4,首先遍历第一Harbor节点中的所有镜像仓库,得到每一个镜像仓库下的所有artifact目录,然后遍历每一个artifact目录下的所有镜像,再判断是否存在未遍历的artifact目录,若存在,再次遍历第一Harbor节点中的所有镜像仓库,直至完成遍历每一个镜像仓库下的所有artifact目录,得到第一Harbor节点中的镜像。In order to facilitate the understanding of the above-mentioned process of obtaining the image in the first Harbor node, please refer to Figure 4. First, traverse all the mirror warehouses in the first Harbor node to obtain all artifact directories under each mirror warehouse, and then traverse each artifact directory. All the images of all the mirrors, and then judge whether there are artifact directories that have not been traversed. If there are, traverse all the mirror warehouses in the first Harbor node again, until all artifact directories under each mirror warehouse are traversed, and the mirror images in the first Harbor node are obtained. .
一种实施方式下,获取第一Harbor节点中的镜像可以是,从第一Harbor节点中获取表征镜像在第一Harbor节点中存储位置和自身属性的镜像信息,镜像信息可以包括镜像在第一Harbor节点中的存储地址、镜像版本信息、镜像内容信息,此处不对镜像信息的具体内容作出限定,只要能根据获取镜像信息从第一Harbor节点中下载镜像信息对应的镜像即可。In one embodiment, obtaining the mirror image in the first Harbor node may be to obtain mirror image information representing the storage location of the mirror image in the first Harbor node and its own attributes from the first Harbor node, and the mirror image information may include the mirror image in the first Harbor node. The storage address, image version information, and image content information in the node do not limit the specific content of the image information here, as long as the image corresponding to the image information can be downloaded from the first Harbor node according to the obtained image information.
S200:将所述镜像下载至预设目录;S200: Download the image to a preset directory;
将从第一Harbor节点中获取的镜像下载至预设目录中,将待上传至第二Harbor节点中的镜像保存在预设目录中,例如,将镜像下载至部署图1所示工具所在节点的预设目录。Download the image obtained from the first Harbor node to the preset directory, and save the image to be uploaded to the second Harbor node in the preset directory, for example, download the image to the node where the tool shown in Figure 1 is deployed Default directory.
一种实施方式下,预设目录可以是/tmp/images,下载至该目录的镜像会按照[image-id]/的格式保存在/tmp/image目录下,例如,/tmp/images/sha256:84a9c2a56336659b21f2c3c8fc671ce7a76042588491d186924732e9bb5b969f,此处仅为便于理解作出的举例,不应作为对本申请的显示。In one embodiment, the preset directory may be /tmp/images, and the image downloaded to this directory will be stored in the /tmp/image directory in the format of [image-id]/, for example, /tmp/images/sha256: 84a9c2a56336659b21f2c3c8fc671ce7a76042588491d186924732e9bb5b969f, here is just an example for easy understanding, and should not be used as a display of this application.
一种实施方式下,在将镜像下载至预设目录后,预设目录中的每一个镜像文件中包括有镜像的图像层文件和镜像信息文件,其中,镜像信息文件包含image layer、启动参数、默认挂在目录等数据。可选的,图像层文件和镜像信息文件均符合OCI(Open Container Initiative,开放式容器标准)标准。Under one embodiment, after the image is downloaded to the preset directory, each image file in the preset directory includes image layer files and image information files of the image, wherein the image information file includes image layer, startup parameters, By default, data such as directories are hung. Optionally, both the image layer file and the image information file conform to the OCI (Open Container Initiative, open container standard) standard.
S300:将预设目录中的每一个镜像上传至第二Harbor节点中的镜像仓库名称与该镜像在所述第一Harbor节点中的镜像仓库名称相同的镜像仓库。S300: Upload each mirror image in the preset directory to a mirror warehouse whose mirror warehouse name in the second Harbor node is the same as the mirror warehouse name of the mirror image in the first Harbor node.
一种实施方式下,在将预设目录中的每一个镜像上传至第二Harbor节点中的镜像仓库名称与该镜像在第一Harbor节点中的镜像仓库名称相同的镜像仓库之前,还需要对第二Harbor节点进行身份认证,其中,对第二Harbor节点进行身份认证的过程可以是,首先获取第二Harbor节点的身份信息,然后将获取的身份信息转换为预设格式并进行编码,得到编码数据,再将该编码数据发送给第二Harbor节点,以使第二Harbor节点基于编码数据进行身份验证,在身份验证通过时,将预设目录中的每一个镜像上传至第二Harbor节点中的镜像仓库名称与该镜像在所述第一Harbor节点中的镜像仓库名称相同的镜像仓库。In one implementation, before uploading each mirror image in the preset directory to the mirror warehouse whose mirror warehouse name in the second Harbor node is the same as the mirror warehouse name of the mirror image in the first Harbor node, it is also necessary to update the first Harbor node. Two Harbor nodes perform identity authentication, wherein, the process of performing identity authentication on the second Harbor node can be: first obtain the identity information of the second Harbor node, and then convert the obtained identity information into a preset format and encode it to obtain encoded data , and then send the coded data to the second Harbor node, so that the second Harbor node performs identity verification based on the coded data, and when the identity verification passes, upload each image in the preset directory to the mirror image in the second Harbor node A mirror warehouse whose warehouse name is the same as that of the mirror warehouse in the first Harbor node.
其中,对第二Harbor节点进行身份认证的过程与前文叙述的对第一Harbor节点进行身份认证的过程相同,为简要描述,此处不再赘述。Wherein, the identity authentication process for the second Harbor node is the same as the identity authentication process for the first Harbor node described above, which is a brief description and will not be repeated here.
一种实施方式下,将预设目录中的每一个镜像上传至第二Harbor节点中的镜像仓库名称与该镜像在所述第一Harbor节点中的镜像仓库名称相同的镜像仓库的过程可以是,首先判断第二Harbor节点是否存在与该镜像在第一Harbor节点中所在镜像仓库名称相同的镜像仓库,在第二Harbor节点不存在与该镜像在第一Harbor节点中所在镜像仓库名称相同的镜像仓库时,在第二Harbor节点中创建与该镜像在第一Harbor节点中所在镜像仓库名称相同的镜像仓库,然后将该镜像上传至第二Harbor节点中的镜像仓库名称与该镜像在第一Harbor节点中的镜像仓库名称相同的镜像仓库。In one embodiment, the process of uploading each mirror image in the preset directory to the mirror warehouse whose mirror warehouse name in the second Harbor node is the same as the mirror warehouse name of the mirror image in the first Harbor node may be as follows: First judge whether there is a mirror warehouse with the same name as the mirror warehouse in the first Harbor node in the second Harbor node, and there is no mirror warehouse in the second Harbor node with the same name as the mirror warehouse in the first Harbor node , create a mirror warehouse in the second Harbor node with the same name as the mirror warehouse in the first Harbor node, and then upload the mirror to the mirror warehouse in the second Harbor node. A mirror repository with the same name as the mirror repository in .
可选的,当第二Harbor节点中存在与该镜像在第一Harbor节点中所在镜像仓库的名称相同的镜像仓库时,将该镜像上传至第二Harbor节点中的镜像仓库名称与该镜像在第一Harbor节点中的镜像仓库名称相同的镜像仓库。Optionally, when there is a mirror warehouse in the second Harbor node with the same name as the mirror warehouse in the first Harbor node, upload the mirror to the mirror warehouse in the second Harbor node. A mirror warehouse with the same name as the mirror warehouse in a Harbor node.
为了便于理解上述将预设目录中的每一个镜像上传至第二Harbor节点中的镜像仓库名称与该镜像在第一Harbor节点中的镜像仓库名称相同的镜像仓库的过程,请参阅图5,图5为本申请实施例示出的一种将预设目录中的镜像上传至第二Harbor节点的流程示意图。In order to facilitate the understanding of the process of uploading each image in the preset directory to the mirror warehouse whose mirror warehouse name in the second Harbor node is the same as that of the mirror warehouse in the first Harbor node, please refer to Figure 5. 5 is a schematic flowchart of uploading the image in the preset directory to the second Harbor node shown in the embodiment of the present application.
可选的,在第二Harbor节点中存在与该镜像在第一Harbor节点中所在镜像仓库的名称相同的镜像仓库时,可以通过第二Harbor节点中的docker来将预设目录中的该镜像推送至第二Harbor节点。Optionally, when there is an image repository with the same name as the image repository in the first Harbor node in the second Harbor node, the image in the preset directory can be pushed through docker in the second Harbor node to the second Harbor node.
可选的,在预设目录中包括多个镜像时,可以按照从第一Harbor节点下载镜像完成的时间先后顺序,将预设目录中的镜像依次上传至第二Harbor节点;或者,可以是在镜像从第一Harbor节点下载镜像完成后,立即将该镜像上传至第二Harbor节点;或者,可以是将多个镜像同时向第二Harbor节点上传。Optionally, when multiple images are included in the preset directory, the images in the preset directory can be uploaded to the second Harbor node in sequence according to the time sequence in which the images are downloaded from the first Harbor node; or, it can be in After the image is downloaded from the first Harbor node, the image is immediately uploaded to the second Harbor node; or, multiple images can be uploaded to the second Harbor node at the same time.
可选的,在将预设目录中的所有镜像均上传至第二Harbor节点后,删除该预设目录,以防止镜像泄露。Optionally, after all the images in the preset directory are uploaded to the second Harbor node, the preset directory is deleted to prevent image leakage.
可选的,在将预设目录中的所有镜像均上传至第二Harbor节点后,判断是否将第一Harbor节点中的所有镜像均导入第二Harbor节点,若第一Harbor节点中还存在未导入第二Harbor节点中的镜像,再次获取第一Harbor节点中的镜像,其中,获取第一Harbor节点中的镜像的过程在前文已叙述清楚,此处不再赘述。Optionally, after uploading all the images in the preset directory to the second Harbor node, determine whether to import all the images in the first Harbor node to the second Harbor node, if there are still unimported images in the first Harbor node The image in the second Harbor node obtains the image in the first Harbor node again, wherein the process of obtaining the image in the first Harbor node has been clearly described above, and will not be repeated here.
可选的,第一Harbor节点和第二Harbor节点为不同版本的Harbor节点,例如,可以是第 一Harbor节点为旧版本的Harbor节点,第二Harbor节点为新版本的Harbor节点;或者,可以是第一Harbor节点为新版本的Harbor节点,第二Harbor节点为旧版本的Harbor节点。Optionally, the first Harbor node and the second Harbor node are Harbor nodes of different versions, for example, the first Harbor node can be an old version Harbor node, and the second Harbor node can be a new version Harbor node; or, it can be The first Harbor node is a new version of Harbor node, and the second Harbor node is an old version of Harbor node.
请参阅图6,图6为本申请实施例示出的一种镜像传输装置100,该镜像传输装置包括获取模块110、下载模块120、上传模块130。Please refer to FIG. 6 . FIG. 6 shows an image transmission device 100 according to an embodiment of the present application. The image transmission device includes an acquisition module 110 , a download module 120 , and an upload module 130 .
获取模块110,用于获取第一Harbor节点中的镜像。The obtaining module 110 is configured to obtain the image in the first Harbor node.
下载模块120,用于将所述镜像下载至预设目录。The download module 120 is configured to download the image to a preset directory.
上传模块130,用于将所述预设目录中的每一个镜像上传至第二Harbor节点中的镜像仓库名称与该镜像在所述第一Harbor节点中的镜像仓库名称相同的镜像仓库。The uploading module 130 is configured to upload each image in the preset directory to a mirror warehouse whose mirror warehouse name in the second Harbor node is the same as the mirror warehouse name of the mirror image in the first Harbor node.
获取模块110,还用于获取所述第一Harbor节点的身份信息;将所述身份信息转换为预设格式并进行编码,得到编码数据;将所述编码数据发送给所述第一Harbor节点,以使所述第一Harbor节点基于所述编码数据进行身份验证;在身份验证通过时,获取所述第一Harbor节点中的镜像。The acquiring module 110 is also used to acquire the identity information of the first Harbor node; convert the identity information into a preset format and encode to obtain encoded data; send the encoded data to the first Harbor node, so that the first Harbor node performs identity verification based on the coded data; when the identity verification passes, acquire the image in the first Harbor node.
获取模块110,还用于遍历所述第一Harbor节点中的所有镜像仓库,得到每一个镜像仓库下的所有artifact目录;遍历每一个artifact目录下的所有镜像,得到所述第一Harbor节点中的镜像。The acquisition module 110 is also used to traverse all mirror warehouses in the first Harbor node to obtain all artifact directories under each mirror warehouse; traverse all mirror images under each artifact directory to obtain the artifact directories in the first Harbor node. mirror image.
上传模块130,具体用于获取所述第二Harbor节点的身份信息;将所述身份信息转换为预设格式并进行编码,得到编码数据;将所述编码数据发送给所述第二Harbor节点,以使所述第二Harbor节点基于所述编码数据进行身份验证;在身份验证通过时,将所述预设目录中的每一个镜像上传至第二Harbor节点中的镜像仓库名称与该镜像在所述第一Harbor节点中的镜像仓库名称相同的镜像仓库。The upload module 130 is specifically used to obtain the identity information of the second Harbor node; convert the identity information into a preset format and encode it to obtain encoded data; send the encoded data to the second Harbor node, To make the second Harbor node perform identity verification based on the encoded data; when the identity verification is passed, each image in the preset directory is uploaded to the name of the image warehouse in the second Harbor node and the image is in the A mirror warehouse with the same name as the mirror warehouse in the first Harbor node.
上传模块130,具体用于判断所述第二Harbor节点是否存在与所述镜像在所述第一Harbor节点中所在镜像仓库名称相同的镜像仓库;在所述第二Harbor节点不存在与所述镜像在所述第一Harbor节点中所在镜像仓库名称相同的镜像仓库时,在所述第二Harbor节点中创建与所述镜像在所述第一Harbor节点中所在镜像仓库名称相同的镜像仓库;将所述镜像上传至所述第二Harbor节点中的镜像仓库名称与所述镜像在所述第一Harbor节点中的镜像仓库名称相同的镜像仓库。The upload module 130 is specifically used to judge whether there is a mirror warehouse with the same name as the mirror warehouse in the first Harbor node in the second Harbor node; When the mirror warehouse with the same name as the mirror warehouse in the first Harbor node, create a mirror warehouse with the same name as the mirror warehouse in the first Harbor node in the second Harbor node; The mirror image is uploaded to the mirror warehouse whose mirror warehouse name in the second Harbor node is the same as the mirror warehouse name of the mirror image in the first Harbor node.
上传模块130,具体用于确定所述第二Harbor节点存在与所述镜像在所述第一Harbor节点中所在镜像仓库的名称相同的镜像仓库;将所述镜像上传至所述第二Harbor节点中的镜像仓库名称与所述镜像在所述第一Harbor节点中的镜像仓库名称相同的镜像仓库。The upload module 130 is specifically used to determine that the second Harbor node has a mirror warehouse with the same name as the mirror warehouse where the mirror image is located in the first Harbor node; upload the mirror image to the second Harbor node A mirror warehouse whose name is the same as that of the mirror image in the first Harbor node.
本申请实施例所提供的镜像传输装置100,其实现原理及产生的技术效果和前述镜像传输方法实施例相同,为简要描述,装置实施例部分未提及之处,可参考前述镜像传输方法实施例中相应内容。The mirror image transmission device 100 provided by the embodiment of the present application has the same realization principle and technical effect as the embodiment of the mirror image transfer method described above. For the sake of brief description, the parts not mentioned in the device embodiment can be implemented with reference to the mirror image transfer method described above. corresponding content in the example.
请参阅图7,其为本申请实施例提供的一种电子设备200。所述电子设备200包括:收发器210、存储器220、通讯总线230、处理器240。Please refer to FIG. 7 , which is an electronic device 200 provided in an embodiment of the present application. The electronic device 200 includes: a transceiver 210 , a memory 220 , a communication bus 230 , and a processor 240 .
所述收发器210、所述存储器220、处理器240各元件相互之间直接或间接地电性连接,以实现数据的传输或交互。例如,这些元件相互之间可通过一条或多条通讯总线230或信号线实现电性连接。其中,收发器210用于收发数据。存储器220用于存储计算机程序,如存储有图6中所示的软件功能模块,即镜像传输装置100。其中,镜像传输装置100包括至少一个可以软件或固件(firmware)的形式存储于所述存储器220中或固化在所述电子设备200的操作系统(operating system,OS)中的软件功能模块。所述处理器240,用于执行存储器220中存储的可执行模块,例如镜像传输装置100包括的软件功能模块或计算机程序。例如,获取第一Harbor节点中的镜像;将所述镜像下载至预设目录;将所述预设目录中的每一个镜像上传至第二Harbor节点中的镜像仓库名称与该镜像在所述第一Harbor节点中的镜像仓库名称相同的镜像仓库。The components of the transceiver 210, the memory 220, and the processor 240 are directly or indirectly electrically connected to each other to realize data transmission or interaction. For example, these components can be electrically connected to each other through one or more communication buses 230 or signal lines. Wherein, the transceiver 210 is used for sending and receiving data. The memory 220 is used to store computer programs, for example, the software function modules shown in FIG. 6 are stored, that is, the image transmission device 100 . Wherein, the image transmission apparatus 100 includes at least one software function module that can be stored in the memory 220 in the form of software or firmware (firmware) or solidified in the operating system (operating system, OS) of the electronic device 200 . The processor 240 is configured to execute an executable module stored in the memory 220 , such as a software function module or a computer program included in the image transmission apparatus 100 . For example, obtain the mirror image in the first Harbor node; download the mirror image to a preset directory; upload each mirror image in the preset directory to the mirror warehouse name in the second Harbor node and the mirror image in the first Harbor node A mirror warehouse with the same name as the mirror warehouse in a Harbor node.
其中,存储器220可以是,但不限于,随机存取存储器(Random Access Memory,RAM),只读存储器(Read Only Memory,ROM),可编程只读存储器(Programmable Read-Only Memory,PROM),可擦除只读存储器(Erasable Programmable Read-Only Memory,EPROM),电可擦除只读存储器(Electric Erasable Programmable Read-Only Memory,EEPROM)等。Wherein, memory 220 can be, but not limited to, random access memory (Random Access Memory, RAM), read-only memory (Read Only Memory, ROM), programmable read-only memory (Programmable Read-Only Memory, PROM), can Erasable Programmable Read-Only Memory (EPROM), Electric Erasable Programmable Read-Only Memory (EEPROM), etc.
处理器240可能是一种集成电路芯片,具有信号的处理能力。上述的处理器可以是通用处理器,包括中央处理器(Central Processing Unit,CPU)、网络处理器(Network Processor,NP)等;还可以是数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现场可编程门阵列(Field Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。可以实现或者执行本申请实施例中的公开的各方法、步骤及逻辑框图。通用处理器可以是微处理器或者该处理器240也可以是任何常规的处理器等。The processor 240 may be an integrated circuit chip with signal processing capability. The above-mentioned processor can be a general-purpose processor, including a central processing unit (Central Processing Unit, CPU), a network processor (Network Processor, NP), etc.; it can also be a digital signal processor (Digital Signal Processor, DSP), a dedicated integrated Circuit (Application Specific Integrated Circuit, ASIC), Field Programmable Gate Array (Field Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. Various methods, steps, and logic block diagrams disclosed in the embodiments of the present application may be implemented or executed. The general purpose processor may be a microprocessor or the processor 240 may be any conventional processor or the like.
其中,上述的电子设备200,包括但不限于个人电脑、服务器等。Wherein, the above-mentioned electronic device 200 includes but not limited to a personal computer, a server, and the like.
本申请实施例还提供了一种非易失性计算机可读取存储介质(以下简称存储介质),该存储介质上存储有计算机程序,该计算机程序被计算机如上述的电子设备200运行时,执行上述 所示的镜像传输方法。The embodiment of the present application also provides a non-volatile computer-readable storage medium (hereinafter referred to as storage medium), on which a computer program is stored, and when the computer program is run by a computer such as the above-mentioned electronic device 200, the The image transfer method shown above.
以上所述仅为本申请的优选实施例而已,并不用于限制本申请,对于本领域的技术人员来说,本申请可以有各种更改和变化。凡在本申请的精神和原则之内,所作的任何修改、等同替换、改进等,均应包含在本申请的保护范围之内。The above descriptions are only preferred embodiments of the present application, and are not intended to limit the present application. For those skilled in the art, there may be various modifications and changes in the present application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of this application shall be included within the protection scope of this application.

Claims (10)

  1. 一种镜像传输方法,其特征在于,包括:A method for image transmission, characterized in that, comprising:
    获取第一Harbor节点中的镜像;Obtain the image in the first Harbor node;
    将所述镜像下载至预设目录;Download the image to a preset directory;
    将所述预设目录中的每一个镜像上传至第二Harbor节点中的镜像仓库名称与该镜像在所述第一Harbor节点中的镜像仓库名称相同的镜像仓库。Upload each image in the preset directory to a mirror repository whose mirror repository name in the second Harbor node is the same as the mirror repository name of the mirror image in the first Harbor node.
  2. 根据权利要求1所述的方法,其特征在于,所述获取第一Harbor节点中的镜像,包括:The method according to claim 1, wherein said obtaining the image in the first Harbor node comprises:
    获取所述第一Harbor节点的身份信息;Obtain the identity information of the first Harbor node;
    将所述身份信息转换为预设格式并进行编码,得到编码数据;converting the identity information into a preset format and encoding it to obtain encoded data;
    将所述编码数据发送给所述第一Harbor节点,以使所述第一Harbor节点基于所述编码数据进行身份验证;sending the coded data to the first Harbor node, so that the first Harbor node performs identity verification based on the coded data;
    在身份验证通过时,获取所述第一Harbor节点中的镜像。When the identity verification is passed, the image in the first Harbor node is acquired.
  3. 根据权利要求1所述的方法,其特征在于,所述获取第一Harbor节点中的镜像,包括:The method according to claim 1, wherein said obtaining the image in the first Harbor node comprises:
    遍历所述第一Harbor节点中的所有镜像仓库,得到每一个镜像仓库下的所有artifact目录;Traversing all mirror warehouses in the first Harbor node to obtain all artifact directories under each mirror warehouse;
    遍历每一个artifact目录下的所有镜像,得到所述第一Harbor节点中的镜像。Traversing all images in each artifact directory to obtain the images in the first Harbor node.
  4. 根据权利要求1所述的方法,其特征在于,所述将所述预设目录中的每一个镜像上传至第二Harbor节点中的镜像仓库名称与该镜像在所述第一Harbor节点中的镜像仓库名称相同的镜像仓库,包括:The method according to claim 1, characterized in that, uploading each mirror image in the preset directory to the name of the mirror warehouse in the second Harbor node and the mirror image of the mirror image in the first Harbor node Mirror warehouses with the same warehouse name, including:
    获取所述第二Harbor节点的身份信息;Obtain the identity information of the second Harbor node;
    将所述身份信息转换为预设格式并进行编码,得到编码数据;converting the identity information into a preset format and encoding it to obtain encoded data;
    将所述编码数据发送给所述第二Harbor节点,以使所述第二Harbor节点基于所述编码数据进行身份验证;sending the coded data to the second Harbor node, so that the second Harbor node performs identity verification based on the coded data;
    在身份验证通过时,将所述预设目录中的每一个镜像上传至第二Harbor节点中的镜像仓库名称与该镜像在所述第一Harbor节点中的镜像仓库名称相同的镜像仓库。When the identity verification is passed, each image in the preset directory is uploaded to a mirror warehouse whose mirror warehouse name in the second Harbor node is the same as that of the mirror warehouse in the first Harbor node.
  5. 根据权利要求1所述的方法,其特征在于,所述将所述预设目录中的每一个镜像上传至第二Harbor节点中的镜像仓库名称与该镜像在所述第一Harbor节点中的镜像仓库名称相同的镜像仓库,包括:The method according to claim 1, characterized in that, uploading each mirror image in the preset directory to the name of the mirror warehouse in the second Harbor node and the mirror image of the mirror image in the first Harbor node Mirror warehouses with the same warehouse name, including:
    判断所述第二Harbor节点是否存在与所述镜像在所述第一Harbor节点中所在镜像仓库名称相同的镜像仓库;Judging whether there is a mirror warehouse with the same name as the mirror warehouse in the first Harbor node in the second Harbor node;
    在所述第二Harbor节点不存在与所述镜像在所述第一Harbor节点中所在镜像仓库名称相 同的镜像仓库时,在所述第二Harbor节点中创建与所述镜像在所述第一Harbor节点中所在镜像仓库名称相同的镜像仓库;When the second Harbor node does not have a mirror repository with the same name as the mirror repository in the first Harbor node, create an A mirror warehouse with the same name as the mirror warehouse in the node;
    将所述镜像上传至所述第二Harbor节点中的镜像仓库名称与所述镜像在所述第一Harbor节点中的镜像仓库名称相同的镜像仓库。uploading the mirror image to a mirror warehouse whose mirror warehouse name in the second Harbor node is the same as that of the mirror warehouse in the first Harbor node.
  6. 根据权利要求1所述的方法,其特征在于,所述将所述预设目录中的每一个镜像上传至第二Harbor节点中的镜像仓库名称与该镜像在所述第一Harbor节点中的镜像仓库名称相同的镜像仓库,包括:The method according to claim 1, characterized in that, uploading each mirror image in the preset directory to the name of the mirror warehouse in the second Harbor node and the mirror image of the mirror image in the first Harbor node Mirror warehouses with the same warehouse name, including:
    确定所述第二Harbor节点存在与所述镜像在所述第一Harbor节点中所在镜像仓库的名称相同的镜像仓库;Determining that the second Harbor node has a mirror repository with the same name as the mirror repository in the first Harbor node;
    将所述镜像上传至所述第二Harbor节点中的镜像仓库名称与所述镜像在所述第一Harbor节点中的镜像仓库名称相同的镜像仓库。uploading the mirror image to a mirror warehouse whose mirror warehouse name in the second Harbor node is the same as that of the mirror warehouse in the first Harbor node.
  7. 一种镜像传输装置,其特征在于,包括:A mirror transmission device is characterized in that it comprises:
    获取模块,用于获取第一Harbor节点中的镜像;An acquisition module, configured to acquire the image in the first Harbor node;
    下载模块,用于将所述镜像下载至预设目录;A download module, configured to download the image to a preset directory;
    上传模块,用于将所述预设目录中的每一个镜像上传至第二Harbor节点中的镜像仓库名称与该镜像在所述第一Harbor节点中的镜像仓库名称相同的镜像仓库。The upload module is configured to upload each image in the preset directory to a mirror warehouse whose mirror warehouse name in the second Harbor node is the same as the mirror warehouse name of the mirror image in the first Harbor node.
  8. 根据权利要求7所述的镜像传输装置,其特征在于,所述获取模块,还用于获取所述第一Harbor节点的身份信息;将所述身份信息转换为预设格式并进行编码,得到编码数据;将所述编码数据发送给所述第一Harbor节点,以使所述第一Harbor节点基于所述编码数据进行身份验证;在身份验证通过时,获取所述第一Harbor节点中的镜像。The image transmission device according to claim 7, wherein the acquisition module is also used to acquire the identity information of the first Harbor node; convert the identity information into a preset format and encode it to obtain the encoding data; sending the coded data to the first Harbor node, so that the first Harbor node performs identity verification based on the coded data; when the identity verification is passed, obtain the image in the first Harbor node.
  9. 一种电子设备,其特征在于,包括:存储器和处理器,所述存储器和所述处理器连接;An electronic device, characterized in that it includes: a memory and a processor, the memory is connected to the processor;
    所述存储器,用于存储程序;The memory is used to store programs;
    所述处理器,用于调用存储于所述存储器中的程序,以执行如权利要求1-6中任一项所述的方法。The processor is configured to call a program stored in the memory to execute the method according to any one of claims 1-6.
  10. 一种计算机可读存储介质,其特征在于,其上存储有计算机程序,所述计算机程序被计算机运行时,执行如权利要求1-6中任一项所述的方法。A computer-readable storage medium, characterized in that a computer program is stored thereon, and when the computer program is run by a computer, the method according to any one of claims 1-6 is executed.
PCT/CN2022/099354 2021-11-19 2022-06-17 Mirror image transmission method and apparatus, electronic device, and storage medium WO2023087693A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202111401028.2A CN114090029A (en) 2021-11-19 2021-11-19 Mirror image transmission method and device, electronic equipment and storage medium
CN202111401028.2 2021-11-19

Publications (1)

Publication Number Publication Date
WO2023087693A1 true WO2023087693A1 (en) 2023-05-25

Family

ID=80303769

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/099354 WO2023087693A1 (en) 2021-11-19 2022-06-17 Mirror image transmission method and apparatus, electronic device, and storage medium

Country Status (2)

Country Link
CN (1) CN114090029A (en)
WO (1) WO2023087693A1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114090029A (en) * 2021-11-19 2022-02-25 中国电信集团系统集成有限责任公司 Mirror image transmission method and device, electronic equipment and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140173229A1 (en) * 2012-12-17 2014-06-19 International Business Machines Corporation Method and Apparatus for Automated Migration of Data Among Storage Centers
CN111858181A (en) * 2020-07-22 2020-10-30 浪潮云信息技术股份公司 Method and tool for realizing mirror synchronization of cross-region containers
CN111917856A (en) * 2020-07-27 2020-11-10 平安证券股份有限公司 Mirror image file delivery method and related equipment
CN114090029A (en) * 2021-11-19 2022-02-25 中国电信集团系统集成有限责任公司 Mirror image transmission method and device, electronic equipment and storage medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140173229A1 (en) * 2012-12-17 2014-06-19 International Business Machines Corporation Method and Apparatus for Automated Migration of Data Among Storage Centers
CN111858181A (en) * 2020-07-22 2020-10-30 浪潮云信息技术股份公司 Method and tool for realizing mirror synchronization of cross-region containers
CN111917856A (en) * 2020-07-27 2020-11-10 平安证券股份有限公司 Mirror image file delivery method and related equipment
CN114090029A (en) * 2021-11-19 2022-02-25 中国电信集团系统集成有限责任公司 Mirror image transmission method and device, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN114090029A (en) 2022-02-25

Similar Documents

Publication Publication Date Title
WO2018201978A1 (en) Interface call data processing method, apparatus, computer device and storage medium
US11483214B2 (en) Synchronizing data between cloud manager and providers
WO2017101186A1 (en) Method for establishing wireless connection for application of user equipment
WO2023087693A1 (en) Mirror image transmission method and apparatus, electronic device, and storage medium
CN114281573A (en) Workflow data interaction method and device, electronic device and readable storage medium
CN114363165B (en) Configuration method of electronic equipment, electronic equipment and server
WO2017166130A1 (en) Method for accessing home nas equipment, corresponding device and system
CN111782652B (en) Data calling method, device, computer equipment and storage medium
CN115758326A (en) Data sharing method, network side device, system, electronic device and storage medium
EP4357950A1 (en) Device management method, system and apparatus
CN114020689A (en) Data processing method, data processing device, electronic device, and storage medium
CN112650954B (en) Block chain data sharing method, device, equipment and storage medium
US20210075879A1 (en) Customized application architecture utilizing sparse and base metadata layers
WO2019027934A1 (en) Propagating information with network nodes
WO2023103331A1 (en) Cloud platform connection method and apparatus, and device and storage medium
US20230032867A1 (en) Certificate revocation at datacenters
CN117319412A (en) Management method of block chain network and related equipment
CN109450781B (en) Mail communication method based on distributed network and related device
CN112583890A (en) Message pushing method and device based on enterprise office system and computer equipment
CN113765962A (en) Data processing method and system for service platform, computer system and medium
WO2023134144A1 (en) Method for processing cloud service in cloud system, and related apparatus
WO2018177272A1 (en) Application information acquisition method and device, data processing terminal, and storage medium
US11985033B2 (en) Propagating information with network nodes
CN115297066B (en) Resource dynamic cooperation method, device, server and medium
CN112256646B (en) Method and device for operating file system subdirectory, electronic equipment and storage medium

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22894236

Country of ref document: EP

Kind code of ref document: A1