Mirror synchronization method, device, docker host and storage medium

By implementing the broadcast and synchronization of mirror information between docker hosts in the docker cluster, the problem of real-time and low efficiency of mirror synchronization in the prior art is solved, and efficient mirror synchronization without docker registry is achieved.

CN113434249BActive Publication Date: 2025-03-14HANGZHOU QULIAN TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110681373.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-06-18
Publication Date
2025-03-14
Estimated Expiration
2041-06-18

AI Technical Summary

Technical Problem

The prior art has poor real-time and low efficiency when synchronizing images in docker clusters, and depends on docker registry. When the registry is unavailable, synchronization fails.

Method used

By broadcasting the mirror information between docker hosts, the target host obtains the mirror information and local image list of other docker hosts, detects the missing image files, and synchronizes the image files according to the storage address in the image information, achieving mirror synchronization without docker registry.

Benefits of technology

Improve the real-time and efficiency of mirror synchronization in the docker cluster, avoiding dependence on docker registry, and does not interfere with each docker host synchronization process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113434249B_ABST
    Figure CN113434249B_ABST
Patent Text Reader

Abstract

The present application is applicable to the field of computer technology, and particularly relates to a mirror synchronization method, device, docker host and storage medium. A docker host in a docker cluster is used as a target host, and the target host obtains the mirror information broadcasted by other docker hosts and the local mirror list. When it is detected that the mirror file corresponding to the mirror information is missing from the local mirror list, the mirror file is synchronized according to the storage address of the corresponding mirror file in the mirror information, and the mirror file is obtained from other docker hosts for synchronization. There is no need to use a mirror warehouse, and only the mirror information needs to be compared with the local mirror list. Each docker host does not interfere with each other during the synchronization process. Compared with each docker host obtaining the mirror list from the mirror warehouse, the real-time performance is better and the synchronization efficiency is higher.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of computer technology, and in particular, relates to a mirror synchronization method, device, Docker host and storage medium. Background Art

[0002] At present, when an image file is generated on each docker host in a docker cluster, the new image file is sent to the docker registry (image warehouse), and the docker registry is used to store the image file. Other docker hosts periodically pull the image file from the docker registry to complete the image synchronization between docker hosts. However, the existing image synchronization method needs to rely on the docker registry. When the docker registry is unavailable, the image files cannot be synchronized between docker hosts, and the image list needs to be obtained from the docker registry through polling, resulting in poor real-time synchronization and low efficiency. Summary of the invention

[0003] In view of this, the embodiments of the present application provide a mirror synchronization method, device, Docker host and storage medium to solve the problems of poor real-time performance and low efficiency in mirror synchronization in the prior art.

[0004] In a first aspect, an embodiment of the present application provides a mirror synchronization method, the mirror synchronization method is applied to a target host, the target host is any docker host in a docker cluster, and the mirror synchronization method includes:

[0005] Obtaining image information broadcasted by other Docker hosts, where the other Docker hosts refer to Docker hosts other than the target host in the Docker cluster;

[0006] Obtain a local mirror list of the target host;

[0007] If it is detected that the local image list lacks the image file corresponding to the image information, the image file is synchronized according to the storage address of the corresponding image file in the image information.

[0008] In a second aspect, an embodiment of the present application provides a mirror synchronization device, the mirror synchronization device is applied to a target host, the target host is any docker host in a docker cluster, and the mirror synchronization device includes:

[0009] An image information acquisition module is used to acquire image information broadcasted by other Docker hosts, where the other Docker hosts refer to Docker hosts other than the target host in the Docker cluster;

[0010] An image list acquisition module is used to acquire a local image list of the target host;

[0011] The mirror synchronization module is used to synchronize the mirror file according to the storage address of the corresponding mirror file in the mirror information if it is detected that the local mirror list lacks the mirror file corresponding to the mirror information.

[0012] In a third aspect, an embodiment of the present application provides a Docker host, comprising a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the processor implements the mirror synchronization method as described in the first aspect when executing the computer program.

[0013] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the mirror synchronization method as described in the first aspect is implemented.

[0014] In a fifth aspect, an embodiment of the present application provides a computer program product. When the computer program product is run on a docker host, the docker host executes the image synchronization method described in the first aspect above.

