WO2019165573A1 - 一种基于Docker的镜像同步方法、装置及系统 - Google Patents

一种基于Docker的镜像同步方法、装置及系统 Download PDF

Info

Publication number
WO2019165573A1
WO2019165573A1 PCT/CN2018/077321 CN2018077321W WO2019165573A1 WO 2019165573 A1 WO2019165573 A1 WO 2019165573A1 CN 2018077321 W CN2018077321 W CN 2018077321W WO 2019165573 A1 WO2019165573 A1 WO 2019165573A1
Authority
WO
WIPO (PCT)
Prior art keywords
synchronized
layer
mirror
target node
level data
Prior art date
Application number
PCT/CN2018/077321
Other languages
English (en)
French (fr)
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 深圳中兴力维技术有限公司
Priority to PCT/CN2018/077321 priority Critical patent/WO2019165573A1/zh
Publication of WO2019165573A1 publication Critical patent/WO2019165573A1/zh

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L65/00Network arrangements, protocols or services for supporting real-time applications in data packet communication
    • H04L65/40Support for services or applications

Definitions

  • the present invention relates to the field of cloud computing, and in particular, to a method, apparatus, and system based on Docker image synchronization.
  • the offline mode is to convert a complete image into a tarball, and then send the entire tarball to the target node, and load the target node through L oad to realize the distribution and synchronization of the image.
  • the technical problem to be solved by the present invention is to provide a Docker-based image synchronization method, device, and system, which can solve the problem that the image size of the packaged image is too large when performing image synchronization in an offline mode, which can be significant. Improve the synchronization efficiency of the image.
  • the present invention provides a Docker-based image synchronization method, the method comprising:
  • the to-be-synchronized layer is packaged in the image to be synchronized of the source node, and sent to the target node;
  • the target node receives the layer to be synchronized sent by the source node, and loads it into the Docker for synchronization.
  • the mirroring level between the mirror image of the source node and the mirror of the target node is analyzed, and information about the layer to be synchronized is obtained;
  • the source node to be synchronized mirror level data is matched with the target node mirror level data to obtain the to-be-synchronized layer information, including: the hierarchical data of the source node to be synchronously mirrored is in the target node mirror level data. Find, if the level data exists, the level does not need to be synchronized; if the level data does not exist, the level needs to be synchronized, and the layer is added to the layer to be synchronized information.
  • the source node to be synchronized mirror level data is matched with the target node mirror level data, and the information of the to-be-synchronized layer is obtained, including: when the to-be-synchronized image includes multiple levels, the processing is performed by using a traversal level manner, that is, According to the following hierarchical data synchronization method, after processing one level, the next level is traversed until all the levels are synchronized; wherein the level data synchronization mode is: the level data of the source node to be synchronously mirrored is at the target node mirror level Find in the data, such as the level of data storage In this case, the hierarchy does not need to be synchronized; if the hierarchical data does not exist, the hierarchy needs to be synchronized, and the layer is added to the information to be synchronized.
  • the source node to be synchronized mirror level data is matched with the target node mirror level data, and the information of the to-be-synchronized layer is obtained, including: when the source node includes multiple to-be-synchronized mirrors, looping through all the mirrors to be synchronized
  • the method performs processing, that is, processing the level data synchronization of a mirror to be synchronized, and then traversing the next mirror to be synchronized until the synchronization of all the mirrors to be synchronized is completed.
  • the to-be-synchronized layer is packaged in the to-be-synchronized image of the source node, and sent to the target node.
  • the method includes: according to the to-be-synchronized layer information, only the source node to be synchronized in the mirror And the corresponding to-be-synchronized layer in the to-be-synchronized layer information is packaged; and the packaged to-be-synchronized layer is sent to the target node
  • the method includes: the target node receives and unpacks the to-be-synchronized layer sent by the source node; Layers are loaded into Docker for synchronization.
  • the present invention provides a Docker-based image synchronization device, and the device includes: an analysis module, a packaging module, and a loading module. among them:
  • the analysis module is configured to analyze a mirror level between the mirror image of the source node and the mirror image of the target node, and obtain information about the layer to be synchronized;
  • the packaging module is configured to package the to-be-synchronized layer in the source node to be synchronized image according to the to-be-synchronized layer information, and send the to-be-synchronized layer to the target node;
  • the loading module is configured to receive, by the target node, the to-be-synchronized layer sent by the source node, and load the data into a Docker for synchronization.
  • the analysis module is specifically configured to: collect mirror level data of all mirrors of the target node to form structured data; collect mirror level data of the source node to be synchronously mirrored, and form structured data; The synchronous mirror level data is matched with the target node mirror level data to obtain a layer to be synchronized.
  • the source node to be synchronized mirror level data is matched with the target node mirror level data to obtain the to-be-synchronized layer information, including: the hierarchical data of the source node to be synchronously mirrored is in the target node mirror level data. Find, if the level data exists, the level does not need to be synchronized; if the level If the data does not exist, the hierarchy needs to be synchronized, and the layer is added to the information of the layer to be synchronized.
  • the source node to be synchronized mirror level data is matched with the target node mirror level data, and the to-be-synchronized layer information is obtained, including: when the to-be-synchronized image includes multiple levels, the traversal hierarchical method is used for processing, that is, The following level data synchronization is processed to complete a hierarchy and then traversing the next hierarchy until all the levels are synchronized; the hierarchical data synchronization mode is: the hierarchical data of the source node to be synchronously mirrored is in the target node mirror level data. Find, if the level data exists, the level does not need to be synchronized; if the level data does not exist, the level needs to be synchronized, and the layer is added to the layer to be synchronized information.
  • the source node to be synchronized mirror level data is matched with the target node mirror level data, and the information of the to-be-synchronized layer is obtained, including: when the source node includes multiple to-be-synchronized mirrors, looping through all the mirrors to be synchronized
  • the method performs processing, that is, processing the level data synchronization of a mirror to be synchronized, and then traversing the next mirror to be synchronized until the synchronization of all the mirrors to be synchronized is completed.
  • the packaging module is specifically configured to: according to the to-be-synchronized layer information, only the to-be-synchronized layer corresponding to the to-be-synchronized layer information is to be packaged in the to-be-synchronized mirroring of the source node; The layer is sent to the target node.
  • the loading module is specifically configured to: the target node receives and unpacks the to-be-synchronized layer sent by the source node, and loads the to-be-synchronized layer into the Docker for synchronization.
  • the present invention further provides a Docker-based image synchronization system, the system comprising: a source node, a target node, and a synchronization device; wherein: the synchronization device is configured to mirror the source node to be synchronized Sync to the target node.
  • the Docker-based image synchronization method, device and system provided by the present invention form structured data by mirroring the mirroring level of the source node to be synchronized and the target node image, and the source node to be synchronized mirror level data and the The target node mirroring level data is matched, and the missing layer data between the source node to be synchronized mirror and the target node image is obtained, and the information of the layer to be synchronized is obtained, and then only the information to be synchronized in the source node to be synchronized mirrored
  • the corresponding layer to be synchronized is packaged and sent to the target node, and the target node receives and unpacks the layer to be synchronized sent by the source node, and loads the layer to be synchronized into the Docker for the same Step, merge and assemble with its own common layer to form a target node image, so as to complete the mirror synchronization between the target node image and the source node to be synchronized mirror image; this can solve the problem that the image size
  • the mirror level data structured storage method adopted by the present invention can record the hierarchical relationship of the mirror quickly and effectively, so that the subsequent algorithm compares the images and obtains the difference mirror layer.
  • the synchronization method of the mirror layer proposed by the present invention can achieve efficient mirror comparison, and can significantly improve the speed of acquiring the differential mirror layer.
  • FIG. 1 is a flow chart showing a Docker-based image synchronization method provided by the invention
  • FIG. 2 is a diagram showing a mirror tree hierarchy structure of a source node and a target node mirror A/B/C/D according to the present invention
  • FIG. 3 is a schematic diagram showing a mirror level structure of a target node mirror B according to the present invention.
  • FIG. 4 is a specific flowchart of a Docker-based image synchronization method provided by the present invention.
  • FIG. 5 is a schematic structural diagram of a Docker-based mirror synchronization device provided by the present invention.
  • FIG. 6 is a schematic structural diagram of a Docker-based image synchronization system provided by the present invention.
  • the invention provides a synchronization method of a container cloud image based on Docker, the method comprising:
  • Step S1 analyzing a mirror level between the mirror to be synchronized and the mirror of the target node, and obtaining information of the layer to be synchronized;
  • Step S2 according to the information of the to-be-synchronized layer, the to-be-synchronized layer is packaged in the image to be synchronized of the source node, and sent to the target node;
  • Step S3 The target node receives the to-be-synchronized layer sent by the source node, and loads it into the Docker for synchronization.
  • step S1 the mirroring level between the mirror image of the source node and the mirror of the target node is analyzed, and the information of the layer to be synchronized is obtained;
  • the method of processing the mirrors to be synchronized is processed in a loop, that is, the hierarchical data synchronization of the mirrors to be synchronized is processed in the above hierarchical data synchronization manner, and then the next mirror to be synchronized is traversed.
  • the hierarchical structure is traversed from top to bottom, that is, the processing is completed according to the above hierarchical data synchronization method, and then traversed.
  • a level until the traversal of all the tiers is synchronized, indicating that the level matching of the mirror to be synchronized has been completed, and then proceeds to continue processing the next mirror to be synchronized.
  • the to-be-synchronized layer is packaged in the image to be synchronized of the source node, and is sent to the target node according to the to-be-synchronized layer information.
  • the to-be-synchronized layer corresponding to the to-be-synchronized layer information is packaged in the to-be-synchronized mirror of the source node;
  • the packaged to-be-synchronized layer is sent to the target node for mirror synchronization.
  • step S3 the target node receives the to-be-synchronized layer sent by the source node, and loads it into the Docker for synchronization; specifically:
  • the target node receives and unpacks the to-be-synchronized layer sent by the source node; loads the to-be-synchronized layer into the Dock er for synchronization, merges and assembles with its own common layer, forms a target node image, thereby completing the target node image Mirror synchronization with the mirror of the source node to be synchronized.
  • the source node has a mirror A/B/C/D.
  • the mirror hierarchy of the source node is shown in Figure 2.
  • the mirror image A consists of four layers of layer 31/21/11/01
  • the mirror image B consists of layer 32/21/11/01
  • the mirror image C consists of two layers of layer 12/01
  • the mirror image D consists of layer 13/02. It consists of two layers.
  • Mirrors A and B can be viewed as two versions of the same application, so mirror A and mirror B have the same common layer 21/11/01, and the difference is mainly because the last layer adds different versions of the code.
  • Mirror A and Mirror C/D can be viewed as mirrors of different applications, they may or may not have the same layer.
  • the target node has only mirror B, and the mirror hierarchy of the target node is as shown in FIG. 3.
  • the two sides can multiplex the layer 21/11/01 of the mirror B. That is: If you need to synchronize mirror A from the source node to the target node, because the target node already has mirror B, the layer of mirror B can be used as a common layer, and the layer 21/11/01 of mirror B can be reused.
  • the layer 31/21/11/01 so when the mirror A needs to be synchronized, it is only necessary to synchronize the missing layers of the two, that is, only the synchronization layer 31 is needed. For the same reason, synchronous mirror C only needs synchronization layer 12.
  • mirroring D is synchronized, all layers 02/13 need to be synchronized because the target node does not have any public layers available.
  • the present invention performs structured storage on the mirrored hierarchical data, and specifies that the mirror is managed from the bottom to the parent and child, that is, the next layer is the parent layer of the upper layer, and the lowest layer is the root layer, and the parent layer is empty.
  • the image name is only marked on the top layer.
  • the mirrored hierarchical data storage structure is shown in the following table:
  • the storage structure of the mirror B is:
  • the invention provides a synchronization method based on Docker-based container cloud image, which can synchronously mirror all the mirrors from the source node to the target node, or only partially mirror the mirror; the specific steps of the synchronization method are as follows:
  • Step S11 Initializing the to-be-synchronized layer list list is empty.
  • Step S12 Acquire image level data targ e t_laye rS of all mirrors of the target node.
  • Step S13 Obtain a mirror name list sync_images that needs to be synchronized.
  • Step S14 sync_images traverses the image to be synchronized, and if all synchronization is completed, then moves to S20
  • Step S15 Acquire the image to be synchronized image sequentially from the mirror name list sync_images.
  • Step S16 Acquire a hierarchical structure of the to-be-synchronized image.
  • Step S17 traversing each layer ID in order from top to bottom. If all layer ID traversal is completed, then step S is performed.
  • Step S18 Acquire a mirror image layer ID from the image layer structure to be synchronized.
  • Step S19 searching the layer ID in the mirror level data target_lay erS of the target node, if the layer I If D exists, it indicates that the layer already exists in the target node and does not need to be synchronized. If the layer ID does not exist, it indicates that the layer does not exist in the target node and needs to be synchronized. Bayu adds the layer ID to the list of the layer to be synchronized list. (Step S20), the looping steps S17 to S20 are continued to complete the traversal matching of the next layer ID. If all the layer IDs are traversed, the level matching of the Image has been completed, and the process proceeds to step S14 to continue the synchronization of the next image to be synchronized.
  • Step S21 End matching of the to-be-synchronized layer list, and obtain all the to-be-synchronized layer list list.
  • Step S22 After obtaining the to-be-synchronized layer list list, the source node according to the list, and only the corresponding to-be-synchronized layer in the list is packaged and sent to the target node.
  • Step S23 After the target node unpacks the received layer to be synchronized, the corresponding layer to be synchronized is loaded into the Docker, and the offline mirror synchronization can be completed.
  • the mirror level data may be first obtained from the target node, and then the mirror level data of the target node is sent to the source node in some manner, and the source node according to the above process
  • the synchronization layer is packaged, and then the packaged image is sent to the target node in some manner, and then the target node performs unpacking and loading the corresponding synchronization layer to complete the mirror synchronization.
  • FIG. 2 The synchronization method of the Docker-based container cloud image provided by the above invention is further illustrated by taking FIG. 2 as an example.
  • the target node includes mirror A, mirror B, and mirror D. Now, mirror C needs to be synchronized to the target node.
  • the specific steps are as follows:
  • Step 1 Initializing the layer list list to be synchronized is empty
  • Step 2 Obtain the mirror level data target_layers of all mirrors of the target node : [31, 21, 11, 01, 32, 13, 02];
  • Step 3 Obtain a mirror name list syncjmages that needs to be synchronized: [Mirror C] ;
  • Step 4 sequentially obtain the image to be synchronized Image [Mirror C] from the image name list sync_images, if all the synchronization is completed, then go to step 7;
  • Step 5 Obtain the hierarchical structure of the image [image C] to be synchronized [12, 01];
  • Step 6 Traverse each layer ID in order from top to bottom.
  • the layer 12 does not exist in the target_layers, and the ID of the layer 12 is added to the list of the layer to be synchronized, and the layer 01 exists in the target_layers, and synchronization is not required.
  • Mirror C has only two layers [12, 01], the traversal is completed, and the process proceeds to step 4, continuing the traversal of the next image to be synchronized.
  • Step 7 End the matching of the to-be-synchronized layer list, and obtain all the to-be-synchronized layer list list: [12].
  • Step 8 After obtaining the list of the layer to be synchronized list[12], the source node according to the list, and only the corresponding layer to be synchronized [12] in the image to be synchronized C is packaged and sent to the target node.
  • Step 9 After the target node unpacks the received layer to be synchronized [12], the corresponding layer to be synchronized [12] is loaded into the Docker, and offline mirror synchronization can be completed.
  • the present invention provides a synchronization device based on a Docker-based container cloud image.
  • the synchronization device 100 includes an analysis module 10, a packaging module 20, and a loading module 30. among them:
  • the analysis module 10 is configured to analyze a mirror level between the source node to be synchronized mirror and the target node image, to obtain information about the layer to be synchronized;
  • the packaging module 20 is configured to package the to-be-synchronized layer in the source node to be synchronized image according to the to-be-synchronized layer information, and send the to-be-synchronized layer to the target node;
  • the loading module 30 is configured to receive, by the target node, a layer to be synchronized sent by the source node, and load it into a Docker for synchronization.
  • the analysis module 10 is specifically configured to:
  • the method of processing the mirrors to be synchronized is processed in a loop, that is, the hierarchical data synchronization of the mirrors to be synchronized is processed in the above hierarchical data synchronization manner, and then the next mirror to be synchronized is traversed.
  • the hierarchical structure is traversed from top to bottom, that is, the processing is completed in the above hierarchical data synchronization manner, and then the next hierarchical level is traversed until all the hierarchical structures are traversed until the synchronization is completed.
  • the level matching of the mirror to be synchronized has been completed, and then proceeds to continue processing the next mirror to be synchronized.
  • the packaging module 20 is specifically configured to:
  • the to-be-synchronized layer information only the to-be-synchronized layer corresponding to the to-be-synchronized layer information is packaged in the to-be-synchronized mirroring of the source node;
  • the packaged to-be-synchronized layer is sent to the target node for mirror synchronization.
  • the loading module 30 is specifically configured to:
  • the target node receives and unpacks the to-be-synchronized layer sent by the source node; loads the to-be-synchronized layer into the Dock er for synchronization, merges and assembles with its own common layer, forms a target node image, and completes the target node image.
  • the present invention provides a Docker-based container cloud image synchronization system, the synchronization system includes: a source node 200, a synchronization device 100, and a target node 300; wherein: the synchronization device 100 is configured to synchronize the image to be synchronized of the source node 200 Go to the target node 300.
  • the Docker-based image synchronization method, device and system provided by the present invention form structured data by mirroring the mirroring level of the source node to be synchronized and the target node image, and the source node to be synchronized mirror level data and the The target node mirroring level data is matched, and the missing layer data between the source node to be synchronized mirror and the target node image is obtained, and the information of the layer to be synchronized is obtained, and then only the information to be synchronized in the source node to be synchronized mirrored The corresponding layer to be synchronized is packaged and sent to the target node.
  • the target node receives and unpacks the layer to be synchronized sent by the source node, loads the layer to be synchronized into Docker for synchronization, merges and assembles with its own common layer, and forms a target node.
  • Mirroring thereby completing the mirror synchronization between the target node image and the source node to be synchronized; this can solve the problem that the image size of the image packaged in the offline mode is too large, which can significantly improve the synchronization efficiency of the image.
  • the Docker-based image synchronization method, device and system provided by the present invention form structured data by mirroring the mirroring level of the source node to be synchronized and the target node image, and the source node to be synchronized mirror level data and the The target node mirroring level data is matched, and the missing layer data between the source node to be synchronized mirror and the target node image is obtained, and the information of the layer to be synchronized is obtained, and then only the information to be synchronized in the source node to be synchronized mirrored The corresponding layer to be synchronized is packaged and sent to the target node.
  • the target node receives and unpacks the layer to be synchronized sent by the source node, loads the layer to be synchronized into Docker for synchronization, merges and assembles with its own common layer, and forms a target node.
  • Mirroring thereby completing the mirror synchronization between the target node image and the source node to be synchronized; this can solve the problem that the image size of the image packaged in the offline mode is too large, which can significantly improve the synchronization efficiency of the image and greatly improve the synchronization efficiency.
  • the efficiency of the deployment of the operation and maintenance personnel can solve the problem that the image size of the image packaged in the offline mode is too large, which can significantly improve the synchronization efficiency of the image and greatly improve the synchronization efficiency. The efficiency of the deployment of the operation and maintenance personnel.

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

