WO2018233370A1 - Method, system, device, and computer readable storage medium for synchronizing image - Google Patents

Method, system, device, and computer readable storage medium for synchronizing image Download PDF

Info

Publication number
WO2018233370A1
WO2018233370A1 PCT/CN2018/083947 CN2018083947W WO2018233370A1 WO 2018233370 A1 WO2018233370 A1 WO 2018233370A1 CN 2018083947 W CN2018083947 W CN 2018083947W WO 2018233370 A1 WO2018233370 A1 WO 2018233370A1
Authority
WO
WIPO (PCT)
Prior art keywords
image
warehouse
event
cloud management
control unit
Prior art date
Application number
PCT/CN2018/083947
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 WO2018233370A1 publication Critical patent/WO2018233370A1/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/178Techniques for file synchronisation in file systems
    • 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 field of Docker technology, and specifically relates to a mirror synchronization method of a Docker image repository, a mirror synchronization system, a device, and a computer readable storage medium.
  • Docker (Docker Is an open source application container engine that allows developers to package their applications and dependencies into a portable container and then publish them to any popular Linux On the machine, virtualization can also be implemented.
  • the container technology provided allows several containers to be run on the same host or virtual machine, each container being a separate virtual environment or application.
  • Container from Docker Mirroring which can be generated by the user or submitted by the running container. After the image is generated, it can be pushed to the image repository for saving, or pulled from the mirror repository. Go to the local to run the container.
  • Docker provides an official image repository (Docker hub), while allowing users to build their own private image repository (private Registry). For most organizations and organizations, it is necessary to use a private image repository to protect the mirrored content and use of the repository.
  • Mirrors are stored in the file system as tiered storage. Different images may share some layers to save storage space. For warehouse construction involving multi-regional user access, mirror synchronization is a must-have when unified management of the image is required to ensure that the scope of the image used by the user is not limited to a certain area.
  • Mirror synchronization can be implemented by multiple schemes, one of which is shared storage, that is, a registry of multiple areas mounts a shared network storage disk, so that each time a mirror is pushed to a certain area of the registry. All the warehouses are immediately synchronized. However, sometimes the multi-region registry cannot share storage, and the networks between the regions cannot access each other, that is, the regions are isolated.
  • the present application provides a mirror synchronization method, a mirror synchronization system, a device, and a computer-readable storage medium of a Docker image warehouse, which mainly solve the problem that the existing Docker images cannot be synchronized in real time.
  • a mirror synchronization method for a Docker image repository comprising the following steps:
  • the cloud management area warehouse When the cloud management area warehouse receives the image pushed by the warehouse of a certain available area, the cloud control area control unit is notified to receive the mirroring event;
  • the cloud management area control unit resolves the mirror event.
  • the cloud management area warehouse is controlled to synchronize the image to the corresponding available area warehouse.
  • the present application further provides a mirror synchronization system of a Docker image warehouse, where the image synchronization system includes:
  • the cloud management area warehouse is configured to notify the cloud management area control unit to receive the mirroring event when receiving the image pushed by the warehouse of an available area;
  • the cloud management area control unit is configured to parse the mirroring event.
  • the cloud management area warehouse is controlled to synchronize the image to the corresponding available area warehouse.
  • the present application further provides a mirror synchronization device of a Docker image repository, wherein the mirror synchronization device of the Docker image repository includes a memory, a processor, and a storage on the memory and can be The image synchronization program of the Docker image repository running on the processor, the mirror synchronization program of the Docker image repository being executed by the processor to implement the steps of the image synchronization method of the Docker image repository described above.
  • the present application further provides a computer readable storage medium, wherein the computer readable storage medium stores a mirror synchronization program of a Docker image repository, and a mirror synchronization program of the Docker image repository The steps of implementing the image synchronization method of the Docker image repository described above when executed by the processor.
  • the present application discloses a mirror synchronization method and a mirror synchronization system of a Docker image warehouse.
  • the image synchronization method first receives a mirror image pushed by an available area warehouse from the cloud management area warehouse, the cloud control area control unit is notified to receive the mirroring event; The pipe area control unit resolves the mirror event.
  • the cloud control area warehouse is controlled to synchronize the image to the corresponding available area warehouse.
  • This application solves the problem of Docker by setting up a control unit and a warehouse in the cloud management area and each available area, and monitoring the events of the Docker image warehouse to realize the mirror synchronization of the cloud management area and each available area. Mirror real-time synchronization issues.
  • FIG. 1 is a flow chart of a preferred embodiment of a method for mirror synchronization of a Docker image repository provided by the present application.
  • step S200 is a flow chart of a preferred embodiment of step S200 in the image synchronization method of the Docker image repository provided by the present application.
  • FIG. 3 is a schematic diagram of a first application embodiment in a mirror synchronization method of a Docker image repository provided by the present application.
  • FIG. 4 is a schematic diagram of a second application embodiment in a mirror synchronization method of a Docker image repository provided by the present application.
  • FIG. 5 is a schematic diagram of a third application embodiment in a mirror synchronization method of a Docker image repository provided by the present application.
  • FIG. 6 is a functional block diagram of a mirror synchronization system of the Docker image repository of the present application.
  • FIG. 7 is a functional block diagram of a cloud management area control unit in a mirror synchronization system of a Docker image warehouse of the present application.
  • FIG. 1 is a flowchart of a preferred embodiment of a mirror synchronization method of a Docker image repository provided by the present application.
  • the image synchronization method of the Docker image warehouse described in the preferred embodiment of the present application is as follows:
  • the cloud control area control unit When the S100 and the cloud management area warehouse receive the image pushed by the warehouse of an available area, the cloud control area control unit is notified to receive the mirroring event.
  • a control unit and a warehouse are disposed in the cloud management area and each available area, and the cloud management area is one, and the available area is several, which is used to manage the mirror of each available area.
  • the method further comprises: controlling, by an available area control unit, the available area warehouse to push the image to the cloud management area warehouse.
  • the user terminal pushes a mirror to the available area warehouse, triggers the area warehouse to notify the available area control unit to receive the mirroring event, and the available area control unit resolves the mirroring event to determine whether the mirroring event is a pull event or a push event. If it is a push event, the API interface of the available area warehouse is called (Application Programming Interface, the application programming interface) synchronizes the image to the cloud management area repository.
  • step S200 the cloud management area control unit parses the image event.
  • the cloud management area warehouse is controlled to synchronize the image to the corresponding available area warehouse.
  • the cloud management area warehouse is controlled to synchronize the image to the corresponding available area warehouse, thereby realizing the synchronization of each available area image and the cloud management area.
  • FIG. 2 is a flowchart of a preferred embodiment of step S200 in the image synchronization method of the Docker image repository provided by the present application.
  • the step S200 includes:
  • Step S201 The cloud management area control unit parses the mirroring event, and determines whether the mirroring event is a pull event or a push event;
  • Step S202 If the mirroring event is a push event, determine that the mirroring event needs to be synchronized, and call the API interface of the cloud management area warehouse to synchronize the image to the corresponding available area warehouse. When the mirroring event is a pull event, or the mirror exists in the cloud management area warehouse, no synchronization operation is performed.
  • the step S202 includes:
  • S2023 Calling the API interface of the cloud management area warehouse to synchronize the image to each available area warehouse except the free area warehouse pushed to the mirror. When the synchronous mirroring event occurs, the image is not distributed to the free area warehouse that pushes the image.
  • the first application embodiment is exemplified in detail for the mirror synchronization method of the Docker image warehouse of the present application:
  • the cloud management area is a centralized management area, and each available area can be set at different locations.
  • the A free area is set in Shanghai
  • the B free area is set in Beijing
  • the C free area is set in Shenzhen.
  • the A Availability Zone, the B Availability Zone, and the C Availability Zone cannot communicate with each other.
  • the A Availability Zone, the B Availability Zone, and the C Availability Zone can only communicate with the cloud management zone to perform push or pull mirror operations.
  • the first application embodiment of the present application specifically includes:
  • the image is pushed by the user terminal to the A Availability Zone Warehouse
  • Step 2 After receiving the image, the A Availability Zone Warehouse notifies the A Availability Zone Control Unit to receive the mirroring event and store the image;
  • the third step after the A Availability Zone Control Unit resolves the mirror event, and controls the A Availability Zone Warehouse to push the image to the cloud management area warehouse;
  • the cloud control area control unit is notified to receive the mirroring event
  • the cloud management area control unit resolves the mirror event, and when the mirror event is determined to be a push event, the cloud control area warehouse is controlled to synchronize the image to the A free area warehouse, the B free area warehouse, and the C free area warehouse, and when the mirror event is determined to be pulled The mirror event is not processed when the event is fetched.
  • the step S202 further includes: if the mirroring event is a push event, parsing the source of the mirroring event; when the mirroring event is synchronous, the mirroring is not distributed.
  • the free area repository for the image to be pushed is not distributed.
  • the IP of the available area warehouse of the push image is identified, so that the event push source can be accurately determined.
  • step S200 the image synchronization method of the Docker image repository of the present application further includes:
  • Step S300 When each available area warehouse receives the image, notify the available area control unit to receive the mirroring event;
  • Step S400 The available area control unit determines whether the mirroring event is from a cloud management area, and if so, the available area warehouse will not continue to distribute the image.
  • the application prevents the mirror push event from being infinitely looped back, thereby effectively saving network resources.
  • the second application embodiment of the present application specifically includes:
  • the A Availability Zone Warehouse pushes the image to the cloud management area warehouse
  • the cloud control area control unit is notified to receive the mirroring event
  • the third step the cloud management area control unit resolves the mirror event.
  • the mirror event is determined to be a push event, and it is determined that the mirror event needs to be synchronized
  • the source of the push event is analyzed as the A free area warehouse, and the distribution task of the A free area warehouse is analyzed.
  • the cloud management area control unit sends the distribution task to the cloud management area warehouse
  • the cloud management area warehouse distributes the image to the B free area warehouse and the C free area warehouse;
  • the notification B may receive the mirroring event by using the control unit and the C available control unit;
  • the seventh step, B, the control unit and the C available control unit analyze the source of the mirror event as the cloud management area, delete the current push task, no longer distribute, and avoid loopback (ie, avoid pushing the mirror loop).
  • the synchronization fails (for example, when the mirror synchronization occurs, the network termination abnormality causes the mirror synchronization to fail), in order to improve the accuracy of the mirror synchronization, in the mirror synchronization method of the Docker image warehouse of the present application.
  • the cloud management area warehouse periodically pushes all the images to the available area warehouses.
  • the cloud management area control unit controls the cloud management area warehouse to push the image to each available area at two o'clock every morning.
  • the cloud management unit calls the API interface of the source mirror warehouse to push the image to the corresponding available area warehouse, and interacts with the available area warehouse to detect whether the available area warehouse has the pushed image. When the detection image exists, the image is aborted.
  • Each available area warehouse provides a VIP. (Very Important Person, VIP) and port, the area targeting the Availability Zone should push the image to the vip And the port, and when judging the loopback, you should check whether the event source is the real ip and port of the available area warehouse.
  • VIP Very Important Person
  • the cloud management area control unit controls the cloud management area warehouse to synchronize the image to the corresponding available area warehouse, specifically: the cloud management area control unit identifies the real IP of the mirror event, and determines the real IP. Whether it matches the real IP of an available area warehouse, if it is, the distribution task of the available area warehouse is removed, and the image is not pushed to the available area warehouse.
  • the present application uses all the warehouses in each area to provide a vip and a port, and when other areas push the image to the area, the vip and the port are used. Issued.
  • the distribution target is only the cloud management area mirror warehouse VIP and port.
  • the control unit receives the mirror push event, the real-time IP of the mirror event source is used to query whether the IP is the real IP address of the cloud management area mirror warehouse. First, if the cloud management area mirror warehouse VIP is removed from the current distribution task, the target of the current distribution task is empty, and the synchronization mirror is no longer continued.
  • the distribution target includes the VIP and port of each available area mirror warehouse.
  • the cloud control area control unit receives the mirror push event, according to the real IP of the mirror event source, it is queried whether the IP is the real state of an available area mirror warehouse. One of the IPs, if it is, the VIP of the regional mirror warehouse is removed from the current distribution task. At this time, the target of the current distribution task is another available area mirror warehouse, and the source area is no longer synchronized downward, but is synchronized. Other areas. In load balancing, the same mirror push request is only processed by one of the multiple warehouses, and multiple warehouses share the storage, so any one of them is treated equally, due to control unit control.
  • the third application embodiment of the present application specifically includes:
  • the first step, C Availability Zone Warehouse 1 pushes the image to the cloud management area warehouse VIP and port;
  • the second step the cloud management area warehouse VIP and port will be sent to the cloud management area warehouse 2 for processing the mirror push request;
  • the third step after receiving the push image, the cloud management area warehouse 2 notifies the cloud management area control unit;
  • the fourth step after receiving the mirroring event, the cloud management unit control unit analyzes the real IP of the source of the push mirror event as the C available area warehouse 1, and removes the distribution task of the C available area;
  • the cloud management area control unit controls the cloud management area warehouse 2 to push the image to the free area warehouse VIP and the port and the B available area warehouse VIP and port through the cloud management area warehouse VIP and port.
  • a storage module is also provided in the control unit of the cloud management area for storing the contents of the warehouse and the mirror to avoid data loss caused by abnormal conditions. Specifically, when the cloud management unit receives the push event, the specific information of the image is saved in the storage module.
  • the public image can be synchronized in the mirrored warehouse of each available area in time; the private image inside the tenant can be synchronized to each available area in time to ensure that the user can view the public image and the user under the tenant in any available area. Private images inside the tenant are inaccessible and indiscriminate.
  • the application also provides a mirror synchronization system of a Docker image warehouse.
  • the device includes: a cloud management area warehouse 11 and a cloud management area control unit 12, and the cloud management area warehouse 11 communicates with the cloud management area control unit 12.
  • the cloud control area control unit 12 notifies the cloud management area control unit 12 of receiving the mirroring event when receiving the image pushed by the available area warehouse.
  • the cloud management area control unit 12 is configured to parse the mirroring event.
  • the cloud management area warehouse 11 is controlled to synchronize the image to the corresponding available area warehouse.
  • the image synchronization system of the Docker image repository of the present application further includes an Availability Zone Warehouse 21 and an Availability Zone Control Unit 22, which is connected to the Availability Zone Control Unit 22.
  • the available area is a plurality.
  • the available area control unit is configured to control the available area warehouse to push the image to the cloud management area warehouse.
  • the user terminal pushes a mirror image to the available area warehouse 21, triggering the area warehouse 21 to notify the available area control unit 22 to receive the mirroring event, and the available area control unit 22 resolves the mirroring event to determine that the mirroring event is a pull event.
  • push event if it is a push event, call the API interface of the available area warehouse 21 to push the image to the cloud management area warehouse.
  • the available area warehouse is configured to notify the available area control unit to receive the mirroring event when receiving the image.
  • the available area control unit is further configured to determine whether the mirroring event is from a cloud management area, and if so, the available area storage will not continue to distribute the image, thereby preventing image loopback.
  • the source of the event push can be accurately determined by identifying the IP of the available area warehouse of the push image.
  • the cloud management area control unit is further configured to identify the real IP of the mirroring event, and determine whether the real IP matches the real IP of an available area warehouse. If so, the image is not pushed to the free area repository.
  • the cloud management area control unit is further configured to identify the real IP of the mirroring event, and determine whether the real IP matches the real IP of an available area warehouse. If so, the image is not pushed to the free area repository.
  • the cloud management area control unit 12 includes: a parsing subunit 121 and a mirror sync subunit 122.
  • the parsing sub-unit 121 is configured to parse the mirroring event and determine whether the mirroring event is a pull event or a push event.
  • the mirror synchronization sub-unit 122 is configured to mirror the event as a push event, determine that the mirror event needs to be synchronized, and then invoke the API interface of the cloud management area warehouse to synchronize the image to each corresponding available area warehouse.
  • the parsing sub-unit 121 is specifically configured to: when the mirroring event is a push event, determine that the mirroring event needs to be synchronized, parse the source of the mirroring event to obtain an available area warehouse that pushes the mirror.
  • the image synchronization sub-unit 122 is specifically configured to invoke an API interface of the cloud management area warehouse to synchronize the image to other available area warehouses other than the available area warehouse pushed to the image. For details, please refer to the corresponding embodiment of the above method.
  • the cloud management area control unit 12 also controls the cloud management area warehouse to periodically push all the images to the available area warehouses to avoid mirror synchronization, and when the mirror synchronization fails due to network interruption, etc., it does not affect. Under the premise of the business, the accuracy of image synchronization is further ensured. For details, please refer to the corresponding embodiment of the above method.
  • the present application solves the problem of Docker by setting up a control unit and a warehouse in the cloud management area and each available area, and monitoring the events of the Docker image warehouse to realize mirror synchronization between the cloud management area and each available area.
  • Mirror real-time synchronization issues The private image inside the tenant can also be synchronized to each available area in time, so that in any available area, the user has no indiscriminate access to the public image and the user under the tenant for the private image inside the tenant.
  • the embodiment of the present application further provides a mirror synchronization system of a Docker image warehouse, where the image synchronization system includes:
  • the cloud management area warehouse is configured to notify the cloud management area control unit to receive the mirroring event when receiving the image pushed by the warehouse of an available area;
  • the cloud management area control unit is configured to parse the mirroring event.
  • the cloud management area warehouse is controlled to synchronize the image to the corresponding available area warehouse.
  • the image synchronization system of the Docker image warehouse further includes:
  • the available area control unit is configured to control the available area warehouse to push the image to the cloud management area warehouse.
  • the cloud management area control unit is further configured to parse the mirroring event, and determine whether the mirroring event is a pull event or a push event;
  • the mirroring event is a push event, it is determined that the mirroring event needs to be synchronized, and the API interface of the cloud management area warehouse is called to synchronize the image to the corresponding available area warehouse.
  • the cloud management area control unit is further used for
  • the mirroring event is a push event, it is determined that the mirroring event needs to be synchronized
  • the image synchronization system of the Docker image warehouse further includes:
  • the available area warehouse is configured to notify the available area control unit to receive the mirroring event when receiving the image
  • the available area control unit is further configured to determine whether the mirroring event is from a cloud management area, and if so, the available area warehouse will not continue to distribute the image.
  • the image synchronization system of the Docker image warehouse further includes:
  • the available area warehouse is configured to notify the available area control unit to receive the mirroring event when receiving the image
  • the available area control unit is further configured to determine whether the mirroring event is from a cloud management area, and if so, the available area warehouse will not continue to distribute the image.
  • the image synchronization system of the Docker image warehouse further includes:
  • the available area warehouse is configured to notify the available area control unit to receive the mirroring event when receiving the image
  • the available area control unit is further configured to determine whether the mirroring event is from a cloud management area, and if so, the available area warehouse will not continue to distribute the image.
  • the image synchronization system of the Docker image warehouse further includes:
  • the available area warehouse is configured to notify the available area control unit to receive the mirroring event when receiving the image
  • the available area control unit is further configured to determine whether the mirroring event is from a cloud management area, and if so, the available area warehouse will not continue to distribute the image.
  • the cloud management area control unit is further configured to identify the real IP of the mirror event, determine whether the real IP matches the real IP of the available area warehouse, and if not, push the image to the available area warehouse.
  • the embodiment of the present application further provides a mirror synchronization device of a Docker image repository, where the mirror synchronization device of the Docker image repository includes a memory, a processor, and a Docker stored on the memory and executable on the processor.
  • a mirror synchronization program of the mirror repository, the mirror synchronization program of the Docker image repository being executed by the processor to implement the steps of the image synchronization method of the Docker image repository as described above.
  • the embodiment of the present application further provides a computer readable storage medium, where the image synchronization storage program stores a mirror synchronization program of a Docker image repository, and the image synchronization program of the Docker image repository is implemented by the processor. Steps to the image synchronization method of the Docker image repository
  • a computer program to instruct related hardware (such as a processor, a controller, etc.), and the program can be stored in one.
  • the program when executed, may include the processes of the various method embodiments as described above.
  • the storage medium described therein may be a memory, a magnetic disk, an optical disk, or the like.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The present application discloses a method for synchronizing an image and a system, a device, and a computer readable storage medium for synchronizing an image of a Docker image registry. In the method for synchronizing an image, when a cloud district registry receives an image pushed by an available district registry, a cloud district control unit is notified that an image event has been received. Then, the cloud district control unit analyzes the image event. If it is determined that the image event needs to be synchronized, the cloud district registry is controlled to synchronize the image to a corresponding available district registry. In the present application, by configuring control units and registries in a cloud district and each available district and monitoring the events of Docker image registry, images of the cloud district and each available district are synchronized, such that the issue of Docker image real-time synchronization is resolved.

Description

镜像同步方法、系统、设备及计算机可读存储介质  Mirror synchronization method, system, device and computer readable storage medium
本申请要求于2017年6月21日提交中国专利局、申请号为201710473796.6、发明名称为“Docker镜像仓库的镜像同步方法和镜像同步系统”的中国专利申请的优先权,其全部内容通过引用结合在申请中。This application claims the priority of the Chinese Patent Application filed on June 21, 2017, the Chinese Patent Office, the application number is 201710473796.6, and the invention is entitled "Mirror Image Synchronization Method and Mirror Synchronization System of Docker Image Warehouse", the entire contents of which are incorporated by reference. In the application.
技术领域Technical field
本申请涉及Docker技术领域,具体涉及Docker镜像仓库的镜像同步方法、镜像同步系统、设备及计算机可读存储介质。The present application relates to the field of Docker technology, and specifically relates to a mirror synchronization method of a Docker image repository, a mirror synchronization system, a device, and a computer readable storage medium.
背景技术Background technique
Docker(Docker 是一个开源的应用容器引擎,让开发者可以打包他们的应用以及依赖包到一个可移植的容器中,然后发布到任何流行的 Linux 机器上,也可以实现虚拟化)提供的容器技术允许在同一台主机或虚拟机上运行若干个容器(container),每个容器就是一个独立的虚拟环境或应用。Docker (Docker Is an open source application container engine that allows developers to package their applications and dependencies into a portable container and then publish them to any popular Linux On the machine, virtualization can also be implemented. The container technology provided allows several containers to be run on the same host or virtual machine, each container being a separate virtual environment or application.
容器来源于Docker 镜像(image),而镜像可以由用户自制或由运行中的容器提交来生成,镜像生成后,可以推送(push)到镜像仓库(registry)中进行保存,也可以从镜像仓库拉取(pull)到本地以运行容器。Container from Docker Mirroring, which can be generated by the user or submitted by the running container. After the image is generated, it can be pushed to the image repository for saving, or pulled from the mirror repository. Go to the local to run the container.
Docker提供了官方镜像仓库(Docker hub),同时允许用户自行搭建私有镜像仓库(private registry)。对于大多数机构和组织,使用私有镜像仓库是很有必要的,用以保护仓库的镜像内容及使用。 Docker provides an official image repository (Docker hub), while allowing users to build their own private image repository (private Registry). For most organizations and organizations, it is necessary to use a private image repository to protect the mirrored content and use of the repository.
镜像以分层存储的形式保存于文件系统中,不同的镜像可能共用某些层(layer),以节省存储空间。对于涉及多区域用户访问的仓库搭建,当需要统一管理镜像时,镜像同步是一项必须的工作,以确保用户使用的镜像范围不局限于某个区域。Mirrors are stored in the file system as tiered storage. Different images may share some layers to save storage space. For warehouse construction involving multi-regional user access, mirror synchronization is a must-have when unified management of the image is required to ensure that the scope of the image used by the user is not limited to a certain area.
镜像同步可以由多种方案实现,其中一种是共享存储,即多个区域的仓库(registry)挂载一块共享的网络存储盘,从而可以保证每次有镜像推送至某区域的仓库(registry)时,所有的仓库(registry)都能立即同步。但有时,多区域的registry无法共享存储,且各区域间的网络无法互相访问,即各个区域之间是隔离的。Mirror synchronization can be implemented by multiple schemes, one of which is shared storage, that is, a registry of multiple areas mounts a shared network storage disk, so that each time a mirror is pushed to a certain area of the registry. All the warehouses are immediately synchronized. However, sometimes the multi-region registry cannot share storage, and the networks between the regions cannot access each other, that is, the regions are isolated.
在多租户环境下使用Docker镜像时,租户下的用户通常被限制为只能访问各个可用区的公共服务区内部署的镜像仓库(Registry)。而对于公共镜像,需要在各个可用区的镜像仓库内同步;对于租户内部的私有镜像,也需要将镜像同步到各个可用区。对于用户来说,其所能看到的各个可用区内的镜像应该是一致的,而同时各个可用区的云存储不能跨区域共享,不能分发镜像事件至其它可用区,因此不能借助共享存储的方式来实现同步,而只能使用实时同步。When using a Docker image in a multi-tenant environment, users under the tenant are typically restricted to access only the mirrored repository deployed in the public service area of each Availability Zone. For public mirroring, you need to synchronize in the mirrored warehouse of each available area; for private mirrors inside the tenant, you also need to synchronize the mirror to each available area. For the user, the images in each available area that they can see should be consistent, while the cloud storage of each available area cannot be shared across areas, and the mirrored events cannot be distributed to other available areas, so the shared storage cannot be used. The way to achieve synchronization, and only use real-time synchronization.
因此,现有技术还有待于改进和发展。Therefore, the prior art has yet to be improved and developed.
发明内容Summary of the invention
针对现有技术的上述缺陷,本申请提供一种Docker镜像仓库的镜像同步方法、镜像同步系统、设备及计算机可读存储介质,主要解决现有Docker镜像不能实时同步的问题。In view of the above-mentioned deficiencies of the prior art, the present application provides a mirror synchronization method, a mirror synchronization system, a device, and a computer-readable storage medium of a Docker image warehouse, which mainly solve the problem that the existing Docker images cannot be synchronized in real time.
本申请解决技术问题所采用的技术方案如下:The technical solution adopted by the present application to solve the technical problem is as follows:
一种Docker镜像仓库的镜像同步方法,所述镜像同步方法包括如下步骤:A mirror synchronization method for a Docker image repository, the image synchronization method comprising the following steps:
云管区仓库收到某一可用区仓库推送的镜像时,通知云管区控制单元收到镜像事件;When the cloud management area warehouse receives the image pushed by the warehouse of a certain available area, the cloud control area control unit is notified to receive the mirroring event;
云管区控制单元解析镜像事件,当判断镜像事件需要同步时,控制云管区仓库将镜像同步至相应的可用区仓库。The cloud management area control unit resolves the mirror event. When it is determined that the mirror event needs to be synchronized, the cloud management area warehouse is controlled to synchronize the image to the corresponding available area warehouse.
此外,为实现上述目的,本申请还提供一种Docker镜像仓库的镜像同步系统,所述镜像同步系统包括:In addition, to achieve the above object, the present application further provides a mirror synchronization system of a Docker image warehouse, where the image synchronization system includes:
云管区仓库,用于收到某一可用区仓库推送的镜像时,通知云管区控制单元收到镜像事件;The cloud management area warehouse is configured to notify the cloud management area control unit to receive the mirroring event when receiving the image pushed by the warehouse of an available area;
云管区控制单元,用于解析所述镜像事件,当判断镜像事件需要同步时,控制云管区仓库将镜像同步至相应的可用区仓库。The cloud management area control unit is configured to parse the mirroring event. When it is determined that the mirroring event needs to be synchronized, the cloud management area warehouse is controlled to synchronize the image to the corresponding available area warehouse.
此外,为实现上述目的,本申请还提供一种Docker镜像仓库的镜像同步设备,其特征在于,所述Docker镜像仓库的镜像同步设备包括存储器、处理器和存储在所述存储器上并可在所述处理器上运行的Docker镜像仓库的镜像同步程序,所述Docker镜像仓库的镜像同步配程序被所述处理器执行时实现上述的Docker镜像仓库的镜像同步方法的步骤。In addition, in order to achieve the above object, the present application further provides a mirror synchronization device of a Docker image repository, wherein the mirror synchronization device of the Docker image repository includes a memory, a processor, and a storage on the memory and can be The image synchronization program of the Docker image repository running on the processor, the mirror synchronization program of the Docker image repository being executed by the processor to implement the steps of the image synchronization method of the Docker image repository described above.
此外,为实现上述目的,本申请还提供一种计算机可读存储介质,其特征在于,所述计算机可读存储介质上存储有Docker镜像仓库的镜像同步程序,所述Docker镜像仓库的镜像同步程序被处理器执行时实现上述的Docker镜像仓库的镜像同步方法的步骤。In addition, in order to achieve the above object, the present application further provides a computer readable storage medium, wherein the computer readable storage medium stores a mirror synchronization program of a Docker image repository, and a mirror synchronization program of the Docker image repository The steps of implementing the image synchronization method of the Docker image repository described above when executed by the processor.
本申请公开了Docker镜像仓库的镜像同步方法和镜像同步系统,其镜像同步方法先由云管区仓库收到某一可用区仓库推送的镜像时,通知云管区控制单元收到镜像事件;之后,云管区控制单元解析镜像事件,当判断镜像事件需要同步时,控制云管区仓库将镜像同步至相应的可用区仓库。本申请通过在云管区、各可用区域均设置控制单元和仓库,通过监听Docker镜像仓库的事件,来实现云管区与各可用区域的镜像同步,从而解决了Docker 镜像实时同步的问题。 The present application discloses a mirror synchronization method and a mirror synchronization system of a Docker image warehouse. When the image synchronization method first receives a mirror image pushed by an available area warehouse from the cloud management area warehouse, the cloud control area control unit is notified to receive the mirroring event; The pipe area control unit resolves the mirror event. When it is determined that the mirror event needs to be synchronized, the cloud control area warehouse is controlled to synchronize the image to the corresponding available area warehouse. This application solves the problem of Docker by setting up a control unit and a warehouse in the cloud management area and each available area, and monitoring the events of the Docker image warehouse to realize the mirror synchronization of the cloud management area and each available area. Mirror real-time synchronization issues.
附图说明DRAWINGS
图1为本申请提供的Docker镜像仓库的镜像同步方法的较佳实施例的流程图。1 is a flow chart of a preferred embodiment of a method for mirror synchronization of a Docker image repository provided by the present application.
图2为本申请提供的Docker镜像仓库的镜像同步方法中步骤S200的较佳实施例的流程图。2 is a flow chart of a preferred embodiment of step S200 in the image synchronization method of the Docker image repository provided by the present application.
图3为本申请提供的Docker镜像仓库的镜像同步方法中第一应用实施例的示意图。FIG. 3 is a schematic diagram of a first application embodiment in a mirror synchronization method of a Docker image repository provided by the present application.
图4为本申请提供的Docker镜像仓库的镜像同步方法中第二应用实施例的示意图。4 is a schematic diagram of a second application embodiment in a mirror synchronization method of a Docker image repository provided by the present application.
图5为本申请提供的Docker镜像仓库的镜像同步方法中第三应用实施例的示意图。FIG. 5 is a schematic diagram of a third application embodiment in a mirror synchronization method of a Docker image repository provided by the present application.
图6为本申请Docker镜像仓库的镜像同步系统的功能原理框图。6 is a functional block diagram of a mirror synchronization system of the Docker image repository of the present application.
图7为本申请Docker镜像仓库的镜像同步系统中云管区控制单元的功能原理框图。FIG. 7 is a functional block diagram of a cloud management area control unit in a mirror synchronization system of a Docker image warehouse of the present application.
具体实施方式Detailed ways
为使本申请的目的、技术方案及优点更加清楚、明确,以下参照附图并举实施例对本申请进一步详细说明。应当理解,此处所描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。In order to make the objects, technical solutions, and advantages of the present application more clear and clear, the present application will be further described in detail below with reference to the accompanying drawings. It is understood that the specific embodiments described herein are merely illustrative of the application and are not intended to be limiting.
请参阅图1,其为本申请提供的Docker镜像仓库的镜像同步方法的较佳实施例的流程图。如图1所示,本申请较佳实施例所述的Docker镜像仓库的镜像同步方法以下步骤:Please refer to FIG. 1 , which is a flowchart of a preferred embodiment of a mirror synchronization method of a Docker image repository provided by the present application. As shown in FIG. 1, the image synchronization method of the Docker image warehouse described in the preferred embodiment of the present application is as follows:
S100、云管区仓库收到某一可用区仓库推送的镜像时,通知云管区控制单元收到镜像事件。When the S100 and the cloud management area warehouse receive the image pushed by the warehouse of an available area, the cloud control area control unit is notified to receive the mirroring event.
本实施例中,在云管区和各可用区域中均设置了控制单元和仓库,所述云管区为一个,可用区为若干个,用于对各可用区的镜像进行管理。In this embodiment, a control unit and a warehouse are disposed in the cloud management area and each available area, and the cloud management area is one, and the available area is several, which is used to manage the mirror of each available area.
较佳地,在步骤S100之前还包括:由某一可用区控制单元控制该可用区仓库向云管区仓库推送镜像。Preferably, before step S100, the method further comprises: controlling, by an available area control unit, the available area warehouse to push the image to the cloud management area warehouse.
具体实施时,由用户终端向可用区仓库推送一镜像,触发该区仓库通知该可用区控制单元接收到镜像事件,可用区控制单元解析镜像事件后,判断镜像事件是拉取事件还是推送事件,若为推送事件,则调用该可用区区仓库的API接口(Application Programming Interface,应用程序编程接口)将镜像同步至云管区仓库。During specific implementation, the user terminal pushes a mirror to the available area warehouse, triggers the area warehouse to notify the available area control unit to receive the mirroring event, and the available area control unit resolves the mirroring event to determine whether the mirroring event is a pull event or a push event. If it is a push event, the API interface of the available area warehouse is called (Application Programming Interface, the application programming interface) synchronizes the image to the cloud management area repository.
步骤S200、云管区控制单元解析镜像事件,当判断镜像事件需要同步时,控制云管区仓库将镜像同步至相应的可用区仓库。In step S200, the cloud management area control unit parses the image event. When it is determined that the mirror event needs to be synchronized, the cloud management area warehouse is controlled to synchronize the image to the corresponding available area warehouse.
本实施例中,由云管区控制单元判断镜像事件需要同步时,控制云管区仓库将镜像同步至相应的可用区仓库中,实现了各可用区镜像与云管区同步。In this embodiment, when the cloud management area control unit determines that the mirroring event needs to be synchronized, the cloud management area warehouse is controlled to synchronize the image to the corresponding available area warehouse, thereby realizing the synchronization of each available area image and the cloud management area.
请参阅图2,其为本申请提供的Docker镜像仓库的镜像同步方法中步骤S200的较佳实施例的流程图。Please refer to FIG. 2 , which is a flowchart of a preferred embodiment of step S200 in the image synchronization method of the Docker image repository provided by the present application.
如图2所示,所述步骤S200包括:As shown in FIG. 2, the step S200 includes:
步骤S201、所述云管区控制单元解析镜像事件,并判断镜像事件是拉取事件还是推送事件;Step S201: The cloud management area control unit parses the mirroring event, and determines whether the mirroring event is a pull event or a push event;
步骤S202、若镜像事件为推送事件,确定该镜像事件需要同步,并调用云管区仓库的API接口将镜像同步至相应的可用区仓库。当镜像事件为拉取事件,或者云管区仓库中存在该镜像时,则不进行同步操作。Step S202: If the mirroring event is a push event, determine that the mirroring event needs to be synchronized, and call the API interface of the cloud management area warehouse to synchronize the image to the corresponding available area warehouse. When the mirroring event is a pull event, or the mirror exists in the cloud management area warehouse, no synchronization operation is performed.
具体实施时,所述步骤S202包括:In a specific implementation, the step S202 includes:
S2021、若镜像事件为推送事件,确定该镜像事件需要同步。当镜像事件为拉取事件,或者云管区仓库中存在该镜像时,则不进行同步操作。S2021: If the mirroring event is a push event, determine that the mirroring event needs to be synchronized. When the mirroring event is a pull event, or the mirror exists in the cloud management area warehouse, no synchronization operation is performed.
S2022、若镜像事件为推送事件时,解析所述镜像事件的来源以获取推送该镜像的可用区仓库。在云管区控制单元中,将该源可用区仓库的分发任务剔除,避免出现同步回环。S2022: If the mirror event is a push event, parse the source of the mirror event to obtain an available area warehouse that pushes the image. In the cloud management area control unit, the distribution task of the source available area warehouse is eliminated to avoid synchronous loopback.
S2023、调用云管区仓库的API接口将镜像同步至除推送给镜像的可用区仓库之外的其他各可用区仓库当同步镜像事件时,不将镜像分发给推送该镜像的可用区仓库。S2023: Calling the API interface of the cloud management area warehouse to synchronize the image to each available area warehouse except the free area warehouse pushed to the mirror. When the synchronous mirroring event occurs, the image is not distributed to the free area warehouse that pushes the image.
为了更好的理解本申请的技术方案,此处例举第一应用实施例对本申请的Docker镜像仓库的镜像同步方法进行详细说明:In order to better understand the technical solution of the present application, the first application embodiment is exemplified in detail for the mirror synchronization method of the Docker image warehouse of the present application:
云管区为集中管理区,各可用区可设置在不同的地点,如A可用区设置在上海、B可用区设置在北京,C可用区设置在深圳等。A可用区、B可用区和C可用区之间不能相互通讯,A可用区、B可用区和C可用区只能与云管区通讯,进行推送或者拉取镜像操作。The cloud management area is a centralized management area, and each available area can be set at different locations. For example, the A free area is set in Shanghai, the B free area is set in Beijing, and the C free area is set in Shenzhen. The A Availability Zone, the B Availability Zone, and the C Availability Zone cannot communicate with each other. The A Availability Zone, the B Availability Zone, and the C Availability Zone can only communicate with the cloud management zone to perform push or pull mirror operations.
如图3所示,本申请的第一应用实施例具体包括:As shown in FIG. 3, the first application embodiment of the present application specifically includes:
第一步、由用户终端向A可用区仓库推送镜像;In the first step, the image is pushed by the user terminal to the A Availability Zone Warehouse;
第二步、A可用区仓库收到镜像后通知A可用区控制单元接收到镜像事件并存储该镜像;Step 2: After receiving the image, the A Availability Zone Warehouse notifies the A Availability Zone Control Unit to receive the mirroring event and store the image;
第三步、A可用区控制单元解析镜像事件后,并控制A可用区仓库将镜像推送至云管区仓库;The third step, after the A Availability Zone Control Unit resolves the mirror event, and controls the A Availability Zone Warehouse to push the image to the cloud management area warehouse;
第四步、云管区仓库收到A可用区仓库推送的镜像时,通知云管区控制单元收到镜像事件;In the fourth step, when the cloud management area warehouse receives the image pushed by the A free area warehouse, the cloud control area control unit is notified to receive the mirroring event;
第五步、云管区控制单元解析镜像事件,当判断镜像事件为推送事件时,控制云管区仓库将镜像同步至A可用区仓库、B可用区仓库和C可用区仓库,当判断镜像事件为拉取事件时,不处理该镜像事件。The fifth step, the cloud management area control unit resolves the mirror event, and when the mirror event is determined to be a push event, the cloud control area warehouse is controlled to synchronize the image to the A free area warehouse, the B free area warehouse, and the C free area warehouse, and when the mirror event is determined to be pulled The mirror event is not processed when the event is fetched.
为避免浪费网络资源,本申请还采取了防止回环和过滤机制,所述步骤S202还包括:若镜像事件为推送事件时,解析所述镜像事件的来源;当同步镜像事件时,不将镜像分发给推送该镜像的可用区仓库。In order to avoid wasting network resources, the application also adopts a loopback prevention and filtering mechanism. The step S202 further includes: if the mirroring event is a push event, parsing the source of the mirroring event; when the mirroring event is synchronous, the mirroring is not distributed. The free area repository for the image to be pushed.
本实施例中,在判断镜像事件的来源时,通过识别推送镜像的可用区仓库的IP,从而能准确判断事件推送来源。In this embodiment, when determining the source of the mirror event, the IP of the available area warehouse of the push image is identified, so that the event push source can be accurately determined.
进一步的,在步骤S200之后,本申请的Docker镜像仓库的镜像同步方法还包括:Further, after step S200, the image synchronization method of the Docker image repository of the present application further includes:
步骤S300、各可用区仓库接收到镜像时,通知该可用区控制单元收到所述镜像事件;Step S300: When each available area warehouse receives the image, notify the available area control unit to receive the mirroring event;
步骤S400、该可用区控制单元判断所述镜像事件是否来源于云管区,如果是,该可用区仓库将不再继续分发该镜像。Step S400: The available area control unit determines whether the mirroring event is from a cloud management area, and if so, the available area warehouse will not continue to distribute the image.
本申请通过在云管区和各可用区均设置防止回环和过滤机制,防止镜像推送事件无限回环,有效节省了网络资源。By setting a loopback prevention and filtering mechanism in the cloud management area and each available area, the application prevents the mirror push event from being infinitely looped back, thereby effectively saving network resources.
为了便于更好的理解本申请的回环机制,此处例举第二应用实施例对本申请的Docker镜像仓库的镜像同步方法进行详细说明:In order to facilitate a better understanding of the loopback mechanism of the present application, a second application embodiment is exemplified herein to describe the mirror synchronization method of the Docker image repository of the present application in detail:
如图4所示,本申请的第二应用实施例具体包括:As shown in FIG. 4, the second application embodiment of the present application specifically includes:
第一步、A可用区仓库将镜像推送至云管区仓库;In the first step, the A Availability Zone Warehouse pushes the image to the cloud management area warehouse;
第二步、云管区仓库收到A可用区仓库推送的镜像时,通知云管区控制单元收到镜像事件;In the second step, when the cloud management area warehouse receives the image pushed by the A free area warehouse, the cloud control area control unit is notified to receive the mirroring event;
第三步、云管区控制单元解析镜像事件,当判断镜像事件为推送事件,并确定该镜像事件需要同步时,分析出推送事件的来源为A可用区仓库,并将A可用区仓库的分发任务剔除;The third step, the cloud management area control unit resolves the mirror event. When the mirror event is determined to be a push event, and it is determined that the mirror event needs to be synchronized, the source of the push event is analyzed as the A free area warehouse, and the distribution task of the A free area warehouse is analyzed. Eliminate
第四步、云管区控制单元将分发任务发送给云管区仓库;In the fourth step, the cloud management area control unit sends the distribution task to the cloud management area warehouse;
第五步、云管区仓库将镜像分发给B可用区仓库和C可用区仓库;In the fifth step, the cloud management area warehouse distributes the image to the B free area warehouse and the C free area warehouse;
第六步、B可用区仓库和C可用区仓库接收到镜像后,通知B可用控制单元和C可用控制单元接收到镜像事件;After the sixth step, the B Availability Zone Warehouse and the C Availability Zone Warehouse receive the image, the notification B may receive the mirroring event by using the control unit and the C available control unit;
第七步、B可用控制单元和C可用控制单元分析镜像事件的来源为云管区,将本次的推送任务删除,不再进行分发,避免了回环(即避免推送镜像循环)。The seventh step, B, the control unit and the C available control unit analyze the source of the mirror event as the cloud management area, delete the current push task, no longer distribute, and avoid loopback (ie, avoid pushing the mirror loop).
在镜像同步时,有可能会出现同步失败的情况(譬如:镜像同步时,出现网终异常导致镜像同步失败),为了提高镜像同步的准确率,在本申请的Docker镜像仓库的镜像同步方法中,所述云管区仓库定时将所有镜像推送至各可用区仓库。具体实施时,云管区控制单元控制云管区仓库每天凌晨两点定时向各可用区推送镜像。In the mirror synchronization, there may be a case where the synchronization fails (for example, when the mirror synchronization occurs, the network termination abnormality causes the mirror synchronization to fail), in order to improve the accuracy of the mirror synchronization, in the mirror synchronization method of the Docker image warehouse of the present application. The cloud management area warehouse periodically pushes all the images to the available area warehouses. During specific implementation, the cloud management area control unit controls the cloud management area warehouse to push the image to each available area at two o'clock every morning.
为了避免镜像同步重复,在定期同步时,云管区控制单元调用源镜像仓库的API接口将镜像推送到相应的可用区仓库,并与该可用区仓库进行交互检测可用区仓库是否存在所推送的镜像;当检测镜像存在时,中止推送所述镜像。In order to avoid the mirror synchronization repetition, during the periodic synchronization, the cloud management unit calls the API interface of the source mirror warehouse to push the image to the corresponding available area warehouse, and interacts with the available area warehouse to detect whether the available area warehouse has the pushed image. When the detection image exists, the image is aborted.
在更加复杂的网络环境中,一个可用区内设有多个可用区仓库,并使负载均衡,各可用区仓库对外提供一个vip (Very Important Person,贵宾)及端口时,则以该可用区为目标的区域应将镜像推送至该vip 及端口,且判断回环时,应查看事件来源是否为其可用区仓库的真实ip 及端口。In a more complex network environment, there are multiple free area warehouses in one available area, and the load is balanced. Each available area warehouse provides a VIP. (Very Important Person, VIP) and port, the area targeting the Availability Zone should push the image to the vip And the port, and when judging the loopback, you should check whether the event source is the real ip and port of the available area warehouse.
因此,当各可用区均有多个仓库时,云管区控制单元控制云管区仓库将镜像同步至相应的可用区仓库时,具体为:云管区控制单元识别镜像事件的真实IP,判断该真实IP是否与某个可用区仓库的真实IP相匹配,若是则将可用区仓库的分发任务剔除,不向该可用区仓库推送镜像。Therefore, when there are multiple warehouses in each available area, the cloud management area control unit controls the cloud management area warehouse to synchronize the image to the corresponding available area warehouse, specifically: the cloud management area control unit identifies the real IP of the mirror event, and determines the real IP. Whether it matches the real IP of an available area warehouse, if it is, the distribution task of the available area warehouse is removed, and the image is not pushed to the available area warehouse.
具体地,当一个区域有多个仓库时,为使各仓库负载均衡,本申请采用令每个区域的所有仓库对外提供一个vip及端口,在其他区域向该区域推送镜像时,通过vip及端口下发。对于各可用区,其分发目标只有云管区镜像仓库VIP及端口,在该区域控制单元接到镜像推送事件时,根据镜像事件来源的真实IP,查询该IP是否为云管区镜像仓库的真实IP之一,若是则将云管区镜像仓库VIP从当次分发任务中剔除,此时当次分发任务的目标为空,不再继续同步镜像。Specifically, when there are multiple warehouses in an area, in order to load balance the warehouses, the present application uses all the warehouses in each area to provide a vip and a port, and when other areas push the image to the area, the vip and the port are used. Issued. For each available area, the distribution target is only the cloud management area mirror warehouse VIP and port. When the control unit receives the mirror push event, the real-time IP of the mirror event source is used to query whether the IP is the real IP address of the cloud management area mirror warehouse. First, if the cloud management area mirror warehouse VIP is removed from the current distribution task, the target of the current distribution task is empty, and the synchronization mirror is no longer continued.
对于云管区,其分发目标包含各可用区镜像仓库VIP及端口,在云管区控制单元接到镜像推送事件时,根据镜像事件来源的真实IP,查询该IP是否为某个可用区镜像仓库的真实IP之一,若是则将该区域镜像仓库的VIP从当次分发任务中剔除,此时当次分发任务的目标为其他的可用区镜像仓库,不再继续对来源区域向下同步,而同步到其他区域。负载均衡时,同一个镜像推送请求只会由多个仓库中的某一个来处理,而多个仓库共用了存储,所以它们的任意一个来处理都是相等的,由于有控制单元控制。For the cloud management area, the distribution target includes the VIP and port of each available area mirror warehouse. When the cloud control area control unit receives the mirror push event, according to the real IP of the mirror event source, it is queried whether the IP is the real state of an available area mirror warehouse. One of the IPs, if it is, the VIP of the regional mirror warehouse is removed from the current distribution task. At this time, the target of the current distribution task is another available area mirror warehouse, and the source area is no longer synchronized downward, but is synchronized. Other areas. In load balancing, the same mirror push request is only processed by one of the multiple warehouses, and multiple warehouses share the storage, so any one of them is treated equally, due to control unit control.
为了便于更好的理解各区域多仓库时的回环机制,此处例举第三应用实施例对本申请的Docker镜像仓库的镜像同步方法进行详细说明:In order to facilitate a better understanding of the loopback mechanism in the multi-warehouse of each area, the third application embodiment is described herein to describe the mirror synchronization method of the Docker image warehouse of the present application in detail:
如图5所示,本申请的第三应用实施例具体包括:As shown in FIG. 5, the third application embodiment of the present application specifically includes:
第一步、C可用区仓库1将镜像推送至云管区仓库VIP及端口;The first step, C Availability Zone Warehouse 1 pushes the image to the cloud management area warehouse VIP and port;
第二步、云管区仓库VIP及端口将谇镜像推送请求交由云管区仓库2进行处理;The second step, the cloud management area warehouse VIP and port will be sent to the cloud management area warehouse 2 for processing the mirror push request;
第三步、云管区仓库2收到推送镜像后,通知云管区控制单元;The third step, after receiving the push image, the cloud management area warehouse 2 notifies the cloud management area control unit;
第四步、云管区控制单元收到镜像事件后,分析推送镜像事件的来源的真实IP为C可用区仓库1,并将C可用区的分发任务剔除;The fourth step, after receiving the mirroring event, the cloud management unit control unit analyzes the real IP of the source of the push mirror event as the C available area warehouse 1, and removes the distribution task of the C available area;
第五步、云管区控制单元控制云管区仓库2通过云管区仓库VIP及端口将镜像推送送A可用区仓库VIP及端口和B可用区仓库VIP及端口。The fifth step, the cloud management area control unit controls the cloud management area warehouse 2 to push the image to the free area warehouse VIP and the port and the B available area warehouse VIP and port through the cloud management area warehouse VIP and port.
进一地,在云管区控制单元中还设置有存储模块,用于保存仓库及镜像的内容,避免异常情况导致数据丢失。具体可在云管区控制单元接收到推送事件时,将镜像的具体信息保存在存储模块中。In addition, a storage module is also provided in the control unit of the cloud management area for storing the contents of the warehouse and the mirror to avoid data loss caused by abnormal conditions. Specifically, when the cloud management unit receives the push event, the specific information of the image is saved in the storage module.
本申请实现了公共镜像在各个可用区的镜像仓库内能及时同步;租户内部的私有镜像也能及时同步到各个可用区,从而保证在任意可用区内,用户对于公共镜像以及租户下的用户对于租户内部的私有镜像无能无差别地访问。The public image can be synchronized in the mirrored warehouse of each available area in time; the private image inside the tenant can be synchronized to each available area in time to ensure that the user can view the public image and the user under the tenant in any available area. Private images inside the tenant are inaccessible and indiscriminate.
本申请还提供了一种Docker镜像仓库的镜像同步系统,如图6所示,所述装置包括:云管区仓库11和云管区控制单元12,所述云管区仓库11与云管区控制单元12通讯,用于收到某一可用区仓库推送的镜像时,通知云管区控制单元12收到镜像事件。所述云管区控制单元12,用于解析所述镜像事件,当判断镜像事件需要同步时,控制云管区仓库11将镜像同步至相应的可用区仓库。具体请参阅上述方法对应的实施例。The application also provides a mirror synchronization system of a Docker image warehouse. As shown in FIG. 6, the device includes: a cloud management area warehouse 11 and a cloud management area control unit 12, and the cloud management area warehouse 11 communicates with the cloud management area control unit 12. The cloud control area control unit 12 notifies the cloud management area control unit 12 of receiving the mirroring event when receiving the image pushed by the available area warehouse. The cloud management area control unit 12 is configured to parse the mirroring event. When it is determined that the mirroring event needs to be synchronized, the cloud management area warehouse 11 is controlled to synchronize the image to the corresponding available area warehouse. For details, please refer to the corresponding embodiment of the above method.
本申请的Docker镜像仓库的镜像同步系统还包括可用区仓库21和可用区控制单元22,所述可用区仓库21连接可用区控制单元22。所述可用区为多个。所述可用区控制单元,用于控制该可用区仓库向云管区仓库推送镜像。The image synchronization system of the Docker image repository of the present application further includes an Availability Zone Warehouse 21 and an Availability Zone Control Unit 22, which is connected to the Availability Zone Control Unit 22. The available area is a plurality. The available area control unit is configured to control the available area warehouse to push the image to the cloud management area warehouse.
具体实施时,由用户终端向可用区仓库21推送一镜像,触发该区仓库21通知该可用区控制单元22接收到镜像事件,可用区控制单元22解析镜像事件后,判断镜像事件是拉取事件还是推送事件,若为推送事件,则调用该可用区区仓库21的API接口将镜像推送至云管区仓库。In a specific implementation, the user terminal pushes a mirror image to the available area warehouse 21, triggering the area warehouse 21 to notify the available area control unit 22 to receive the mirroring event, and the available area control unit 22 resolves the mirroring event to determine that the mirroring event is a pull event. Or push event, if it is a push event, call the API interface of the available area warehouse 21 to push the image to the cloud management area warehouse.
所述可用区仓库,用于接收到镜像时,通知该可用区控制单元收到所述镜像事件。所述可用区控制单元,还用于接判断所述镜像事件是否来源于云管区,如果是,使该可用区仓库将不再继续分发该镜像,从而可防止镜像回环。The available area warehouse is configured to notify the available area control unit to receive the mirroring event when receiving the image. The available area control unit is further configured to determine whether the mirroring event is from a cloud management area, and if so, the available area storage will not continue to distribute the image, thereby preventing image loopback.
在判断镜像事件的来源时,通过识别推送镜像的可用区仓库的IP,从而能准确判断事件推送来源。请结合图5,当各可用区均有多个仓库时,所述云管区控制单元,还用于识别镜像事件的真实IP,判断该真实IP是否与某个可用区仓库的真实IP相匹配,若是则不向该可用区仓库推送镜像。具体请参阅上述方法对应的实施例。When judging the source of the mirror event, the source of the event push can be accurately determined by identifying the IP of the available area warehouse of the push image. Referring to FIG. 5, when there are multiple warehouses in each available area, the cloud management area control unit is further configured to identify the real IP of the mirroring event, and determine whether the real IP matches the real IP of an available area warehouse. If so, the image is not pushed to the free area repository. For details, please refer to the corresponding embodiment of the above method.
请参阅图7,具体实施时,所述云管区控制单元12包括:解析子单元121和镜像同步子单元122。Referring to FIG. 7 , in the specific implementation, the cloud management area control unit 12 includes: a parsing subunit 121 and a mirror sync subunit 122.
所述解析子单元121,用于解析所述镜像事件,并判断镜像事件是拉取事件还是推送事件。所述镜像同步子单元122,用于镜像事件为推送事件,确定该镜像事件需要同步,并则调用云管区仓库的API接口将镜像同步至各相应的可用区仓库。The parsing sub-unit 121 is configured to parse the mirroring event and determine whether the mirroring event is a pull event or a push event. The mirror synchronization sub-unit 122 is configured to mirror the event as a push event, determine that the mirror event needs to be synchronized, and then invoke the API interface of the cloud management area warehouse to synchronize the image to each corresponding available area warehouse.
所述解析子单元121具体用于当镜像事件为推送事件,确定该镜像事件需要同步时,解析所述镜像事件的来源以获取推送该镜像的可用区仓库。所述镜像同步子单元122具体用于调用云管区仓库的API接口将镜像同步至除推送给镜像的可用区仓库之外的其他各可用区仓库。具体请参阅上述方法对应的实施例。The parsing sub-unit 121 is specifically configured to: when the mirroring event is a push event, determine that the mirroring event needs to be synchronized, parse the source of the mirroring event to obtain an available area warehouse that pushes the mirror. The image synchronization sub-unit 122 is specifically configured to invoke an API interface of the cloud management area warehouse to synchronize the image to other available area warehouses other than the available area warehouse pushed to the image. For details, please refer to the corresponding embodiment of the above method.
进一步的实施例中,所述云管区控制单元12,还控制云管区仓库定时将所有镜像推送至各可用区仓库,以避免镜像同步时,由于网络中断等原因导致镜像同步失败时,在不影响业务的前提下进一步确保镜像同步的准确率。具体请参阅上述方法对应的实施例。In a further embodiment, the cloud management area control unit 12 also controls the cloud management area warehouse to periodically push all the images to the available area warehouses to avoid mirror synchronization, and when the mirror synchronization fails due to network interruption, etc., it does not affect. Under the premise of the business, the accuracy of image synchronization is further ensured. For details, please refer to the corresponding embodiment of the above method.
综上所述,本申请通过在云管区、各可用区域均设置控制单元和仓库,通过监听Docker镜像仓库的事件,来实现云管区与各可用区域的镜像同步,从而解决了Docker 镜像实时同步的问题。使租户内部的私有镜像也能及时同步到各个可用区,从而保证在任意可用区内,用户对于公共镜像以及租户下的用户对于租户内部的私有镜像无能无差别地访问。In summary, the present application solves the problem of Docker by setting up a control unit and a warehouse in the cloud management area and each available area, and monitoring the events of the Docker image warehouse to realize mirror synchronization between the cloud management area and each available area. Mirror real-time synchronization issues. The private image inside the tenant can also be synchronized to each available area in time, so that in any available area, the user has no indiscriminate access to the public image and the user under the tenant for the private image inside the tenant.
此外,本申请实施例还提出一种Docker镜像仓库的镜像同步系统,所述镜像同步系统包括:In addition, the embodiment of the present application further provides a mirror synchronization system of a Docker image warehouse, where the image synchronization system includes:
云管区仓库,用于收到某一可用区仓库推送的镜像时,通知云管区控制单元收到镜像事件;The cloud management area warehouse is configured to notify the cloud management area control unit to receive the mirroring event when receiving the image pushed by the warehouse of an available area;
云管区控制单元,用于解析所述镜像事件,当判断镜像事件需要同步时,控制云管区仓库将镜像同步至相应的可用区仓库。The cloud management area control unit is configured to parse the mirroring event. When it is determined that the mirroring event needs to be synchronized, the cloud management area warehouse is controlled to synchronize the image to the corresponding available area warehouse.
进一步地,所述的Docker镜像仓库的镜像同步系统还包括:Further, the image synchronization system of the Docker image warehouse further includes:
可用区控制单元,用于控制该可用区仓库向云管区仓库推送镜像。 The available area control unit is configured to control the available area warehouse to push the image to the cloud management area warehouse.
进一步地,所述云管区控制单元,还用于解析镜像事件,并判断镜像事件是拉取事件还是推送事件;Further, the cloud management area control unit is further configured to parse the mirroring event, and determine whether the mirroring event is a pull event or a push event;
若镜像事件为推送事件,确定该镜像事件需要同步,并调用云管区仓库的API接口将镜像同步至相应的可用区仓库If the mirroring event is a push event, it is determined that the mirroring event needs to be synchronized, and the API interface of the cloud management area warehouse is called to synchronize the image to the corresponding available area warehouse.
进一步地,所述云管区控制单元,还用于Further, the cloud management area control unit is further used for
若镜像事件为推送事件,确定该镜像事件需要同步;If the mirroring event is a push event, it is determined that the mirroring event needs to be synchronized;
解析所述镜像事件的来源以获取推送该镜像的可用区仓库;Parsing the source of the mirrored event to obtain an available area repository that pushes the image;
调用云管区仓库的API接口将镜像同步至除推送给镜像的可用区仓库之外的其他各可用区仓库。Call the API interface of the cloud management area repository to synchronize the image to each free area warehouse except the free area warehouse pushed to the image.
进一步地,所述的Docker镜像仓库的镜像同步系统还包括:Further, the image synchronization system of the Docker image warehouse further includes:
可用区仓库,用于接收到镜像时,通知该可用区控制单元收到所述镜像事件;The available area warehouse is configured to notify the available area control unit to receive the mirroring event when receiving the image;
所述可用区控制单元,还用于接判断所述镜像事件是否来源于云管区,如果是,该可用区仓库将不再继续分发该镜像。The available area control unit is further configured to determine whether the mirroring event is from a cloud management area, and if so, the available area warehouse will not continue to distribute the image.
进一步地,述的Docker镜像仓库的镜像同步系统,还包括:Further, the image synchronization system of the Docker image warehouse further includes:
可用区仓库,用于接收到镜像时,通知该可用区控制单元收到所述镜像事件;The available area warehouse is configured to notify the available area control unit to receive the mirroring event when receiving the image;
所述可用区控制单元,还用于接判断所述镜像事件是否来源于云管区,如果是,该可用区仓库将不再继续分发该镜像。The available area control unit is further configured to determine whether the mirroring event is from a cloud management area, and if so, the available area warehouse will not continue to distribute the image.
进一步地,所述的Docker镜像仓库的镜像同步系统还包括:Further, the image synchronization system of the Docker image warehouse further includes:
可用区仓库,用于接收到镜像时,通知该可用区控制单元收到所述镜像事件;The available area warehouse is configured to notify the available area control unit to receive the mirroring event when receiving the image;
所述可用区控制单元,还用于接判断所述镜像事件是否来源于云管区,如果是,该可用区仓库将不再继续分发该镜像。The available area control unit is further configured to determine whether the mirroring event is from a cloud management area, and if so, the available area warehouse will not continue to distribute the image.
进一步地,所述的Docker镜像仓库的镜像同步系统还包括:Further, the image synchronization system of the Docker image warehouse further includes:
可用区仓库,用于接收到镜像时,通知该可用区控制单元收到所述镜像事件;The available area warehouse is configured to notify the available area control unit to receive the mirroring event when receiving the image;
所述可用区控制单元,还用于接判断所述镜像事件是否来源于云管区,如果是,该可用区仓库将不再继续分发该镜像。The available area control unit is further configured to determine whether the mirroring event is from a cloud management area, and if so, the available area warehouse will not continue to distribute the image.
进一步地,所述云管区控制单元,还用于识别镜像事件的真实IP,判断该真实IP是否与某个可用区仓库的真实IP相匹配,若是则不向该可用区仓库推送镜像。Further, the cloud management area control unit is further configured to identify the real IP of the mirror event, determine whether the real IP matches the real IP of the available area warehouse, and if not, push the image to the available area warehouse.
此外,本申请实施例还提出一种Docker镜像仓库的镜像同步设备,所述Docker镜像仓库的镜像同步设备包括存储器、处理器和存储在所述存储器上并可在所述处理器上运行的Docker镜像仓库的镜像同步程序,所述Docker镜像仓库的镜像同步配程序被所述处理器执行时实现如上述的Docker镜像仓库的镜像同步方法的步骤。In addition, the embodiment of the present application further provides a mirror synchronization device of a Docker image repository, where the mirror synchronization device of the Docker image repository includes a memory, a processor, and a Docker stored on the memory and executable on the processor. A mirror synchronization program of the mirror repository, the mirror synchronization program of the Docker image repository being executed by the processor to implement the steps of the image synchronization method of the Docker image repository as described above.
此外,本申请实施例还提出一种计算机可读存储介质,所述计算机可读存储介质上存储有Docker镜像仓库的镜像同步程序,所述Docker镜像仓库的镜像同步程序被处理器执行时实现上述的Docker镜像仓库的镜像同步方法的步骤In addition, the embodiment of the present application further provides a computer readable storage medium, where the image synchronization storage program stores a mirror synchronization program of a Docker image repository, and the image synchronization program of the Docker image repository is implemented by the processor. Steps to the image synchronization method of the Docker image repository
当然,本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关硬件(如处理器,控制器等)来完成,所述的程序可存储于一计算机可读取的存储介质中,该程序在执行时可包括如上述各方法实施例的流程。其中所述的存储介质可为存储器、磁碟、光盘等。Certainly, those skilled in the art can understand that all or part of the processes in the foregoing embodiments can be implemented by a computer program to instruct related hardware (such as a processor, a controller, etc.), and the program can be stored in one. In a computer readable storage medium, the program, when executed, may include the processes of the various method embodiments as described above. The storage medium described therein may be a memory, a magnetic disk, an optical disk, or the like.
应当理解的是,本申请的应用不限于上述的举例,对本领域普通技术人员来说,可以根据上述说明加以改进或变换,所有这些改进和变换都应属于本申请所附权利要求的保护范围。It should be understood that the application of the present application is not limited to the above-described examples, and those skilled in the art can make modifications and changes in accordance with the above description, all of which are within the scope of the appended claims.

Claims (20)

  1. 一种Docker镜像仓库的镜像同步方法,其特征在于,所述镜像同步方法包括如下步骤: A mirror synchronization method for a Docker image repository, characterized in that the image synchronization method comprises the following steps:
    云管区仓库收到某一可用区仓库推送的镜像时,通知云管区控制单元收到镜像事件;When the cloud management area warehouse receives the image pushed by the warehouse of a certain available area, the cloud control area control unit is notified to receive the mirroring event;
    云管区控制单元解析镜像事件,当判断镜像事件需要同步时,控制云管区仓库将镜像同步至相应的可用区仓库。The cloud management area control unit resolves the mirror event. When it is determined that the mirror event needs to be synchronized, the cloud management area warehouse is controlled to synchronize the image to the corresponding available area warehouse.
  2. 根据权利要求1所述的Docker镜像仓库的镜像同步方法,其特征在于,所述云管区仓库收到可用区仓库推送的镜像事件时,通知云管区控制单元收到所述镜像事件的步骤之前还包括:The image synchronization method of the Docker image warehouse according to claim 1, wherein the cloud management area warehouse notifies the cloud management area control unit of the mirror event before receiving the image event pushed by the available area warehouse. include:
    由某一可用区控制单元控制该可用区仓库向云管区仓库推送镜像。The available area warehouse controls the available area warehouse to push the image to the cloud area warehouse.
  3. 根据权利要求1所述的Docker镜像仓库的镜像同步方法,其特征在于,所述云管区控制单元解析镜像事件,当判断镜像事件需要同步时,控制云管区仓库将镜像同步至相应的可用区仓库的步骤包括:The image synchronization method of the Docker image warehouse according to claim 1, wherein the cloud management area control unit parses the image event, and when the image event needs to be synchronized, the cloud management area warehouse is controlled to synchronize the image to the corresponding available area warehouse. The steps include:
    所述云管区控制单元解析镜像事件,并判断镜像事件是拉取事件还是推送事件;The cloud management area control unit parses the mirroring event, and determines whether the mirroring event is a pull event or a push event;
    若镜像事件为推送事件,确定该镜像事件需要同步,并调用云管区仓库的API接口将镜像同步至相应的可用区仓库。If the mirror event is a push event, it is determined that the mirror event needs to be synchronized, and the API interface of the cloud management area warehouse is called to synchronize the image to the corresponding available area warehouse.
  4. 根据权利要求3所述的Docker镜像仓库的镜像同步方法,其特征在于,若镜像事件为推送事件,确定该镜像事件需要同步,并调用云管区仓库的API接口将镜像同步至相应的可用区仓库的步骤包括:The mirror synchronization method of the Docker image warehouse according to claim 3, wherein if the mirror event is a push event, it is determined that the mirror event needs to be synchronized, and the API interface of the cloud management area warehouse is called to synchronize the image to the corresponding available area warehouse. The steps include:
    若镜像事件为推送事件,确定该镜像事件需要同步;If the mirroring event is a push event, it is determined that the mirroring event needs to be synchronized;
    解析所述镜像事件的来源以获取推送该镜像的可用区仓库;Parsing the source of the mirrored event to obtain an available area repository that pushes the image;
    调用云管区仓库的API接口将镜像同步至除推送给镜像的可用区仓库之外的其他各可用区仓库。 Call the API interface of the cloud management area repository to synchronize the image to each free area warehouse except the free area warehouse pushed to the image.
  5. 根据权利要求1所述的Docker镜像仓库的镜像同步方法,其特征在于,所述云管区控制单元解析镜像事件,当判断镜像事件需要同步时,控制云管区仓库将镜像同步至相应的可用区仓库的步骤之后,还包括:The image synchronization method of the Docker image warehouse according to claim 1, wherein the cloud management area control unit parses the image event, and when the image event needs to be synchronized, the cloud management area warehouse is controlled to synchronize the image to the corresponding available area warehouse. After the steps, it also includes:
    各可用区仓库接收到镜像时,通知该可用区控制单元收到所述镜像事件;When each available area warehouse receives the image, it notifies the available area control unit to receive the mirroring event;
    该可用区控制单元判断所述镜像事件是否来源于云管区,如果是,该可用区仓库将不再继续分发该镜像。The availability zone control unit determines whether the mirroring event originates from a cloud management zone, and if so, the free zone repository will no longer continue to distribute the image.
  6. 根据权利要求2所述的Docker镜像仓库的镜像同步方法,其特征在于,所述云管区控制单元解析镜像事件,当判断镜像事件需要同步时,控制云管区仓库将镜像同步至相应的可用区仓库的步骤之后,还包括:The image synchronization method of the Docker image warehouse according to claim 2, wherein the cloud management area control unit parses the image event, and when the image event needs to be synchronized, the cloud management area warehouse is controlled to synchronize the image to the corresponding available area warehouse. After the steps, it also includes:
    各可用区仓库接收到镜像时,通知该可用区控制单元收到所述镜像事件;When each available area warehouse receives the image, it notifies the available area control unit to receive the mirroring event;
    该可用区控制单元判断所述镜像事件是否来源于云管区,如果是,该可用区仓库将不再继续分发该镜像。The availability zone control unit determines whether the mirroring event originates from a cloud management zone, and if so, the free zone repository will no longer continue to distribute the image.
  7. 根据权利要求3所述的Docker镜像仓库的镜像同步方法,其特征在于,所述云管区控制单元解析镜像事件,当判断镜像事件需要同步时,控制云管区仓库将镜像同步至相应的可用区仓库的步骤之后,还包括:The image synchronization method of the Docker image warehouse according to claim 3, wherein the cloud management area control unit parses the image event, and when the image event needs to be synchronized, the cloud management area warehouse is controlled to synchronize the image to the corresponding available area warehouse. After the steps, it also includes:
    各可用区仓库接收到镜像时,通知该可用区控制单元收到所述镜像事件;When each available area warehouse receives the image, it notifies the available area control unit to receive the mirroring event;
    该可用区控制单元判断所述镜像事件是否来源于云管区,如果是,该可用区仓库将不再继续分发该镜像。The availability zone control unit determines whether the mirroring event originates from a cloud management zone, and if so, the free zone repository will no longer continue to distribute the image.
  8. 根据权利要求4所述的Docker镜像仓库的镜像同步方法,其特征在于,所述云管区控制单元解析镜像事件,当判断镜像事件需要同步时,控制云管区仓库将镜像同步至相应的可用区仓库的步骤之后,还包括:The image synchronization method of the Docker image warehouse according to claim 4, wherein the cloud management area control unit resolves the mirror event, and when the mirror event needs to be synchronized, the cloud management area warehouse is controlled to synchronize the image to the corresponding available area warehouse. After the steps, it also includes:
    各可用区仓库接收到镜像时,通知该可用区控制单元收到所述镜像事件;When each available area warehouse receives the image, it notifies the available area control unit to receive the mirroring event;
    该可用区控制单元判断所述镜像事件是否来源于云管区,如果是,该可用区仓库将不再继续分发该镜像。The availability zone control unit determines whether the mirroring event originates from a cloud management zone, and if so, the free zone repository will no longer continue to distribute the image.
  9. 根据权利要求1所述的Docker镜像仓库的镜像同步方法,其特征在于,当各可用区均有多个仓库时,云管区控制单元控制云管区仓库将镜像同步至相应的可用区仓库的步骤包括:The image synchronization method of the Docker image warehouse according to claim 1, wherein when the available areas have a plurality of warehouses, the cloud management unit control unit controls the cloud management area warehouse to synchronize the mirrors to the corresponding available area warehouses. :
    云管区控制单元识别镜像事件的真实IP,判断该真实IP是否与某个可用区仓库的真实IP相匹配,若是则不向该可用区仓库推送镜像。The cloud management area control unit identifies the real IP of the mirror event, determines whether the real IP matches the real IP of an available area warehouse, and if so, does not push the image to the available area warehouse.
  10. 一种Docker镜像仓库的镜像同步系统,其特征在于,所述镜像同步系统包括:A mirror synchronization system of a Docker image warehouse, characterized in that the image synchronization system comprises:
    云管区仓库,用于收到某一可用区仓库推送的镜像时,通知云管区控制单元收到镜像事件;The cloud management area warehouse is configured to notify the cloud management area control unit to receive the mirroring event when receiving the image pushed by the warehouse of an available area;
    云管区控制单元,用于解析所述镜像事件,当判断镜像事件需要同步时,控制云管区仓库将镜像同步至相应的可用区仓库。The cloud management area control unit is configured to parse the mirroring event. When it is determined that the mirroring event needs to be synchronized, the cloud management area warehouse is controlled to synchronize the image to the corresponding available area warehouse.
  11. 根据权利要求10所述的Docker镜像仓库的镜像同步系统,其特征在于,还包括:The image synchronization system of the Docker image repository according to claim 10, further comprising:
    可用区控制单元,用于控制该可用区仓库向云管区仓库推送镜像。 The available area control unit is configured to control the available area warehouse to push the image to the cloud management area warehouse.
  12. 如权利要求10所述的Docker镜像仓库的镜像同步系统,其特征在于,A mirror synchronization system for a Docker image repository according to claim 10, wherein
    所述云管区控制单元,还用于解析镜像事件,并判断镜像事件是拉取事件还是推送事件;The cloud management area control unit is further configured to parse the mirroring event, and determine whether the mirroring event is a pull event or a push event;
    若镜像事件为推送事件,确定该镜像事件需要同步,并调用云管区仓库的API接口将镜像同步至相应的可用区仓库If the mirroring event is a push event, it is determined that the mirroring event needs to be synchronized, and the API interface of the cloud management area warehouse is called to synchronize the image to the corresponding available area warehouse.
  13. 根据权利要求12所述的Docker镜像仓库的镜像同步系统,其特征在于,所述云管区控制单元,还用于The image synchronization system of the Docker image warehouse according to claim 12, wherein the cloud management area control unit is further used for
    若镜像事件为推送事件,确定该镜像事件需要同步;If the mirroring event is a push event, it is determined that the mirroring event needs to be synchronized;
    解析所述镜像事件的来源以获取推送该镜像的可用区仓库;Parsing the source of the mirrored event to obtain an available area repository that pushes the image;
    调用云管区仓库的API接口将镜像同步至除推送给镜像的可用区仓库之外的其他各可用区仓库。Call the API interface of the cloud management area repository to synchronize the image to each free area warehouse except the free area warehouse pushed to the image.
  14. 根据权利要求11所述的Docker镜像仓库的镜像同步系统,其特征在于,还包括:The image synchronization system of the Docker image repository according to claim 11, further comprising:
    可用区仓库,用于接收到镜像时,通知该可用区控制单元收到所述镜像事件;The available area warehouse is configured to notify the available area control unit to receive the mirroring event when receiving the image;
    所述可用区控制单元,还用于接判断所述镜像事件是否来源于云管区,如果是,该可用区仓库将不再继续分发该镜像。The available area control unit is further configured to determine whether the mirroring event is from a cloud management area, and if so, the available area warehouse will not continue to distribute the image.
  15. 根据权利要求12所述的Docker镜像仓库的镜像同步系统,其特征在于,还包括:The image synchronization system of the Docker image repository according to claim 12, further comprising:
    可用区仓库,用于接收到镜像时,通知该可用区控制单元收到所述镜像事件;The available area warehouse is configured to notify the available area control unit to receive the mirroring event when receiving the image;
    所述可用区控制单元,还用于接判断所述镜像事件是否来源于云管区,如果是,该可用区仓库将不再继续分发该镜像。The available area control unit is further configured to determine whether the mirroring event is from a cloud management area, and if so, the available area warehouse will not continue to distribute the image.
  16. 根据权利要求13所述的Docker镜像仓库的镜像同步系统,其特征在于,还包括:The image synchronization system of the Docker image repository according to claim 13, further comprising:
    可用区仓库,用于接收到镜像时,通知该可用区控制单元收到所述镜像事件;The available area warehouse is configured to notify the available area control unit to receive the mirroring event when receiving the image;
    所述可用区控制单元,还用于接判断所述镜像事件是否来源于云管区,如果是,该可用区仓库将不再继续分发该镜像。The available area control unit is further configured to determine whether the mirroring event is from a cloud management area, and if so, the available area warehouse will not continue to distribute the image.
  17. 根据权利要求14所述的Docker镜像仓库的镜像同步系统,其特征在于,还包括:The image synchronization system of the Docker image repository according to claim 14, further comprising:
    可用区仓库,用于接收到镜像时,通知该可用区控制单元收到所述镜像事件;The available area warehouse is configured to notify the available area control unit to receive the mirroring event when receiving the image;
    所述可用区控制单元,还用于接判断所述镜像事件是否来源于云管区,如果是,该可用区仓库将不再继续分发该镜像。The available area control unit is further configured to determine whether the mirroring event is from a cloud management area, and if so, the available area warehouse will not continue to distribute the image.
  18. 根据权利要求10所述的Docker镜像仓库的镜像同步系统,其特征在于,所述云管区控制单元,还用于识别镜像事件的真实IP,判断该真实IP是否与某个可用区仓库的真实IP相匹配,若是则不向该可用区仓库推送镜像。The mirror synchronization system of the Docker mirror warehouse according to claim 10, wherein the cloud management area control unit is further configured to identify a real IP of the mirror event, and determine whether the real IP is a real IP of an available area warehouse. Match, if not, push the image to the free area repository.
  19. 一种Docker镜像仓库的镜像同步设备,其特征在于,所述Docker镜像仓库的镜像同步设备包括存储器、处理器和存储在所述存储器上并可在所述处理器上运行的Docker镜像仓库的镜像同步程序,所述Docker镜像仓库的镜像同步配程序被所述处理器执行时实现如权利要求1所述的Docker镜像仓库的镜像同步方法的步骤。A mirror synchronization device of a Docker image repository, wherein the mirror synchronization device of the Docker image repository includes a memory, a processor, and a mirror of a Docker image repository stored on the memory and executable on the processor A synchronization program, the step of implementing the image synchronization method of the Docker image repository of claim 1 when the image synchronization program of the Docker image repository is executed by the processor.
  20. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质上存储有Docker镜像仓库的镜像同步程序,所述Docker镜像仓库的镜像同步程序被处理器执行时实现如权利要求1所述的Docker镜像仓库的镜像同步方法的步骤。 A computer readable storage medium, wherein the computer readable storage medium stores a mirror synchronization program of a Docker image repository, and the image synchronization program of the Docker image repository is executed by the processor as claimed in claim 1. The steps of the mirror synchronization method of the Docker image repository.
PCT/CN2018/083947 2017-06-21 2018-04-20 Method, system, device, and computer readable storage medium for synchronizing image WO2018233370A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201710473796.6 2017-06-21
CN201710473796.6A CN107247793B (en) 2017-06-21 2017-06-21 Mirror image synchronization method and mirror image synchronization system of Docker mirror image warehouse

Publications (1)

Publication Number Publication Date
WO2018233370A1 true WO2018233370A1 (en) 2018-12-27

Family

ID=60019519

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/083947 WO2018233370A1 (en) 2017-06-21 2018-04-20 Method, system, device, and computer readable storage medium for synchronizing image

Country Status (2)

Country Link
CN (1) CN107247793B (en)
WO (1) WO2018233370A1 (en)

Families Citing this family (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107247793B (en) * 2017-06-21 2020-03-17 平安科技(深圳)有限公司 Mirror image synchronization method and mirror image synchronization system of Docker mirror image warehouse
CN107948201B (en) * 2017-12-29 2020-11-13 平安科技(深圳)有限公司 Authority authentication method and system for Docker mirror warehouse
CN108200155A (en) * 2017-12-29 2018-06-22 平安科技(深圳)有限公司 The mirror image synchronization method in Docker mirror images warehouse and mirror image synchronization system
CN110099076A (en) * 2018-01-29 2019-08-06 中兴通讯股份有限公司 A kind of method and its system that mirror image pulls
WO2019165573A1 (en) * 2018-02-27 2019-09-06 深圳中兴力维技术有限公司 Docker-based image synchronization method, device and system
CN110196679B (en) * 2018-03-21 2023-01-17 腾讯科技(深圳)有限公司 Distributed deployment system, object management method, device, medium and electronic equipment
CN109062663B (en) * 2018-07-19 2020-07-17 北京百度网讯科技有限公司 Mirror image distribution method, device and storage medium
CN109688232B (en) * 2019-01-28 2021-09-21 杭州涂鸦信息技术有限公司 Mirror image backtracking method, mirror image backtracking system and proxy server
CN113315795B (en) * 2020-02-26 2024-03-05 顺丰科技有限公司 Cloud host mirror synchronization method, device and storage medium
CN111291017B (en) * 2020-03-03 2024-04-05 中国工商银行股份有限公司 Mirror image storage and extraction method and device of mirror image warehouse
CN113238831A (en) * 2021-04-30 2021-08-10 中核武汉核电运行技术股份有限公司 Nuclear power production service loading method and device based on container technology
CN113505180B (en) * 2021-09-10 2022-02-22 苏州浪潮智能科技有限公司 Method, device and equipment for synchronizing mirror images in multi-cloud platform and readable medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106528224A (en) * 2016-11-03 2017-03-22 腾讯科技(深圳)有限公司 Content updating method and system for Docker container, and server
CN106708599A (en) * 2016-12-01 2017-05-24 携程旅游信息技术(上海)有限公司 Virtual machine mirror image sending system and method
CN106776149A (en) * 2017-01-04 2017-05-31 郑州云海信息技术有限公司 Local container mirror image is uploaded to the method and system in mirror image warehouse
CN107247793A (en) * 2017-06-21 2017-10-13 平安科技(深圳)有限公司 The mirror image synchronization method and mirror image synchronization system in Docker mirror images warehouse

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105119913A (en) * 2015-08-13 2015-12-02 东南大学 Web server architecture based on Docker and interactive method between modules
CN105515864B (en) * 2015-12-11 2019-05-21 深圳市中润四方信息技术有限公司 Container resource-adaptive method of adjustment and system

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106528224A (en) * 2016-11-03 2017-03-22 腾讯科技(深圳)有限公司 Content updating method and system for Docker container, and server
CN106708599A (en) * 2016-12-01 2017-05-24 携程旅游信息技术(上海)有限公司 Virtual machine mirror image sending system and method
CN106776149A (en) * 2017-01-04 2017-05-31 郑州云海信息技术有限公司 Local container mirror image is uploaded to the method and system in mirror image warehouse
CN107247793A (en) * 2017-06-21 2017-10-13 平安科技(深圳)有限公司 The mirror image synchronization method and mirror image synchronization system in Docker mirror images warehouse

Also Published As

Publication number Publication date
CN107247793A (en) 2017-10-13
CN107247793B (en) 2020-03-17

Similar Documents

Publication Publication Date Title
WO2018233370A1 (en) Method, system, device, and computer readable storage medium for synchronizing image
WO2017088664A1 (en) Data processing method and apparatus for cluster file system
WO2019100638A1 (en) Data synchronization method, device and equipment, and storage medium
WO2019128174A1 (en) Method for playing audio, smart television and computer-readable storage medium
WO2018107610A1 (en) Service data processing method, system and device, and computer-readable storage medium
WO2018076866A1 (en) Data processing method, device, storage medium, electronic device and server
WO2018228050A1 (en) Method and device for preventing leakage of sensitive information, and storage medium
WO2016000560A1 (en) File transmission method, file transmission apparatus, and file transmission system
WO2018076811A1 (en) Data sharing method, device, system, storage medium and electronic device
WO2018076864A1 (en) Data synchronization method, apparatus, storage medium and electronic device
WO2018014567A1 (en) Method for improving performance of virtual machine, and terminal, device and computer-readable storage medium
WO2015106497A1 (en) Dynamic interrupt balanced mapping method based on current vcpu scheduling state
WO2018076812A1 (en) Data request response method and device, storage medium, server and system
WO2019127971A1 (en) Image synchronization method for image registry, system, device, and storage medium
WO2017206883A1 (en) Application processing method and apparatus, storage medium, and electronic device
WO2019056733A1 (en) Concurrent volume control method, application server, system and storage medium
WO2015120774A1 (en) Network access method and apparatus applied to mobile application
WO2018076875A1 (en) Backup data synchronisation method, apparatus, storage medium, electronic device, and server
WO2017219485A1 (en) Smart television and control method therefor
WO2018028121A1 (en) Method and device for managing storage space of data partition
WO2017206377A1 (en) Method and device for synchronous playback of program
WO2018120680A1 (en) Virtual disk backup system, method, apparatus, service host and storage medium
WO2019161597A1 (en) Information sending method, apparatus and device based on instant messaging, and storage medium
WO2016058258A1 (en) Terminal remote control method and system
WO2023033588A1 (en) System for controlling data flow in virtualization terminal, and method thereof

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

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205 DATED 15/05/2020)

122 Ep: pct application non-entry in european phase

Ref document number: 18821567

Country of ref document: EP

Kind code of ref document: A1