[0015] Compared with the prior art, the embodiments of the present application have the following beneficial effects: the present application uses a docker host in a docker cluster as the target host, and the target host obtains the image information broadcasted by other docker hosts and the local image list. When it is detected that the image file corresponding to the image information is missing from the local image list, the image file is synchronized according to the storage address of the corresponding image file in the image information, so as to obtain the image file from other docker hosts for synchronization, without using the image repository, and only needs to compare the image information with the local image list. Each docker host does not interfere with each other during the synchronization process. Compared with each docker host obtaining the image list from the image repository, the real-time performance is better and the synchronization efficiency is higher. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0017] Figure 1 It is a flowchart of a mirror synchronization method provided in Example 1 of the present application;

[0018] Figure 2 This is a schematic diagram of a docker host connection relationship provided in Example 1 of the present application;

[0019] Figure 3 This is a schematic diagram of a mirror synchronization process provided in Example 1 of the present application;

[0020] Figure 4 It is a flowchart of a mirror synchronization method provided in Embodiment 2 of the present application;

[0021] Figure 5 It is a structural diagram of a mirror synchronization device provided in Embodiment 3 of the present application;

[0022] Figure 6 This is a structural diagram of a Docker host provided in Example 4 of the present application. DETAILED DESCRIPTION

[0023] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.

[0024] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or combinations thereof.

[0025] It should also be understood that the term “and / or” used in the specification and appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.

[0026] As used in the specification and appended claims of this application, the term "if" can be interpreted as "when" or "uponce" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" can be interpreted as meaning "uponce it is determined" or "in response to determining" or "uponce [described condition or event] is detected" or "in response to detecting [described condition or event]", depending on the context.

[0027] In addition, in the description of the present application specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.

[0028] References to "one embodiment" or "some embodiments" etc. described in the specification of this application mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.

[0029] The docker host in the embodiment of the present application can be a handheld computer, a desktop computer, a laptop computer, an ultra-mobile personal computer (UMPC), a netbook, a cloud server, a personal digital assistant (PDA), etc. The embodiment of the present application does not impose any restrictions on the specific type of the docker host.

[0030] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.

[0031] In order to illustrate the technical solution of the present application, a specific embodiment is provided below for illustration.

[0032] See also Figure 1 , is a flow chart of a mirror synchronization method provided in the first embodiment of the present application, the mirror synchronization method is applied to a target host, the target host is any docker host in the docker cluster, such as Figure 1 As shown, the mirror synchronization method may include the following steps:

[0033] Step S101, obtaining the image information broadcast by other Docker hosts.

[0034] Among them, the docker cluster can refer to a cluster composed of at least two docker hosts, the docker host is a host running the docker service, the target host is any docker host in the docker cluster, and other docker hosts refer to docker hosts in the docker cluster except the target host.

[0035] Other docker hosts will broadcast their own image information. For example, when a docker host reposts an image file, the docker host will broadcast the image information of the image file, which may include the name of the image file, the storage address of the image file in the host, etc. The target host is connected to other docker hosts so that it can obtain the image information when other docker hosts broadcast it.

[0036] Optionally, before obtaining the image information broadcast by other Docker hosts, also include:

[0037] Establish connections between the target host and other docker hosts through the gossip protocol;

[0038] Accordingly, obtaining the image information broadcast by other Docker hosts includes:

[0039] When the target host successfully establishes a connection with other Docker hosts, the image information broadcast by other Docker hosts is obtained.

[0040] Among them, the gossip protocol is used to realize data broadcast between nodes, which can realize efficient data distribution from a single source point to all nodes and achieve state synchronization of different nodes. Figure 2 As shown, it is a schematic diagram of a docker host connection relationship provided in Example 1 of the present application. The three docker hosts are connected through the gossip protocol. Therefore, the image information broadcast by a docker host through the gossip protocol can reach any docker host in the docker cluster.

[0041] Step S102, obtaining a local image list of the target host.

[0042] Among them, the local image list can refer to the identification information of all image files stored in the target host, that is, the statistical results obtained by counting the labels, identity documents (ID), creation time, resource usage size, storage addresses and other information of all image files stored in the target host.

[0043] The identification information of all image files stored in the target host can be obtained from the local image list. One piece of identification information can identify one image file, and therefore, can be used to find an image file, compare with a new image file, or call an image file.