本发明公开一种基于Docker的镜像同步方法、装置及系统,属于云计算领域。一种基于Docker的镜像同步方法,该方法包括:分析源节点待同步镜像与目标节点镜像间的镜像层级,得到待同步层信息;根据该待同步层信息,在该源节点待同步镜像中打包该待同步层,发送至该目标节点;该目标节点接收到该源节点发送的待同步层,加载到Docker进行同步。本发明还提供一种基于Docker的镜像同步装置及系统。通过本发明提供的一种基于Docker的镜像同步级方法、装置及系统,可以解决在离线方式下进行镜像同步时打包的镜像体积过于庞大的问题,可显著提高镜像的同步效率。

Description

说明书 发明名称:一种基于 Docker的镜像同步方法、 装置及系统 技术领域
[0001] 本发明涉及云计算领域, 尤其涉及一种基于 Docker镜像同步的方法、 装置及系 统。
背景技术
[0002] 随着云计算的迅猛发展, 容器技术的使用日趋增多, Docker是容器技术的一种 实现方式, 它提供了一个能够方便管理容器的工具并形成标准, 目前 Docker也是 使用最多的容器管理工具。 在传统的部署模式下, 运维人员上线一个应用服务 时, 需要在物理机上进行一系列复杂的操作才能完成应用部署, 运维人员首先 需要在物理机上安装应用服务所需要的环境, 然后对应用进行各种配置, 最后 才能完成应用的部署。 如果安装环境稍有不同就会导致应用无法成功部署。 而 D ocker则颠覆了这一传统模式, Docker将应用的整个开发环境打包成一个 Docker 镜像 (Docker Image) 运维人员直接运行该 Docker Image即可, 整个过程简化 为打包、 传送和运行, 避免了由于运维环境与开发环境不一致导致应用部署失 败的问题, 提高了应用部署的效率。
[0003] 目前 Docker镜像的传递和分发主要有在线和离线两种方式。 其中, 离线方式是 将一个完整镜像打成 tar包, 然后将整个 tar包发送到目标节点, 在目标节点通过 L oad的方式进行加载, 实现镜像的分发与同步。
[0004] 因此要实现两个节点之间的镜像同步, 使用离线方式, 需要在源节点将镜像打 包, 然后将镜像包完整的传输到目标节点上, 再进行加载, 实现镜像同步。
[0005] 但这种离线同步的方法, 虽然能够实现目标节点与源节点之间的镜像同步, 但 是仍存在以下不足: 离线方式需要将完整的镜像打成一个 tar包, 在镜像只涉及 部分修改时, 未修改的部分也会被打入 tar包中, 增加了镜像的体积, 不利于镜 像的传输。
[0006] 鉴于此, 有必要提供一种新的镜像同步方法, 以解决上述离线方式进行镜像同 步时, 打包的镜像体积过于庞大的问题。 发明概述
技术问题
[0007] 有鉴于此, 本发明要解决的技术问题是提供一种基于 Docker的镜像同步方法、 装置及系统, 可以解决在离线方式下进行镜像同步时打包的镜像体积过于庞大 的问题, 可显著提高镜像的同步效率。
问题的解决方案
技术解决方案
[0008] 为了解决上述技术问题, 本发明提供一种基于 Docker的镜像同步方法, 该方法 包括:
[0009] 分析源节点待同步镜像与目标节点镜像间的镜像层级, 得到待同步层信息;
[0010] 根据该待同步层信息, 在该源节点待同步镜像中打包该待同步层, 发送至该目 标节点;
[0011] 该目标节点接收到该源节点发送的待同步层, 加载到 Docker进行同步。
[0012] 其中, 分析源节点待同步镜像与目标节点镜像间的镜像层级, 得到待同步层信 息; 包括:
[0013] 采集目标节点的所有镜像的镜像层级数据, 形成结构化数据;
[0014] 采集源节点待同步镜像的镜像层级数据, 形成结构化数据;
[0015] 将该源节点待同步镜像层级数据与该目标节点镜像层级数据进行匹配, 得到待 同步层信息。
[0016] 其中, 将该源节点待同步镜像层级数据与该目标节点镜像层级数据进行匹配, 得到待同步层信息, 包括: 将该源节点待同步镜像的层级数据在该目标节点镜 像层级数据中查找, 如果该层级数据存在, 则该层级不需要同步; 如果该层级 数据不存在, 则该层级需要同步, 将该层加入待同步层信息中。
[0017] 其中, 将该源节点待同步镜像层级数据与该目标节点镜像层级数据进行匹配, 得到待同步层信息, 包括: 该待同步镜像包括多个层级时, 采用遍历层级方式 进行处理, 即按以下层级数据同步方式处理完成一个层级后再遍历下一个层级 , 直至遍历所有层级完成同步为止; 其中, 该层级数据同步方式为: 将该源节 点待同步镜像的层级数据在该目标节点镜像层级数据中查找, 如该层级数据存 在, 则该层级不需要同步; 如该层级数据不存在, 则该层级需要同步, 将该层 加入待同步层信息中。
[0018] 其中, 将该源节点待同步镜像层级数据与该目标节点镜像层级数据进行匹配, 得到待同步层信息, 包括: 该源节点包括多个待同步镜像时, 采用循环遍历所 有待同步镜像方式进行处理, 即处理完成一个待同步镜像的层级数据同步后再 遍历下一个待同步镜像, 直至遍历所有待同步镜像完成同步为止。
[0019] 其中, 根据该待同步层信息, 在该源节点待同步镜像中打包该待同步层, 发送 至该目标节点; 包括: 根据待同步层信息, 在该源节点待同步镜像中仅将与该 待同步层信息中对应的待同步层打包; 将打包后的该待同步层发送至目标节点
[0020] 其中, 该目标节点接收到该源节点发送的该待同步层, 加载到 Docker进行同步 , 包括: 该目标节点接收并解包该源节点发送过来的该待同步层; 将该待同步 层加载到 Docker中进行同步。
[0021] 为了解决上述技术问题, 本发明提供还一种基于 Docker的镜像同步装置, 该装 置包括: 分析模块、 打包模块和加载模块。 其中:
[0022] 该分析模块, 用于分析源节点待同步镜像与目标节点镜像之间的镜像层级, 得 到待同步层信息;
[0023] 该打包模块, 用于根据该待同步层信息, 在该源节点待同步镜像中打包该待同 步层, 发送至该目标节点;
[0024] 该加载模块, 用于该目标节点接收到该源节点发送的该待同步层, 加载到 Dock er进行同步。
[0025] 其中, 该分析模块, 具体用于: 采集目标节点的所有镜像的镜像层级数据, 形 成结构化数据; 采集源节点待同步镜像的镜像层级数据, 形成结构化数据; 将 该源节点待同步镜像层级数据与该目标节点镜像层级数据进行匹配, 得到待同 步层彳習息。
[0026] 其中, 将该源节点待同步镜像层级数据与该目标节点镜像层级数据进行匹配, 得到待同步层信息, 包括: 将该源节点待同步镜像的层级数据在该目标节点镜 像层级数据中查找, 如果该层级数据存在, 则该层级不需要同步; 如果该层级 数据不存在, 则该层级需要同步, 将该层加入待同步层信息中。
[0027] 其中, 将该源节点待同步镜像层级数据与该目标节点镜像层级数据进行匹配, 得到待同步层信息, 包括: 该待同步镜像包括多个层级时, 采用遍历层级方式 进行处理, 即按以下层级数据同步方式处理完成一个层级后再遍历下一个层级 , 直至遍历所有层级完成同步为止; 该层级数据同步方式为: 将该源节点待同 步镜像的层级数据在该目标节点镜像层级数据中查找, 如果该层级数据存在, 则该层级不需要同步; 如果该层级数据不存在, 则该层级需要同步, 将该层加 入待同步层信息中。
[0028] 其中, 将该源节点待同步镜像层级数据与该目标节点镜像层级数据进行匹配, 得到待同步层信息, 包括: 该源节点包括多个待同步镜像时, 采用循环遍历所 有待同步镜像方式进行处理, 即处理完成一个待同步镜像的层级数据同步后再 遍历下一个待同步镜像, 直至遍历所有待同步镜像完成同步为止。
[0029] 其中, 该打包模块, 具体用于: 根据待同步层信息, 在该源节点待同步镜像中 仅将与该待同步层信息中对应的待同步层打包; 将打包后的该待同步层发送至 目标节点。
[0030] 其中, 该加载模块, 具体用于: 该目标节点接收并解包该源节点发送过来的该 待同步层, 将该待同步层加载到 Docker中进行同步。
[0031] 为了解决上述技术问题, 本发明提供还一种基于 Docker的镜像同步系统, 该系 统包括: 源节点、 目标节点和同步装置; 其中: 该同步装置用于将该源节点的 待同步镜像同步到该目标节点中。
发明的有益效果
有益效果
[0032] 本发明提供的一种基于 Docker的镜像同步方法、 装置及系统, 通过将源节点待 同步镜像和目标节点镜像的镜像层级形成结构化数据, 将该源节点待同步镜像 层级数据与该目标节点镜像层级数据进行匹配, 得到该源节点待同步镜像与该 目标节点镜像之间的缺失层数据, 得到待同步层信息, 然后在源节点待同步镜 像中仅将与该待同步层信息中对应的待同步层打包, 发送至目标节点, 目标节 点接收并解包源节点发送过来的待同步层, 将该待同步层加载到 Docker中进行同 步, 与其自身的公共层合并组装, 形成目标节点镜像, 从而完成目标节点镜像 与源节点待同步镜像之间的镜像同步; 这样可以解决在离线方式下进行镜像同 步时打包的镜像体积过于庞大的问题, 可显著提高镜像的同步效率。 此外, 本 发明提供的一种基于 Docker的镜像同步级方法、 装置及系统, 也可以达到以下有 益效果:
[0033] ( 1) 本发明采用的镜像层级数据结构化存储方法可以快速有效的记录镜像的 层级关系, 便于后续算法对镜像进行比对, 获取差异镜像层。
[0034] (2) 本发明提出的镜像层的同步方法可以实现高效的镜像比对, 能显著提高 获取差异镜像层的速度。
[0035] (3) 本发明提出的镜像同步的整个流程和方法在 docker镜像离线同步场景下可 以实现离线镜像的快速同步, 与现有技术相比, 节省了同步的时间, 提高了镜 像同步的效率。
对附图的简要说明
附图说明
[0036] 图 1表示发明提供的一种基于 Docker的镜像同步方法的流程图;
[0037] 图 2表示本发明提供的涉及的源节点和目标节点镜像 A/B/C/D的镜像树形层级结 构图;
[0038] 图 3表示本发明提供的所涉及的目标节点镜像 B的镜像层级结构图;
[0039] 图 4表示本发明提供的一种基于 Docker的镜像同步方法的具体流程图;
[0040] 图 5表示本发明提供的一种基于 Docker的镜像同步装置的结构示意图;
[0041] 图 6表示本发明提供的一种基于 Docker的镜像同步系统的结构示意图。
发明实施例
本发明的实施方式
[0042] 下面将参照附图更详细地描述本发明的示例性实施例。 虽然附图中显示了本发 明的示例性实施例, 然而应当理解, 可以以各种形式实现本发明而不应被这里 阐述的实施例所限制。 相反, 提供这些实施例是为了能够更透彻地理解本发明 , 并且能够将本发明的范围完整的传达给本领域的技术人员。
[0043] [0044] 请参考图 1。 本发明提供一种基于 Docker的容器云镜像的同步方法, 该方法包 括:
[0045] 步骤 S1、 分析源节点待同步镜像与目标节点镜像之间的镜像层级, 得到待同步 层信息;
[0046] 步骤 S2、 根据该待同步层信息, 在该源节点待同步镜像中打包该待同步层, 发 送至该目标节点;
[0047] 步骤 S3、 该目标节点接收该源节点发送的待同步层, 加载到 Docker中进行同步
[0048] 其中, 在步骤 S1中, 分析源节点待同步镜像与目标节点镜像之间的镜像层级, 得到待同步层信息; 具体包括:
[0049] 1) 采集目标节点的所有镜像的镜像层级数据, 形成结构化数据;
[0050] 2) 采集源节点待同步镜像的镜像层级数据, 形成结构化数据;
[0051] 3) 将该源节点待同步镜像层级数据与该目标节点镜像层级数据进行匹配, 得 到该源节点待同步镜像与该目标节点镜像之间的缺失层数据, 得到待同步层信 息。 包括:
[0052] 将该源节点待同步镜像的层级数据在该目标节点镜像层级数据中查找, 如果该 层级数据存在, 则说明该层在目标节点已经存在, 该层不需要同步; 如果该层 级数据不存在, 则说明该层在目标节点尚未存在, 该层需要同步, 需要将该层 加入待同步层信息中。 以上处理方式即为层级数据同步方式。
[0053] 如果源节点包括多个待同步镜像时, 采用循环遍历所有待同步镜像方式进行处 理, 即按以上层级数据同步方式处理完成一个待同步镜像的层级数据同步后再 遍历下一个待同步镜像, 直至遍历所有待同步镜像完成同步为止; 当待同步镜 像包括多个层级结构时, 采用从顶到下依次遍历层级结构方式进行处理, 即按 以上层级数据同步方式处理完成一个层级后再遍历下一个层级, 直至遍历所有 层级结构完成同步为止, 则说明该待同步镜像的层级匹配已经完成, 再转入继 续处理下一个待同步镜像。
[0054] 其中, 在步骤 S2中, 根据该待同步层信息, 在该源节点待同步镜像中打包该待 同步层, 发送至该目标节点; 具体包括: [0055] 根据待同步层信息, 在源节点待同步镜像中仅将与该待同步层信息中对应的待 同步层打包;
[0056] 将打包后的该待同步层发送至目标节点进行镜像同步。
[0057] 其中, 在步骤 S3中, 该目标节点接收该源节点发送的待同步层, 加载到 Docker 中进行同步; 具体包括:
[0058] 该目标节点接收并解包源节点发送过来的待同步层; 将该待同步层加载到 Dock er中进行同步, 与其自身的公共层合并组装, 形成目标节点镜像, 从而完成目标 节点镜像与源节点待同步镜像之间的镜像同步。
[0059] 下面以一个具体的实施例来对以上本发明的技术方案作进一步的说明。
[0060] 在本实施例中, 源节点有镜像 A/B/C/D。 源节点的镜像层级结构如图 2所示。 其 中, 镜像 A由层 31/21/11/01共四层组成, 镜像 B由层 32/21/11/01组成, 镜像 C由层 12/01共两层组成, 镜像 D由层 13/02共两层组成。 镜像 A和 B可以看做是同一应用 的两个版本, 因此镜像 A和镜像 B具有相同的公共层 21/11/01, 而区别主要在于最 后一层加入了不同版本的代码。 镜像 A和镜像 C/D可以看做是不同应用的镜像, 他们可能有相同的层, 也可能没有。
[0061] 目标节点只有镜像 B, 目标节点的镜像层级结构如图 3所示。
[0062] 在源节点与目标节点进行镜像同步时, 由于目标节点与源节点相比, 具有相同 的镜像 B, 所以, 双方可以复用镜像 B的层 21/11/01。 即: 如果需要从源节点向目 标节点同步镜像 A, 因为目标节点已经有了镜像 B, 镜像 B的层可以作为公共层 , 可以复用镜像 B的层 21/11/01, 并不需要同步所有的层 31/21/11/01, 因此需要 同步镜像 A时, 只需要同步两者的缺失层即可, 即只需要同步层 31即可。 同理, 同步镜像 C只需要同步层 12。 而同步镜像 D时, 由于目标节点没有任何可用的公 共层, 因此需要同步所有的层 02/13。
[0063] 本发明对镜像的层级数据进行结构化存储, 规定镜像从下向上为父子管理, 即 下一层是上一层的父层, 最底层的层为根层, 其父层为空, 镜像名只标注在最 上层。 镜像的层级数据存储结构如下表所示:
[] [表 1]
Figure imgf000010_0001
[0064]
[0065] 因此, 镜像 B的存储结构为:
[] [表 2]
Figure imgf000010_0002
[0066]
[0067] 请参考图 4。 本发明提供一种基于 Docker的容器云镜像的同步方法, 可以同步 从源节点向目标节点全部镜像, 或只同步部分镜像; 该同步方法的具体步骤如 下:
[0068] 步骤 S11 : 初始化待同步层列表 list为空。
[0069] 步骤 S12: 获取目标节点的所有镜像的镜像层级数据 target_layerS
[0070] 步骤 S 13 : 获取需要同步的镜像名列表 sync_images。
[0071] 步骤 S14: sync_images遍历待同步镜像 Image, 如果全部同步完成, 则转向 S20
[0072] 步骤 S15: 从镜像名列表 sync_images中依次获取待同步镜像 Image。
[0073] 步骤 S16: 获取该待同步镜像 Image的层级结构。
[0074] 步骤 S17: 从顶到下依次遍历每一层 ID, 如果全部层 ID遍历完成, 则转向步骤 S
21。
[0075] 步骤 S 18 : 从该待同步镜像 Image层级结构依次获取镜像 Image层 ID。
[0076] 步骤 S19: 将该层 ID在目标节点的镜像层级数据 target_layerS中查找, 如果该层 I D存在, 则说明该层在目标节点已经存在, 不需要同步; 如果该层 ID不存在, 则 说明该层在目标节点尚未存在, 需要同步, 贝 U将该层 ID加入待同步层列表 list中 (步骤 S20) , 继续循环步骤 S17至步骤 S20, 完成下一层 ID的遍历匹配。 如果所 有层 ID都遍历完成, 则该 Image的层级匹配已经完成, 转向步骤 S14, 继续进行 下一个待同步镜像 Image的同步。
[0077] 步骤 S21 : 结束待同步层列表的匹配, 获取所有的待同步层列表 list。
[0078] 步骤 S22: 获取了待同步层列表 list后在源节点根据 list, 将 list中仅对应的待同步 层进行打包, 发送至该目标节点。
[0079] 步骤 S23: 该目标节点对接收到的待同步层进行解包后, 将对应待同步层加载 到 Docker中, 即可完成离线镜像同步。
[0080] 其中, 当源节点和目标节点不能直接相连的时候, 可以首先从目标节点获取镜 像层级数据, 然后将目标节点的镜像层级数据通过某种方式发送到源节点, 由 源节点根据以上流程, 对待同步层进行打包, 然后将打包的镜像通过某种方式 发送到目标节点, 由目标节点再进行解包及对相应待同步层的加载, 完成镜像 同步。
[0081] 下面再以图 2为例, 对以上本发明提供的一种基于 Docker的容器云镜像的同步 方法作进一步的说明。
[0082] 在图 2中, 目标节点包括有镜像 A、 镜像 B和镜像 D, 现在需要将镜像 C同步到 目标节点, 具体步骤为:
[0083] 步骤 1 : 初始化待同步的层列表 list为空;
[0084] 步骤 2: 获取目标节点的所有镜像的镜像层级数据 target_layers: [31, 21, 11, 01, 32, 13, 02];
[0085] 步骤 3: 获取需要同步的镜像名列表 syncjmages: [镜像 C];
[0086] 步骤 4: 从镜像名列表 sync_images中依次获取待同步镜像 Image[镜像 C], 如果 全部同步完成, 则转向步骤 7 ;
[0087] 步骤 5: 获取该待同步镜像 Image[镜像 C]的层级结构[12, 01];
[0088] 步骤 6: 从顶到下依次遍历每一层 ID。 层 12在 target_layers中不存在, 则将该层 1 2的 ID加入待同步层列表 list中, 层 01在 target_layers中存在, 不需要同步, 不做处 理。 镜像 C只有层 [12, 01]两层, 遍历完成, 转向步骤 4, 继续下一个待同步镜像 Image的遍历。
[0089] 步骤 7: 结束待同步层列表的匹配, 获取所有待同步层列表 list: [12]。
[0090] 步骤 8: 获取了待同步层列表 list[12]后在源节点根据 list, 将待同步镜像 C中仅 对应的待同步层 [12]进行打包, 发送至该目标节点。
[0091] 步骤 9: 该目标节点对接收到的待同步层 [12]进行解包后, 将对应待同步层 [12] 加载到 Docker中, 即可完成离线镜像同步。
[0092] 请参考图 5。 本发明提供一种基于 Docker的容器云镜像的同步装置, 该同步装 置 100包括: 分析模块 10、 打包模块 20和加载模块 30。 其中:
[0093] 该分析模块 10, 用于分析源节点待同步镜像与目标节点镜像之间的镜像层级, 得到待同步层信息;
[0094] 该打包模块 20, 用于根据该待同步层信息, 在该源节点待同步镜像中打包该待 同步层, 发送至该目标节点;
[0095] 该加载模块 30, 用于该目标节点接收该源节点发送的待同步层, 加载到 Docker 中进行同步。
[0096] 其中, 该分析模块 10, 具体用于:
[0097] 1) 采集目标节点的所有镜像的镜像层级数据, 形成结构化数据;
[0098] 2) 采集源节点待同步镜像的镜像层级数据, 形成结构化数据;
[0099] 3) 将该源节点待同步镜像层级数据与该目标节点镜像层级数据进行匹配, 得 到该源节点待同步镜像与该目标节点镜像之间的缺失层数据, 得到待同步层信 息。 包括:
[0100] 将该源节点待同步镜像的层级数据在该目标节点镜像层级数据中查找, 如果该 层级数据存在, 则说明该层在目标节点已经存在, 该层不需要同步; 如果该层 级数据不存在, 则说明该层在目标节点尚未存在, 该层需要同步, 需要将该层 加入待同步层信息中。 以上处理方式即为层级数据同步方式。
[0101] 如果源节点包括多个待同步镜像时, 采用循环遍历待同步镜像方式进行处理, 即按以上层级数据同步方式处理完成一个待同步镜像的层级数据同步后再遍历 下一个待同步镜像, 直至遍历所有待同步镜像完成同步为止; 当待同步镜像包 括多个层级结构时, 采用从顶到下依次遍历层级结构方式进行处理, 即按以上 层级数据同步方式处理完成一个层级后再遍历下一个层级, 直至遍历所有层级 结构完成同步为止, 则说明该待同步镜像的层级匹配已经完成, 再转入继续处 理下一个待同步镜像。
[0102] 其中, 该打包模块 20, 具体用于:
[0103] 根据待同步层信息, 在源节点待同步镜像中仅将与该待同步层信息中对应的待 同步层打包;
[0104] 将打包后的该待同步层发送至目标节点进行镜像同步。
[0105] 其中, 该加载模块 30, 具体用于:
[0106] 该目标节点接收并解包源节点发送过来的待同步层; 将该待同步层加载到 Dock er中进行同步, 与其自身的公共层合并组装, 形成目标节点镜像, 从而完成目标 节点镜像与源节点待同步镜像之间的镜像同步。
[0107] 请参考图 6。 本发明提供一种基于 Docker的容器云镜像的同步系统, 该同步系 统包括: 源节点 200、 同步装置 100和目标节点 300; 其中: 该同步装置 100用于 将该源节点 200的待同步镜像同步到该目标节点 300中。
[0108] 其中, 该同步装置 100的结构组成和功能与上面描述的同步装置 100是一致, 在 此, 对于同步装置 100的结构组成和功能不再重复描述。
[0109] 本发明提供的一种基于 Docker的镜像同步方法、 装置及系统, 通过将源节点待 同步镜像和目标节点镜像的镜像层级形成结构化数据, 将该源节点待同步镜像 层级数据与该目标节点镜像层级数据进行匹配, 得到该源节点待同步镜像与该 目标节点镜像之间的缺失层数据, 得到待同步层信息, 然后在源节点待同步镜 像中仅将与该待同步层信息中对应的待同步层打包, 发送至目标节点, 目标节 点接收并解包源节点发送过来的待同步层, 将该待同步层加载到 Docker中进行同 步, 与其自身的公共层合并组装, 形成目标节点镜像, 从而完成目标节点镜像 与源节点待同步镜像之间的镜像同步; 这样可以解决在离线方式下进行镜像同 步时打包的镜像体积过于庞大的问题, 可显著提高镜像的同步效率。
[0110] 以上的是本发明的优选实施方式, 应当指出对于本技术领域的普通人员来说, 在不脱离本发明的原理前提下还可以作出若干改进和润饰, 这些改进和润饰也 在本发明的保护范围内。 。
工业实用性
[0111] 本发明提供的一种基于 Docker的镜像同步方法、 装置及系统, 通过将源节点待 同步镜像和目标节点镜像的镜像层级形成结构化数据, 将该源节点待同步镜像 层级数据与该目标节点镜像层级数据进行匹配, 得到该源节点待同步镜像与该 目标节点镜像之间的缺失层数据, 得到待同步层信息, 然后在源节点待同步镜 像中仅将与该待同步层信息中对应的待同步层打包, 发送至目标节点, 目标节 点接收并解包源节点发送过来的待同步层, 将该待同步层加载到 Docker中进行同 步, 与其自身的公共层合并组装, 形成目标节点镜像, 从而完成目标节点镜像 与源节点待同步镜像之间的镜像同步; 这样可以解决在离线方式下进行镜像同 步时打包的镜像体积过于庞大的问题, 可显著提高镜像的同步效率, 大大提高 地运维人员应用部署的效率。