[0044] Step S103: Check whether the local image list is missing the image file corresponding to the image information.

[0045] The identification information of each image file in the local image list is compared with the acquired image information, that is, it is determined whether the image file corresponding to the image information is stored in the target host. For example, the acquired image information may include a label and ID of the image file, and the label and ID of each image file in the local image list are compared one by one with the label and ID of the image file in the local image list. If the local image list contains the label and ID of the image file in the image information, it is considered that the image file corresponding to the image information is stored in the target host. If the local image list does not contain the label and ID of the image file in the image information, it is considered that the image file corresponding to the image information is not stored in the target host, that is, the image file is missing.

[0046] Step S104: if it is detected that the local image list lacks the image file corresponding to the image information, the image file is synchronized according to the storage address of the corresponding image file in the image information.

[0047] When the image file corresponding to the image information is missing in the target host, in order to meet the image synchronization requirement of the target host, it is necessary to obtain the image file corresponding to the image information locally on the target host and store the image file locally.

[0048] The image information includes the storage address of the image file corresponding to the image information, and the storage address may include the IP address of the docker host storing the image file and the location information in the storage of the docker host. The target host may generate a corresponding acquisition request according to the storage address, and the docker host corresponding to the storage address may send the image file to the target host in response to the acquisition request, thereby synchronizing the image file in the target host.

[0049] Optionally, according to the storage address of the corresponding mirror file in the mirror information, the synchronized mirror file includes:

[0050] Download the image file according to the storage address of the image file corresponding to the image information;

[0051] Mount the image file.

[0052] Among them, first obtain the image file according to the storage address, that is, download the image file to the local of the target host, run the image file to realize the loading of the image file, so as to complete the image synchronization. The loading can be started by calling the docker load command.

[0053] The image synchronization method of the present application can be packaged into an image-daemon service package. Each Docker host in the Docker cluster installs the image-daemon service package, and executing the image-daemon service package can realize image synchronization.

[0054] For example, Figure 3 As shown, it is a schematic diagram of an image synchronization process provided in Example 1 of the present application. There are three docker hosts in the docker cluster, namely host A, host B and host C. Host A, host B and host C are all installed with the image-daemon service package, and the image files of host A, host B and host C have been synchronized. The local image list of each host is [test-image1, test-image2, test-image3].

[0055] When a new image file test-image4 is generated in host A, host A broadcasts the image information of test-image4 to hosts B and C through the gossip protocol.

[0056] Host B, as the target host, executes the image synchronization method. When it detects that the local image list is missing the test-image4, it downloads test-image4 to the local host of host B to achieve image synchronization of host B.

[0057] Host C is used as the target host to execute the image synchronization method. When it is detected that the local image list is missing the test-image4, test-image4 is downloaded to the local host of host C to achieve image synchronization of host C.

[0058] The image information broadcast by other docker hosts can be the image information of newly added image files in other docker hosts, or it can be the image information of all image files in other docker hosts, which is not limited in this application.

[0059] The Docker host in the Docker cluster broadcasts the image information of all local image files at regular intervals. When a new Docker host appears in the Docker cluster, the new Docker host can synchronize all image files through the broadcasted image information of all image files to achieve image synchronization of the new Docker host.

[0060] To add a new docker host, you only need to configure the Internet Protocol (IP) port information of any docker host that already exists in the docker cluster and install the image-daemon service package. You can then connect to other docker hosts through the gossip protocol and perform image synchronization.

[0061] In the embodiment of the present application, a docker host in the docker cluster is used as the target host. The target host obtains the image information broadcasted by other docker hosts and the local image list. When it is detected that the image file corresponding to the image information is missing from the local image list, the image file is synchronized according to the storage address of the corresponding image file in the image information, so as to obtain the image file from other docker hosts for synchronization. There is no need to use the image repository. Only the image information needs to be compared with the local image list. Each docker host does not interfere with each other during the synchronization process. Compared with each docker host obtaining the image list from the image repository, the real-time performance is better and the synchronization efficiency is higher.

[0062] See also Figure 4 , is a flow chart of a mirror synchronization method provided in Embodiment 2 of the present application, such as Figure 4 As shown, the mirror synchronization method may include the following steps:

[0063] Step S401, obtaining the image information broadcast by other Docker hosts.

[0064] Step S402, obtaining a local image list of the target host.

[0065] Step S403: Check whether the local image list is missing the image file corresponding to the image information.

[0066] Step S404: if it is detected that the local image list lacks the image file corresponding to the image information, the image file is synchronized according to the storage address of the corresponding image file in the image information.

[0067] Among them, the content type of steps S401 to S404 is the same as that of the above-mentioned steps S101 to S104, and the description of steps S101 to S104 can be referred to, and will not be repeated here.

[0068] Step S405: monitor the local image list.

[0069] Among them, the target host can obtain the local mirror list once at a certain interval, and compare the local mirror lists obtained twice in succession, so as to determine whether the local mirror list has changed. When the interval time is too long, the change of the local mirror list cannot be discovered in time. When the interval time is too short, the local mirror list needs to be read continuously, occupying resources. Therefore, the interval time should be reasonably set under the premise of being able to monitor the changes in time and ensure the reasonable occupation of resources.

[0070] For example, by obtaining the number of entries in the local mirror list to determine whether the local mirror list has changed, if the number of entries in the local mirror list obtained last time is 5 and the number of entries in the local mirror list obtained currently is 6, it can be determined that the local mirror list has changed.

[0071] For another example, whether the local mirror list has changed is determined by obtaining the update time of the local mirror list. If the update time obtained last time is different from the update time obtained currently, it can be determined that the local mirror list has changed.

[0072] The present application does not limit the logical relationship between step S405 and steps S401 to S404, and step S405 can be implemented independently of steps S401 to S404.

[0073] Step S406: If a new image file is detected in the local image list, the image information of the new image file is broadcast to other Docker hosts.

[0074] If a new image file appears in the target host, the image information of the new image file will be updated in the local image list. When the local image list is monitored to change, it can be determined that the new image file appears in the target host.

[0075] Before broadcasting the image information of the newly added image file to other Docker hosts, the image information of the newly added image file needs to be obtained. For example, according to the creation time corresponding to each image file in the local image list, the image file with the latest creation time is determined to be the newly added image file, so that the image information of the newly added image file can be obtained.

[0076] If the target host in the Docker cluster is connected to other Docker hosts via the gossip protocol, the image information of the newly added image file is broadcasted via the gossip protocol.

[0077] Optionally, after broadcasting the image information of the newly added image file to other Docker hosts, the image synchronization method further includes:

[0078] According to the image information of the newly added image file, the Hypertext Transfer Protocol service is started, so that other Docker hosts can download the newly added image file through the Hypertext Transfer Protocol service.

[0079] The image information of the newly added image file includes the storage address of the newly added image file, and the Hypertext Transfer Protocol (HTTP) service is started, so that other docker hosts can locate the storage address of the newly added image file through the HTTP service and download it.

[0080] Optionally, the mirror synchronization method further includes:

[0081] When the target host successfully connects to the peer node of the blockchain network, if it is detected that the peer node calls the docker service of the target host through the docker agent to initialize the smart contract, the chain code image file of the corresponding smart contract is generated;

[0082] Add the image information of the chain code image file to the local image list.

[0083] Among them, the docker cluster running by the image synchronization method can be used to provide proxy services for the blockchain network. When the application layer of the blockchain network needs to deploy smart contracts, the peer nodes in the blockchain network are accessed through the Software Development Kit (SDK), and the peer nodes in the blockchain network can use the docker service through the docker proxy. The peer node is used to store data and execute specific programs. The stored data includes ledgers and chain codes (i.e., smart contracts), and the executed programs mainly include endorsement and chain code execution.

[0084] When the peer node successfully connects to the target host after calling the docker proxy, the target host will generate an image file corresponding to the smart contract, that is, the chain code image file, which is a type of image file.

[0085] After the target host generates the chain code image file, the image information of the chain code image file is obtained, and the image information of the chain code image file is added to the local image list, so that when the local image list changes, the image information of the chain code image file can be broadcast.

[0086] The image synchronization method of the present application can be packaged into an image-daemon service package. Each Docker host in the Docker cluster installs the image-daemon service package, and executing the image-daemon service package can realize image synchronization.