Claims

权利要求书
[权利要求 1] 一种基于 Docker的镜像同步方法, 该方法包括:
分析源节点待同步镜像与目标节点镜像间的镜像层级, 得到待同步层 信息;
根据该待同步层信息, 在该源节点待同步镜像中打包该待同步层, 发 送至该目标节点;
该目标节点接收到该源节点发送的待同步层, 加载到 Docker进行同步
[权利要求 2] 根据权利要求 1所述的方法, 其中, 分析源节点待同步镜像与目标节 点镜像间的镜像层级, 得到待同步层信息; 包括: 采集目标节点的所有镜像的镜像层级数据, 形成结构化数据; 采集源节点待同步镜像的镜像层级数据, 形成结构化数据; 将该源节点待同步镜像层级数据与该目标节点镜像层级数据进行匹配 , 得到待同步层信息。
[权利要求 3] 根据权利要求 2所述的方法, 其中, 将该源节点待同步镜像层级数据 与该目标节点镜像层级数据进行匹配, 得到待同步层信息, 包括: 将该源节点待同步镜像的层级数据在该目标节点镜像层级数据中查找 , 如果该层级数据存在, 则该层级不需要同步; 如果该层级数据不存 在, 则该层级需要同步, 将该层加入待同步层信息中。
[权利要求 4] 根据权利要求 3所述的方法, 其中, 将该源节点待同步镜像层级数据 与该目标节点镜像层级数据进行匹配, 得到待同步层信息, 包括: 该待同步镜像包括多个层级时, 采用遍历层级方式进行处理, 即按以 下层级数据同步方式处理完成一个层级后再遍历下一个层级, 直至遍 历所有层级完成同步为止; 其中, 该层级数据同步方式为: 将该源节 点待同步镜像的层级数据在该目标节点镜像层级数据中查找, 如该层 级数据存在, 则该层级不需要同步; 如该层级数据不存在, 则该层级 需要同步, 将该层加入待同步层信息中。
[权利要求 5] 根据权利要求 3或 4所述的方法, 其中, 将该源节点待同步镜像层级数 据与该目标节点镜像层级数据进行匹配, 得到待同步层信息, 包括: 该源节点包括多个待同步镜像时, 采用循环遍历所有待同步镜像方式 进行处理, 即处理完成一个待同步镜像的层级数据同步后再遍历下一 个待同步镜像, 直至遍历所有待同步镜像完成同步为止。
[权利要求 6] 根据权利要求 1所述的方法, 其中, 根据该待同步层信息, 在该源节 点待同步镜像中打包该待同步层, 发送至该目标节点; 包括: 根据待同步层信息, 在该源节点待同步镜像中仅将与该待同步层信息 中对应的待同步层打包;
将打包后的该待同步层发送至目标节点。
[权利要求 7] 根据权利要求 1所述的方法, 其中, 该目标节点接收到该源节点发送 的该待同步层, 加载到 Docker进行同步, 包括: 该目标节点接收并解包该源节点发送过来的该待同步层;
将该待同步层加载到 Docker中进行同步。
[权利要求 8] 一种基于 Docker的镜像同步装置, 该装置包括: 分析模块、 打包模块 和加载模块, 其中: 该分析模块, 用于分析源节点待同步镜像与目标 节点镜像之间的镜像层级, 得到待同步层信息; 该打包模块, 用于根据该待同步层信息, 在该源节点待同步镜像中打 包该待同步层, 发送至该目标节点;
该加载模块, 用于该目标节点接收到该源节点发送的该待同步层, 加 载到 Docker进行同步。
[权利要求 9] 根据权利要求 8所述的装置, 其中, 该分析模块, 具体用于:
采集目标节点的所有镜像的镜像层级数据, 形成结构化数据; 采集源节点待同步镜像的镜像层级数据, 形成结构化数据; 将该源节点待同步镜像层级数据与该目标节点镜像层级数据进行匹配 , 得到待同步层信息。
[权利要求 10] 根据权利要求 10所述的装置, 其中, 将该源节点待同步镜像层级数据 与该目标节点镜像层级数据进行匹配, 得到待同步层信息, 包括: 该待同步镜像包括多个层级时, 采用遍历层级方式进行处理, 即按以 下层级数据同步方式处理完成一个层级后再遍历下一个层级, 直至遍 历所有层级完成同步为止; 该层级数据同步方式为: 将该源节点待同 步镜像的层级数据在该目标节点镜像层级数据中查找, 如果该层级数 据存在, 则该层级不需要同步; 如果该层级数据不存在, 则该层级需 要同步, 将该层加入待同步层信息中。
[权利要求 11] 根据权利要求 10所述的装置, 其中, 将该源节点待同步镜像层级数据 与该目标节点镜像层级数据进行匹配, 得到待同步层信息, 包括: 该待同步镜像包括多个层级时, 采用遍历层级方式进行处理, 即按以 下层级数据同步方式处理完成一个层级后再遍历下一个层级, 直至遍 历所有层级完成同步为止; 该层级数据同步方式为: 将该源节点待同 步镜像的层级数据在该目标节点镜像层级数据中查找, 如果该层级数 据存在, 则该层级不需要同步; 如果该层级数据不存在, 则该层级需 要同步, 将该层加入待同步层信息中。
[权利要求 12] 根据权利要求 10或 11所述的装置, 其中, 将该源节点待同步镜像层级 数据与该目标节点镜像层级数据进行匹配, 得到待同步层信息, 包括 该源节点包括多个待同步镜像时, 采用循环遍历所有待同步镜像方式 进行处理, 即处理完成一个待同步镜像的层级数据同步后再遍历下一 个待同步镜像, 直至遍历所有待同步镜像完成同步为止。
[权利要求 13] 根据权利要求 8所述的装置, 其中, 该打包模块, 具体用于:
根据待同步层信息, 在该源节点待同步镜像中仅将与该待同步层信息 中对应的待同步层打包; 将打包后的该待同步层发送至目标节点。
[权利要求 14] 根据权利要求 8所述的装置, 其中, 该加载模块, 具体用于:
该目标节点接收并解包该源节点发送过来的该待同步层, 将该待同步 层加载到 Docker中进行同步。
[权利要求 15] 一种基于 Docker的镜像同步系统, 该系统包括: 源节点、 目标节点和 如权利要求 8至 14任一项所述的同步装置; 其中: 该同步装置用于将 该源节点的待同步镜像同步到该目标节点中。
PCT/CN2018/077321 2018-02-27 2018-02-27 一种基于Docker的镜像同步方法、装置及系统 WO2019165573A1 (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
PCT/CN2018/077321 WO2019165573A1 (zh) 2018-02-27 2018-02-27 一种基于Docker的镜像同步方法、装置及系统

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2018/077321 WO2019165573A1 (zh) 2018-02-27 2018-02-27 一种基于Docker的镜像同步方法、装置及系统

Publications (1)

Publication Number Publication Date
WO2019165573A1 true WO2019165573A1 (zh) 2019-09-06

Family

ID=67804752

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/077321 WO2019165573A1 (zh) 2018-02-27 2018-02-27 一种基于Docker的镜像同步方法、装置及系统

Country Status (1)

Country Link
WO (1) WO2019165573A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2021077906A1 (zh) * 2019-10-23 2021-04-29 中兴通讯股份有限公司 微服务升级文件发送方法、接收方法、设备及存储介质

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160381075A1 (en) * 2015-06-29 2016-12-29 Vmware, Inc. Methods and apparatus for generating and using security assertions associated with containers in a computing environment
WO2017113374A1 (zh) * 2015-12-31 2017-07-06 华为技术有限公司 镜像部署方法和装置
CN107247793A (zh) * 2017-06-21 2017-10-13 平安科技(深圳)有限公司 Docker镜像仓库的镜像同步方法和镜像同步系统
CN107426258A (zh) * 2016-05-23 2017-12-01 华为技术有限公司 一种镜像文件的上传和下载方法及装置
CN107704593A (zh) * 2017-10-12 2018-02-16 成都知道创宇信息技术有限公司 一种检测并解决Docker本地镜像与远程仓库镜像冲突的方法

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160381075A1 (en) * 2015-06-29 2016-12-29 Vmware, Inc. Methods and apparatus for generating and using security assertions associated with containers in a computing environment
WO2017113374A1 (zh) * 2015-12-31 2017-07-06 华为技术有限公司 镜像部署方法和装置
CN107426258A (zh) * 2016-05-23 2017-12-01 华为技术有限公司 一种镜像文件的上传和下载方法及装置
CN107247793A (zh) * 2017-06-21 2017-10-13 平安科技(深圳)有限公司 Docker镜像仓库的镜像同步方法和镜像同步系统
CN107704593A (zh) * 2017-10-12 2018-02-16 成都知道创宇信息技术有限公司 一种检测并解决Docker本地镜像与远程仓库镜像冲突的方法

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2021077906A1 (zh) * 2019-10-23 2021-04-29 中兴通讯股份有限公司 微服务升级文件发送方法、接收方法、设备及存储介质

Similar Documents

Publication Publication Date Title
CN104320459B (zh) 一种节点管理方法和装置
CN106649496B (zh) 一种政务数据采集共享系统与方法
WO2019154394A1 (zh) 分布式数据库集群系统、数据同步方法及存储介质
CN104090891B (zh) 数据处理方法、装置及系统
CN105607954A (zh) 一种有状态容器在线迁移的方法和装置
CN108509253A (zh) 一种快速发布大量容器镜像的方法
CN101035131A (zh) 协议识别方法及装置
CN107634984A (zh) 一种基于单向传输通道的文件同步方法
CN109756461A (zh) 一种基于netty的远程过程调用方法
WO2017113694A1 (zh) 文件同步方法、装置及系统
WO2014000698A1 (zh) 基于ip层的网络拓扑识别方法和设备
WO2019223178A1 (zh) 跨平台任务调度方法、系统、计算机设备和存储介质
CN113315754B (zh) 容器出访防火墙智能联动方法及装置、设备、介质
CN108989430A (zh) 负载均衡方法、装置及存储介质
WO2019165573A1 (zh) 一种基于Docker的镜像同步方法、装置及系统
CN108363611A (zh) 虚拟机的安全管理方法、装置及全方位虚拟化系统
CN113630301B (zh) 基于智能决策的数据传输方法、装置、设备及存储介质
KR20170088950A (ko) 검색 엔진으로 웹 사이트 인증 데이터를 제공하기 위한 방법 및 장치
US9003054B2 (en) Compressing null columns in rows of the tabular data stream protocol
CN111026455A (zh) 插件生成方法、电子设备及存储介质
CN112380195B (zh) 一种基于事务时序有向图的sql交互数据预处理方法与装置
CN109804365A (zh) 弹性地理数据库复制方法
US11037297B2 (en) Image analysis method and device
CN107609197B (zh) 一种数据同步方法、数据同步装置及移动终端
CN114374701A (zh) 一种多级联动人工智能平台样本模型透明共享装置

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: 18907819

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 18907819

Country of ref document: EP

Kind code of ref document: A1