[0087] For example, there are three Docker hosts in the Docker cluster, namely Host A, Host B and Host C. Host A, Host B and Host C are all installed with the image-daemon service package, and the image files of Host A, Host B and Host C have been synchronized. The local image list of each host is [test-image1, test-image2, test-image3].

[0088] When the peer node calls the docker service of host A through the docker agent to initialize the smart contract, the chain code image file dev-peer0-mycc-chaincode is generated in host A.

[0089] Host A detects the image file and broadcasts the image information of the image file dev-peer0-mycc-chaincode to hosts B and C through the gossip protocol. Host A starts the HTTP service and waits for hosts B and C to download the image file dev-peer0-mycc-chaincode.

[0090] Host B and Host C receive the image information broadcast from Host A. At this time, Host B and Host C compare the image information with the local image list respectively, and determine that the image information is missing locally. According to the storage address in the image information, Host B and Host C download the image file from Host A, and finally load the image file through the docker load command to achieve image synchronization.

[0091] Corresponding to the mirror synchronization method of the above embodiment, Figure 5 A structural block diagram of a mirror synchronization device provided in Embodiment 3 of the present application is shown. The mirror synchronization device is applied to a target host, which is any Docker host in a Docker cluster. For ease of explanation, only the parts related to the embodiment of the present application are shown.

[0092] See also Figure 5 , the mirror synchronization device comprises:

[0093] An image information acquisition module 51 is used to acquire image information broadcasted by other Docker hosts, where other Docker hosts refer to Docker hosts other than the target host in the Docker cluster;

[0094] The image list acquisition module 52 is used to acquire the local image list of the target host;

[0095] The image synchronization module 53 is used to synchronize the image file according to the storage address of the corresponding image file in the image information if it is detected that the local image list lacks the image file corresponding to the image information.

[0096] Optionally, the mirror synchronization device further includes:

[0097] The connection establishment module is used to establish a connection between the target host and other Docker hosts through the gossip protocol before obtaining the image information broadcast by other Docker hosts;

[0098] Accordingly, the image information acquisition module 51 is specifically used for:

[0099] When the target host successfully establishes a connection with other Docker hosts, the image information broadcast by other Docker hosts is obtained.

[0100] Optionally, the mirror synchronization module 53 includes:

[0101] A download unit, used to download the image file according to the storage address of the corresponding image file in the image information;

[0102] Loading unit, used to load image files.

[0103] Optionally, the mirror synchronization device further includes:

[0104] The chain code image generation module is used to generate a chain code image file corresponding to the smart contract if it is detected that the peer node calls the docker service of the target host through the docker agent to initialize the smart contract when the target host successfully connects to the peer node of the blockchain network;

[0105] The list adds a new module, which is used to add the image information of the chain code image file to the local image list.

[0106] Optionally, the mirror synchronization device further includes:

[0107] List monitoring module, used to monitor the local image list;

[0108] A new image broadcast module is added, which is used to broadcast the image information of the newly added image file to other Docker hosts if a new image file is detected in the local image list.

[0109] Optionally, the mirror synchronization device further includes:

[0110] The startup module is used to start the hypertext transfer protocol service according to the image information of the newly added image file after broadcasting the image information of the newly added image file to other docker hosts, so that other docker hosts can download the newly added image file through the hypertext transfer protocol service.

[0111] It should be noted that the information interaction, execution process and other contents between the above-mentioned modules are based on the same concept as the method embodiment of the present application. Their specific functions and technical effects can be found in the method embodiment part and will not be repeated here.

[0112] Figure 6 This is a schematic diagram of the structure of a docker host provided in Example 4 of this application. Figure 6 As shown, the Docker host 6 of this embodiment includes: at least one processor 60 ( Figure 6 Only one is shown), a memory 61, and a computer program 62 stored in the memory 61 and executable on at least one processor 60, wherein when the processor 60 executes the computer program 62, the steps in any of the above-mentioned embodiments of the mirror synchronization method are implemented.

[0113] The docker host 6 may include, but is not limited to, a processor 60 and a memory 61. Those skilled in the art will appreciate that Figure 6 This is only an example of the Docker host 6 and does not constitute a limitation on the Docker host 6. The Docker host 6 may include more or fewer components than shown in the figure, or a combination of certain components, or different components, for example, it may also include input and output devices, network access devices, etc.

[0114] The processor 60 may be a CPU, or other general-purpose processors, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.

[0115] In some embodiments, the memory 61 may be an internal storage unit of the docker host 6, such as a hard disk or memory of the docker host 6. In other embodiments, the memory 61 may also be an external storage device of the docker host 6, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the docker host 6. Further, the memory 61 may also include both an internal storage unit and an external storage device of the docker host 6. The memory 61 is used to store an operating system, an application, a boot loader (BootLoader), data, and other programs, such as program codes of computer programs, etc. The memory 61 may also be used to temporarily store data that has been output or is to be output.

[0116] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device is divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated into a processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned device can refer to the corresponding process in the above-mentioned method embodiment, which will not be repeated here. If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, which can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned method embodiment when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may at least include: any entity or device capable of carrying computer program code, recording medium, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium. For example, a USB flash drive, a mobile hard disk, a magnetic disk or an optical disk. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electric carrier signals and telecommunication signals.

[0117] The present application implements all or part of the processes in the above-mentioned embodiment method, and may also be completed by a computer program product. When the computer program product runs on a docker host, the docker host can implement the steps in the above-mentioned method embodiment when executing.

[0118] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0119] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0120] In the embodiments provided in the present application, it should be understood that the disclosed device / docker host and method can be implemented in other ways. For example, the device / docker host embodiments described above are only schematic. For example, the division of modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0121] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0122] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.

Claims

1. A mirror synchronization method, characterized in that: The image synchronization method is applied to a target host, where the target host is any Docker host in a Docker cluster. The image synchronization method includes: Establish a connection between the target host and other docker hosts through the gossip protocol; When the target host successfully establishes a connection with the other Docker hosts, obtaining the image information broadcasted by the other Docker hosts, wherein the other Docker hosts refer to the Docker hosts other than the target host in the Docker cluster; Obtain a local mirror list of the target host; If it is detected that the local image list is missing the image file corresponding to the image information, the image file is synchronized according to the storage address of the corresponding image file in the image information, where the storage address includes the IP of the docker host of the image file and the location information in the docker host memory.

2. The mirror synchronization method according to claim 1, characterized in that: The synchronizing the mirror file according to the storage address of the corresponding mirror file in the mirror information comprises: Download the image file according to the storage address of the image file corresponding to the image information; Load the image file.

3. The mirror synchronization method according to claim 1, characterized in that: The mirror synchronization method also includes: When deploying a smart contract, when the peer node of the blockchain network successfully connects to the target host through the docker agent, the target host generates a chain code image file corresponding to the smart contract; Add the image information of the chain code image file to the local image list.

4. The mirror synchronization method according to any one of claims 1 to 3, characterized in that: The mirror synchronization method also includes: Monitor the local mirror list; If a new image file is detected in the local image list, the image information of the new image file is broadcast to the other Docker hosts.

5. The mirror synchronization method according to claim 4, characterized in that: After broadcasting the image information of the newly added image file to the other Docker hosts, the image synchronization method further includes: According to the image information of the newly added image file, a hypertext transfer protocol service is started, so that the other docker hosts download the newly added image file through the hypertext transfer protocol service.

6. A mirror synchronization device, characterized in that: The image synchronization device is applied to a target host, and the target host is any Docker host in a Docker cluster. The image synchronization device includes: The connection establishment module is used to establish a connection between the target host and other docker hosts through the gossip protocol; An image information acquisition module is used to acquire image information broadcasted by other Docker hosts when the target host successfully establishes a connection with other Docker hosts, wherein the other Docker hosts refer to Docker hosts other than the target host in the Docker cluster; An image list acquisition module is used to acquire a local image list of the target host; The image synchronization module is used to synchronize the image file according to the storage address of the corresponding image file in the image information if it is detected that the local image list is missing the image file corresponding to the image information, wherein the storage address includes the IP of the docker host of the image file and the location information in the docker host memory.

7. A docker host, characterized in that: The Docker host includes a processor, a memory, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the mirror synchronization method according to any one of claims 1 to 6 is implemented.

8. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the mirror synchronization method according to any one of claims 1 to 6 is implemented.

Citation Information

Patent Citations

  • Mirror image file distribution method and system, computer readable storage medium and electronic equipment

    CN108322496A

  • Docker-based Fabric network remote deployment method, device and system

    CN111343004A