CN112799780A - Container mirror image sharing method, device, server, equipment and medium - Google Patents

Container mirror image sharing method, device, server, equipment and medium Download PDF

Info

Publication number
CN112799780A
CN112799780A CN202110057434.5A CN202110057434A CN112799780A CN 112799780 A CN112799780 A CN 112799780A CN 202110057434 A CN202110057434 A CN 202110057434A CN 112799780 A CN112799780 A CN 112799780A
Authority
CN
China
Prior art keywords
mirror image
container
target
path
image
Prior art date
Legal status (The legal status 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 status listed.)
Pending
Application number
CN202110057434.5A
Other languages
Chinese (zh)
Inventor
厉昆
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Unionpay Co Ltd
Original Assignee
China Unionpay Co Ltd
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 China Unionpay Co Ltd filed Critical China Unionpay Co Ltd
Priority to CN202110057434.5A priority Critical patent/CN112799780A/en
Publication of CN112799780A publication Critical patent/CN112799780A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/61Installation
    • G06F8/63Image based installation; Cloning; Build to order
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44505Configuring for program initiating, e.g. using registry, configuration files

Abstract

The application discloses a container mirror image sharing method, a device, a server, equipment and a medium, wherein the container mirror image sharing method is applied to a client, and comprises the following steps: acquiring a path of a local mounting point, wherein the local mounting point is mounted with a shared directory in a mirror cache server, the shared directory comprises subdirectories of container mirrors cached in the mirror cache server, and the container mirrors are stored under the subdirectories of the container mirrors; determining a path of a target mirror image according to the path of the local mounting point and the shared directory, wherein the target mirror image is a mirror image of a target container to be started; and sharing the target mirror image cached in the mirror image cache server according to the path of the target mirror image. By using the container mirror image sharing method disclosed by the application, the target container can be started quickly in time, the space resource of computer equipment is saved, the instantaneous access pressure to the mirror image warehouse when the containers are started in batch is reduced, and the network bottleneck is avoided.

Description

Container mirror image sharing method, device, server, equipment and medium
Technical Field
The present application belongs to the field of computer technologies, and in particular, to a container mirror sharing method, apparatus, server, device, and medium.
Background
The container is a light process isolation technology, and provides a resource independent running environment for application software and dependent components thereof. Each container has its own independent file system, Central Processing Unit (CPU) and memory resources, thereby ensuring the independent relationship between the processes inside the container and the processes outside the container. The container has the advantages of convenient deployment, quick start, less resource consumption, good isolation, high performance and the like.
The file system of a running container is usually composed of two parts, one part is a read-only layer located at the bottom layer, and the other part is a read-write layer located at the upper layer. The content of the read-only layer is not changed and can be shared by multiple containers. The read-write layer is used for storing data written in the operation process of the containers, and each container has an independent read-write layer. The data in the read-only layer of the container is also called an image, which contains all libraries, executables, configuration files, etc., on which the container starts and runs. To improve utilization of the image, multiple containers may share the image.
On a computer device, multiple containers using the same image may share an image. Sharing of container images may provide many benefits, such as saving time, saving disk space, saving network bandwidth, and the like.
In the related art, when a container needs to be started, a mirror image of the container is first pulled from a mirror image warehouse, and after the mirror image of the container is pulled, the container can be started. Because the time spent on pulling the container mirror image is long, the container cannot be started timely and quickly under the condition that the container needs to be started.
In addition, since the image can be shared by a plurality of containers on the same computer device, the same image needs to be stored on a plurality of computer devices, which wastes space resources on the computer devices.
In addition, in the case of starting containers in batches, pulling container images from the image repository at the same time may cause a relatively large pressure on the image repository, and a network bottleneck problem may be encountered when a plurality of computer devices pull images at the same time.
Disclosure of Invention
The embodiment of the application provides a container mirror image sharing method, a container mirror image sharing device, a server, equipment and a medium, and the technical problems that a container cannot be started timely and quickly, space resources on computer equipment are wasted, and a mirror image warehouse is subjected to large pressure and network bottleneck due to the fact that a mirror image of each container is pulled from the mirror image warehouse at the same time can be solved.
In a first aspect, an embodiment of the present application provides a container mirror sharing method, which is applied to a client, and the method includes:
acquiring a path of a local mounting point, wherein the local mounting point mounts a shared directory in a mirror image cache server, the shared directory comprises subdirectories of container mirror images cached in the mirror image cache server, and the container mirror images are stored under the subdirectories of the container mirror images;
determining a path of a target mirror image according to the path of the local mounting point and the shared directory, wherein the target mirror image is a mirror image of a target container to be started;
and sharing the target mirror image cached in the mirror image cache server according to the path of the target mirror image.
In a second aspect, an embodiment of the present application provides a container mirror sharing method, which is applied to a mirror cache server, and the method includes:
caching container images in an image warehouse;
and generating a shared directory according to the container mirror image, wherein the shared directory comprises subdirectories of the container mirror image, and the container mirror image is stored in the subdirectories of the container mirror image, so that a client of each computer device mounts the shared directory to a local mounting point, determines a path of a target mirror image according to the path of the local mounting point and the shared directory, and shares the target mirror image according to the path of the target mirror image.
In a third aspect, an embodiment of the present application provides a container mirror image sharing apparatus, which is applied to a client, and the apparatus includes:
the first acquisition module is used for acquiring a path of a local mounting point, wherein the local mounting point mounts a shared directory in a mirror cache server, the shared directory comprises subdirectories of container mirrors cached in the mirror cache server, and the container mirrors are stored under the subdirectories of the container mirrors;
the determining module is used for determining a path of a target mirror image according to the path of the local mounting point and the shared directory, wherein the target mirror image is a mirror image of a target container to be started;
and the sharing module is used for sharing the target mirror image cached in the mirror image cache server according to the path of the target mirror image.
In a fourth aspect, an embodiment of the present application provides a container mirror sharing apparatus, which is applied to a mirror cache server, and the apparatus includes:
the caching module is used for caching the container mirror images in the mirror image warehouse;
and the directory generation module is used for generating a shared directory according to the container mirror image, wherein the shared directory comprises subdirectories of the container mirror image, and the container mirror image is stored in the subdirectories of the container mirror image, so that the client of each computer device mounts the shared directory to a local mounting point, determines a path of a target mirror image according to the path of the local mounting point and the shared directory, and shares the target mirror image according to the path of the target mirror image.
In a fifth aspect, an embodiment of the present application provides a computer device, where the computer device includes: a processor and a memory storing computer program instructions, the processor implementing the container image sharing method of the first aspect when executing the computer program instructions.
In a sixth aspect, an embodiment of the present application provides a mirror cache server, where the mirror cache server includes: a processor and a memory storing computer program instructions;
the processor, when executing the computer program instructions, implements the container image sharing method of the second aspect.
In a seventh aspect, the present application provides a computer storage medium, where computer program instructions are stored, and when executed by a processor, implement the container image sharing method according to the first aspect or the container image sharing method according to the second aspect.
The container mirror image sharing method, device, server, equipment and medium of the embodiment of the application have the advantages that the container mirror image and the shared directory comprising the subdirectories of the container mirror image are cached in the mirror image caching server, the container mirror image is stored under the subdirectories, and the shared directory is mounted to a local mounting point of a client. Based on this, for the target container to be started, the client determines the path of the mirror image (i.e. the target mirror image) of the target container according to the shared directory and the path of the local mount point, and then shares the target mirror image cached in the mirror image cache server according to the path of the target mirror image. Firstly, the path of the target mirror image is determined, which is equivalent to the acquisition of the target mirror image, so that the target container can be started after the path of the target mirror image is determined, and the target container does not need to be started after the target mirror image is pulled out, so that the target container can be started timely and quickly, and the starting speed of the target container is improved. And secondly, since the container mirror images cached in the mirror image cache server can be shared through the client, the same container mirror images do not need to be stored on each computer device, so that the local disk space of the computer device is not occupied, and more space resources are saved. And thirdly, in the process of starting and operating the target container, when the mirror image of the target container is needed, reading the mirror image of the target container from the mirror image cache server according to the path of the target mirror image. Thus, the mirror image of the target container is read in a dispersed way in the life cycle of the target container, and the whole mirror image of the target container is not read before starting, so that the instantaneous access pressure on the mirror image warehouse when the containers are started in batch is reduced. Meanwhile, great access pressure to the mirror image cache server can not be caused at the moment of batch starting of the containers, and network bottlenecks are avoided.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings needed to be used in the embodiments of the present application will be briefly described below, and it is obvious that the drawings described below are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
FIG. 1 is a block diagram of one embodiment of a system for implementing a container image sharing method provided herein.
Fig. 2 is a timing diagram illustrating an embodiment of a container mirror sharing method provided in the present application.
Fig. 3 is a timing diagram illustrating another embodiment of a container mirror sharing method provided in the present application.
Fig. 4 is a timing diagram illustrating a container mirror sharing method according to another embodiment of the present disclosure.
Fig. 5 is a flowchart illustrating an embodiment of a container image sharing method for a client according to the present application.
Fig. 6 is a flowchart illustrating an embodiment of a container image sharing method for an image cache server according to the present application.
Fig. 7 is a schematic structural diagram of an embodiment of a container image sharing apparatus for a client according to the present application.
Fig. 8 is a schematic structural diagram of an embodiment of a container image sharing apparatus for an image cache server according to the present application.
Fig. 9 shows a hardware structure diagram of an embodiment of the electronic device provided in the present application.
Detailed Description
Features and exemplary embodiments of various aspects of the present application will be described in detail below, and in order to make objects, technical solutions and advantages of the present application more apparent, the present application will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are intended to be illustrative only and are not intended to be limiting. It will be apparent to one skilled in the art that the present application may be practiced without some of these specific details. The following description of the embodiments is merely intended to provide a better understanding of the present application by illustrating examples thereof.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
In the related art, in the case where a container needs to be started, a mirror image of the container is first pulled from a mirror image warehouse, and after the mirror image of the container is pulled, the container may be started. Before pulling the mirror of the container from the mirror repository, if it is determined that the desired mirror is local, the process of pulling the mirror may be skipped, and the container may be directly started, assuming the mirror is ready.
Because the data size of the container mirror image is generally large, for example, the container mirror image is different from tens of megabytes to hundreds of megabytes, the time spent on pulling the container mirror image is long, and the container cannot be started timely and quickly under the condition that the container needs to be started.
In addition, multiple containers using the same image may share an image, but multiple containers on the same computer device may share images. In practical situations, different containers of the same application may be deployed on different computer devices, and thus, the same mirror image needs to be stored on multiple computer devices, which wastes space resources on the computer devices.
In addition, in the case of starting containers in batches, the mirror images of the containers need to be pulled from the mirror image warehouse at the same time, which causes a large pressure on the mirror image warehouse, and a network bottleneck problem may be encountered when the mirror images are pulled by a plurality of computer devices at the same time.
Aiming at the technical problems, how to improve the speed of pulling the mirror image and make the advantage of quick starting of the container give full play to the effect, so that the remote mirror image data can be directly mounted locally, and the speed can be greatly improved by using the mounting instead of pulling the mirror image. Meanwhile, the Copy-on-Write (CoW) technology of the container file system and a cache (cache) mechanism of the Linux file enable the mirror image to be stored remotely without obvious performance reduction.
Based on the above concept, the present application provides a container mirror sharing method, and fig. 1 is a frame diagram of an embodiment of a system for implementing the container mirror sharing method.
As shown in fig. 1, the mirror cache server 102 pulls the container mirror from the mirror repository 104, caches the container mirror, and generates a shared directory according to the cached container mirror, where the shared directory includes subdirectories of the cached container mirror, and the container mirror is stored under the subdirectories.
A client on a computer device 106 (such as a host) may then mount the shared directory to a local mount point according to the mirror cache configuration information. Acquiring a path of a local mounting point under the condition that a target container on the computer equipment 106 needs to be started, and determining a path of a target mirror image according to the path of the local mounting point and the shared directory; then, the target image cached in the image cache server is shared according to the path of the target image, so as to realize the normal operation of the container on the computer device 106.
It should be noted that the client may be a container storage driver, similar to Overlay2 or an Advanced multi-Layered unified file system (AUFS). The AUFS is a file system that merges a plurality of folders by mounting.
Based on the system for implementing the container image sharing method shown in fig. 1, the container image sharing method provided in the present application is described below.
Fig. 2 is a timing diagram illustrating an embodiment of a container mirror sharing method provided in the present application. As shown in fig. 2, the container image sharing method includes:
s202, caching the container mirror image in the mirror image warehouse by the mirror image cache server, specifically, pulling the common container mirror image from the mirror image warehouse by the mirror image cache server, and caching the pulled container mirror image;
and S204, the mirror image cache server generates a shared directory according to the container mirror image, wherein the shared directory comprises subdirectories of the cached container mirror image, and the container mirror image is stored in the subdirectories of the container mirror image.
In S204, the image caching server may start a Network File System (NFS) service, and generate a shared directory according to a cached container image in a process of starting the NFS service. The shared directory may be an NFS shared directory. Therefore, the client can mount the shared directory to the local mounting point conveniently through the NFS protocol.
The shared directory may include one level of subdirectories, and cached container images are stored under each level of subdirectories.
Alternatively, the shared directory may include multiple levels of subdirectories, with a container image stored under a last level of subdirectories in the multiple levels of subdirectories. For example, a shared directory includes < library >/< name >/< tag > three levels of subdirectories.
After S204, the container image sharing method further includes:
s206, the client may mount (mount) the shared directory to a local mount point (mount point).
It should be noted that mounting refers to a process of making computer files and directories on a storage device (such as a hard disk, a CD-ROM, or a shared resource) accessible to a user through a file system of a computer. In an embodiment of the present application, mount is a process of making a shared directory in a mirror cache server accessible to a computer device.
In S206, the client may mount the shared directory to the local mount point according to the mirror cache configuration information. The mirror cache configuration information is configuration information of the mirror cache server, the configuration information of the mirror cache server may include an Internet Protocol (IP) address and a path of interconnection between networks of the mirror cache server, and the mirror cache configuration information may be configured in a configuration file of the client in advance.
In some embodiments, the client may mount the shared directory to the local mount point via the NFS protocol according to the mirror cache configuration information.
In some embodiments, the client may mount the shared directory to the local mount point according to the mirror cache configuration information during the process of starting the client.
That is, the shared directory is mounted to the local mount point at client startup for subsequent access to the respective container images in the shared directory. For example, in the starting process of the client, the shared directory is mounted to the local mounting point through the NFS protocol, so that the subdirectories of the container images on the shared directory can be mounted to the local mounting point by using one NFS channel, an NFS connection is prevented from being created for each container image, and the influence on the service capability of the image cache server is reduced.
After S206, in the case that any target container needs to be started, the container mirror sharing method includes:
s208, the client acquires the path of the local mounting point;
s210, the client determines a path of a target mirror image according to the path of the local mounting point and the shared directory, wherein the target mirror image is a mirror image of a target container to be started;
s212, the client shares the target mirror image cached in the mirror image cache server according to the path of the target mirror image.
In the embodiment of the application, firstly, the path of the target mirror image is determined, which is equivalent to obtaining the target mirror image, so that the target container can be started after the path of the target mirror image is determined, and the target container does not need to be started after the target mirror image is pulled out, so that the target container can be started timely and quickly, and the starting speed of the target container is improved.
And secondly, since the container mirror images cached in the mirror image cache server can be shared through the client, the same container mirror images do not need to be stored on each computer device, so that the local disk space of the computer device is not occupied, and more space resources are saved.
And thirdly, in the process of starting and operating the target container, when the mirror image of the target container is needed, reading the mirror image of the target container from the mirror image cache server according to the path of the target mirror image. Thus, the mirror image of the target container is read in a dispersed way in the life cycle of the target container, and the whole mirror image of the target container is not read before starting, so that the instantaneous access pressure on the mirror image warehouse when the containers are started in batch is reduced. Meanwhile, great access pressure to the mirror image cache server can not be caused at the moment of batch starting of the containers, and network bottlenecks are avoided.
In one or more embodiments of the present application, S210 may include:
the client sends an acquisition request of a target mirror image to a mirror image cache server;
a mirror cache server receives an acquisition request sent by a client;
the mirror image cache server acquires a relative path (relative-path) according to the acquisition request, wherein the relative path is a path from a local mounting point to a subdirectory of a target mirror image in the shared directory;
the mirror cache server sends a response comprising the relative path to a client of the computer device;
the client receives a response sent by the mirror image cache server, wherein the response comprises a relative path;
and the client splices the path of the local mounting point and the relative path to obtain the path of the target mirror image. Specifically, the client may splice the path of the local mount point with respect to the path to obtain the path of the target image.
In the embodiment of the application, the client sends an acquisition request of a target image to the image cache server under the condition that the target container needs to be started. After the client sends the acquisition request to the mirror cache server, the relative path returned by the mirror cache server can be received. Since the relative path is a path from the local mount point to the subdirectory of the target image in the shared directory, the relative path and the path of the local mount point are spliced to obtain the path of the target image, which is equivalent to obtaining the target image.
In one or more embodiments of the present application, the obtaining, by the mirror cache server, the relative path according to the obtaining request may specifically include:
the mirror image cache server determines whether a target mirror image is cached in the mirror image cache server according to the identification information of the target mirror image in the acquisition request;
under the condition that a target mirror image is cached in the mirror image cache server, the mirror image cache server acquires a relative path according to the identification information;
and under the condition that the target mirror image is not cached in the mirror image cache server, the mirror image cache server pulls the target mirror image from the container mirror image warehouse to the mirror image cache server, and acquires the relative path according to the identification information.
The identification information of the target mirror image may include mirror image warehouse information (relocation) and a tag (tag), and according to the identification information, a container mirror image that matches the identification information may be obtained from a container mirror image that has been cached by the mirror image cache server, where the container mirror image is the target mirror image, and then a relative path of the container mirror image is obtained.
In this embodiment of the present application, when the target image is not cached in the image cache server, the required target image may be pulled from the container image repository. Therefore, the mirror image cache server does not need to cache all container mirror images, and can cache common container mirror images, and the container mirror images can be dynamically pulled from the container mirror image warehouse as required, so that the embodiment of the application is more flexible in implementation.
In one or more embodiments of the present application, the obtaining request may be a HyperText Transfer Protocol (HTTP) request, and the mirror cache server may start an HTTP service in advance, so that an HTTP request sent from the client may be received based on HTTP in a subsequent step.
The container image sharing method according to the embodiment of the present application is described below with reference to fig. 3. As shown in fig. 3, the container image sharing method may include:
s302, caching the container mirror image in the mirror image warehouse by the mirror image caching server;
s304, the image cache server starts HTTP service and NFS service, and in the process of starting the NFS service, a shared directory is generated according to the cached container images in the image cache server, wherein the shared directory comprises subdirectories of the cached container images, and the container images are stored in the subdirectories.
The HTTP channel corresponding to the HTTP service may process an HTTP request, such as a control plane login/pull/push/logout request, and the NFS channel corresponding to the NFS service may provide a mirror mount service of a data plane.
S302 and S304 are initialization procedures of the mirror cache server. After S302 and S304, the container image sharing method further includes:
and S306, the client mounts the remote shared directory to a local mounting point through an NFS protocol according to the configuration information in the configuration file.
S306 is an initialization process of the client. The initialization of the mirror cache server and the client is completed. After this, sharing of the container image may be achieved. After S306, the container image sharing method further includes:
s308, under the condition that the target container needs to be started, the client sends an acquisition request to the mirror image cache server, wherein the acquisition request can be an HTTP request for pulling the mirror image, the acquisition request comprises mirror image warehouse information (relocation) and a tag (tag) of the target mirror image, and the target mirror image is the mirror image of the target container;
s310, after receiving the acquisition request, the mirror image cache server determines whether a target mirror image is cached in the mirror image cache server according to mirror image warehouse information (repository) and a tag (tag); executing S312 under the condition that the target mirror image is cached in the mirror image caching server; under the condition that the target mirror image is not cached in the mirror image caching server, pulling the target mirror image from the mirror image warehouse, and then executing S312;
s312, the mirror image cache server reads metadata of the target mirror image according to mirror image warehouse information (relocation) and a tag (tag), wherein the metadata comprises a relative path, and the relative path is a path from a local mounting point to a subdirectory of the target mirror image in the shared directory;
s314, the mirror image cache server sends a response including the relative path to the client, wherein the response can be an HTTP response, and the HTTP session is ended;
s316, after receiving the response including the relative path, the client acquires the path of the local mounting point, it should be noted that, in this embodiment of the present application, the client acquires the path of the local mounting point after receiving the response, and of course, the client may acquire the path of the local mounting point before sending the acquisition request, where an execution sequence of the two steps of acquiring the path of the local mounting point and sending the acquisition request is not limited;
s318, splicing the path of the local mounting point and the relative path to obtain a path of the target mirror image, wherein the path of the target mirror image is < mount point >/< relative-path >, < mount point > represents the path of the local mounting point, and < relative-path > represents the relative path;
and S320, the client shares the target mirror image cached in the mirror image cache server according to the path of the target mirror image.
In one or more embodiments of the present application, the shared directory includes multiple levels of subdirectories, and a container image is stored under a lowest level of subdirectories in the multiple levels of subdirectories, S210 may include:
and the client splices the path of the local mounting point and the multi-level subdirectories of the target mirror image in the shared directory to obtain the path of the target mirror image.
Therefore, the process of determining the path of the target mirror image is simplified, and the process of determining the path of the target mirror image is simpler.
The container image sharing method according to the embodiment of the present application is described below with reference to fig. 4. As shown in fig. 4, the container image sharing method may include:
s402, caching the container mirror image in the mirror image warehouse by the mirror image caching server;
s404, the image cache server starts the NFS service, and in the process of starting the NFS service, a shared directory is generated according to the cached container images in the image cache server, wherein the shared directory comprises a plurality of levels of subdirectories of the cached container images, and the container images are stored under the last level of subdirectories. For example, the shared directory includes three levels of subdirectories, namely < library >/< name >/< tag >.
S402 and S404 are initialization procedures of the mirror cache server. After S402 and S404, the container image sharing method further includes:
s406, the client mounts the remote shared directory to a local mounting point through an NFS protocol according to the configuration information in the configuration file.
S406 is an initialization process of the client. The initialization of the mirror cache server and the client is completed. After that, in order to implement the sharing of the container image, the container image sharing method further includes:
s408, the client acquires the path of the local mounting point;
s410, the client splices the path of the local mounting point and the multi-level subdirectory of the target image in the shared directory to obtain the path of the target image, for example, the path of the target image is < mount point >/< library >/< name >/< tag >, < mount point > represents the path of the local mounting point, and < library >/< name >/< tag > represents the multi-level subdirectory of the target image in the shared directory;
s412, the client shares the target mirror image cached in the mirror image cache server according to the path of the target mirror image.
Based on the above container mirror image sharing method, the present application provides a container mirror image sharing method for a client, and fig. 5 is a flowchart illustrating an embodiment of the container mirror image sharing method for the client. As shown in fig. 5, the container image sharing method 500 includes:
s502, acquiring a path of a local mounting point, wherein the local mounting point is mounted with a shared directory in a mirror cache server, the shared directory comprises subdirectories of container mirrors cached in the mirror cache server, and the container mirrors are stored under the subdirectories of the container mirrors;
s504, determining a path of a target mirror image according to the path of the local mounting point and the shared directory, wherein the target mirror image is a mirror image of a target container to be started;
s506, sharing the target mirror image cached in the mirror image cache server according to the path of the target mirror image.
In the embodiment of the application, firstly, the path of the target mirror image is determined, which is equivalent to obtaining the target mirror image, so that the target container can be started after the path of the target mirror image is determined, and the target container does not need to be started after the target mirror image is pulled out, so that the target container can be started timely and quickly, and the starting speed of the target container is improved.
And secondly, since the container mirror images cached in the mirror image cache server can be shared through the client, the same container mirror images do not need to be stored on each computer device, so that the local disk space of the computer device is not occupied, and more space resources are saved.
And thirdly, in the process of starting and operating the target container, when the mirror image of the target container is needed, reading the mirror image of the target container from the mirror image cache server according to the path of the target mirror image. Thus, the mirror image of the target container is read in a dispersed way in the life cycle of the target container, and the whole mirror image of the target container is not read before starting, so that the instantaneous access pressure on the mirror image warehouse when the containers are started in batch is reduced. Meanwhile, great access pressure to the mirror image cache server can not be caused at the moment of batch starting of the containers, and network bottlenecks are avoided.
In one or more embodiments of the present application, S504 can include:
sending an acquisition request of a target mirror image to a mirror image cache server, wherein the acquisition request is used for enabling the mirror image cache server to acquire a relative path, and the relative path is a path from a local mounting point to a subdirectory of the target mirror image in a shared directory;
receiving a response sent by the mirror image cache server, wherein the response comprises a relative path;
and splicing the path of the local mounting point and the relative path to obtain a path of the target mirror image.
In one or more embodiments of the present application, the shared directory includes multiple levels of subdirectories, and a container mirror image is stored under a lowest level of subdirectories in the multiple levels of subdirectories; s504 may include:
and splicing the path of the local mounting point and the multi-level subdirectories of the target mirror image in the shared directory to obtain the path of the target mirror image.
In the embodiment of the application, the shared directory comprises multiple levels of subdirectories, so that the target image can be directly located in the shared directory according to the identification information of the target image. For example, the shared directory includes three levels of subdirectories, namely < library >/< name >/< tag >, and in this case, the target image can be directly located in the shared directory according to the library, the name, and the tag of the target image. Therefore, the mode of reading the target image is simpler.
In one or more embodiments of the present application, before obtaining the path of the local mount point, the container mirror sharing method 500 may further include:
and mounting the shared directory to a local mounting point according to the mirror image cache configuration information.
In the embodiment of the application, the shared directory is mounted to the local mounting point, so that the path of the target image is determined according to the shared directory subsequently.
In one or more embodiments of the present application, mounting the shared directory to the local mounting point according to the mirror cache configuration information may include:
and in the process of starting the client, mounting the shared directory to a local mounting point according to the mirror image cache configuration information.
The shared directory is mounted to a local mounting point when the client is started, so that each container image in the shared directory can be accessed subsequently. For example, in the starting process of the client, the shared directory is mounted to the local mounting point through the NFS protocol, so that the subdirectories of the container images on the shared directory can be mounted to the local mounting point by using one NFS channel, an NFS connection is prevented from being created for each container image, and the influence on the service capability of the image cache server is reduced.
In one or more embodiments of the present application, mounting the shared directory to the local mounting point according to the mirror cache configuration information may include:
and mounting the shared directory to a local mounting point through a network file system protocol according to the mirror image cache configuration information.
Fig. 6 is a schematic flowchart of an embodiment of a container mirror sharing method for a mirror cache server provided in the present application. The container image sharing method is the container image sharing method of the second aspect, and as shown in fig. 6, the container image sharing method 600 includes:
s602, caching container mirror images in a mirror image warehouse;
s604, generating a shared directory according to the container mirror image, wherein the shared directory comprises subdirectories of the container mirror image, and the container mirror image is stored under the subdirectories of the container mirror image, so that the client of each computer device mounts the shared directory to a local mounting point, determines a path of the target mirror image according to the path of the local mounting point and the shared directory, and shares the target mirror image according to the path of the target mirror image.
In the embodiment of the application, the mirror cache server generates the shared directory, so that the client of each computer device mounts the shared directory to the local mounting point, and then determines the path of the target mirror. The client determines the path of the target mirror image, which is equivalent to obtaining the target mirror image, so that the target container can be started after the client determines the path of the target mirror image, and the target container does not need to be started after the target mirror image is pulled out, so that the target container can be started timely and quickly, and the starting speed of the target container is improved.
And secondly, since the container mirror images cached in the mirror image cache server can be shared through the client, the same container mirror images do not need to be stored on each computer device, so that the local disk space of the computer device is not occupied, and more space resources are saved.
And thirdly, in the process of starting and operating the target container, when the mirror image of the target container is needed, reading the mirror image of the target container from the mirror image cache server according to the path of the target mirror image. Thus, the mirror image of the target container is read in a dispersed way in the life cycle of the target container, and the whole mirror image of the target container is not read before starting, so that the instantaneous access pressure on the mirror image warehouse when the containers are started in batch is reduced. Meanwhile, great access pressure to the mirror image cache server can not be caused at the moment of batch starting of the containers, and network bottlenecks are avoided.
In one or more embodiments of the present application, after S604, the container image sharing method 600 may further include:
receiving an acquisition request sent by a client of computer equipment, wherein the acquisition request is used for requesting to acquire a target mirror image;
acquiring a relative path according to the acquisition request, wherein the relative path is a path from a local mounting point to a subdirectory of a target image in the shared directory;
and sending the response comprising the relative path to the client of the computer equipment so that the client of the computer equipment splices the path of the local mounting point and the relative path to obtain the path of the target mirror image.
In one or more embodiments of the present application, obtaining the relative path according to the obtaining request may include:
determining whether a target mirror image is cached in a mirror image cache server or not according to the identification information of the target mirror image in the acquisition request;
under the condition that a target mirror image is cached in the mirror image cache server, acquiring a relative path according to the identification information;
and under the condition that the target mirror image is not cached in the mirror image cache server, pulling the target mirror image from the container mirror image warehouse to the mirror image cache server, and acquiring a relative path according to the identification information.
In this embodiment of the present application, when the target image is not cached in the image cache server, the image cache server may pull the required target image from the container image repository. Therefore, the mirror image cache server does not need to cache all container mirror images, and can cache common container mirror images, and the container mirror images can be dynamically pulled from the container mirror image warehouse as required, so that the embodiment of the application is more flexible in implementation.
In one or more embodiments of the present application, before the obtaining request is a hypertext transfer protocol request and the obtaining request sent by the computer device is received, the container image sharing method 600 may further include:
a hypertext transfer protocol service is initiated, the hypertext transfer protocol service for receiving a hypertext transfer protocol request.
In the embodiment of the application, the hypertext transfer protocol service is started so that the HTTP request sent by the client can be received subsequently based on the HTTP.
In one or more embodiments of the present application, the shared directory may include multiple levels of subdirectories, with a container image stored under a last level of subdirectories of the multiple levels of subdirectories.
In the embodiment of the application, the shared directory comprises multiple levels of subdirectories, so that the target image can be directly located in the shared directory according to the identification information of the target image. For example, the shared directory includes three levels of subdirectories, namely < library >/< name >/< tag >, and in this case, the target image can be directly located in the shared directory according to the library, the name, and the tag of the target image. Therefore, the mode of reading the target image is simpler.
In one or more embodiments of the present application, generating a shared directory from a container image may include:
and starting the network file system service, and generating a shared directory according to the container mirror image in the process of starting the network file system service.
Corresponding to the container image sharing method for the client provided by the present application, the present application provides a container image sharing apparatus for the client, and fig. 7 is a schematic structural diagram of an embodiment of the container image sharing apparatus for the client provided by the present application. As shown in fig. 7, the container image sharing apparatus 700 includes:
a first obtaining module 702, configured to obtain a path of a local mount point, where the local mount point mounts a shared directory in a mirror cache server, where the shared directory includes subdirectories of container mirrors cached in the mirror cache server, and the container mirrors are stored under the subdirectories of the container mirrors;
a determining module 704, configured to determine a path of a target mirror according to the path of the local mount point and the shared directory, where the target mirror is a mirror image of a target container to be started;
and the sharing module 706 is configured to share the target image cached in the image cache server according to the path of the target image.
In the embodiment of the application, firstly, the path of the target mirror image is determined, which is equivalent to obtaining the target mirror image, so that the target container can be started after the path of the target mirror image is determined, and the target container does not need to be started after the target mirror image is pulled out, so that the target container can be started timely and quickly, and the starting speed of the target container is improved.
And secondly, since the container mirror images cached in the mirror image cache server can be shared through the client, the same container mirror images do not need to be stored on each computer device, so that the local disk space of the computer device is not occupied, and more space resources are saved.
And thirdly, in the process of starting and operating the target container, when the mirror image of the target container is needed, reading the mirror image of the target container from the mirror image cache server according to the path of the target mirror image. Thus, the mirror image of the target container is read in a dispersed way in the life cycle of the target container, and the whole mirror image of the target container is not read before starting, so that the instantaneous access pressure on the mirror image warehouse when the containers are started in batch is reduced. Meanwhile, great access pressure to the mirror image cache server can not be caused at the moment of batch starting of the containers, and network bottlenecks are avoided.
In one or more embodiments of the present application, determining module 704 can include:
the system comprises a sending unit, a sharing directory and a cache server, wherein the sending unit is used for sending an acquisition request of a target mirror image to the mirror cache server, and the acquisition request is used for enabling the mirror cache server to acquire a relative path from a local mounting point to a subdirectory of the target mirror image in the sharing directory;
the receiving unit is used for receiving a response sent by the mirror cache server, wherein the response comprises a relative path;
and the splicing unit is used for splicing the path of the local mounting point and the relative path to obtain the path of the target mirror image.
In one or more embodiments of the present application, the shared directory includes multiple levels of subdirectories, and a container mirror image is stored under a lowest level of subdirectories in the multiple levels of subdirectories; the determining module 704 may specifically be configured to:
and splicing the path of the local mounting point and the multi-level subdirectories of the target mirror image in the shared directory to obtain the path of the target mirror image.
In the embodiment of the application, the shared directory comprises multiple levels of subdirectories, so that the target image can be directly located in the shared directory according to the identification information of the target image. For example, the shared directory includes three levels of subdirectories, namely < library >/< name >/< tag >, and in this case, the target image can be directly located in the shared directory according to the library, the name, and the tag of the target image. Therefore, the mode of reading the target image is simpler.
In one or more embodiments of the present application, the container image sharing apparatus 700 may further include:
and the mounting module is used for mounting the shared directory to a local mounting point according to the mirror image cache configuration information.
In one or more embodiments of the present application, the mount module may specifically be configured to:
and in the process of starting the client, mounting the shared directory to a local mounting point according to the mirror image cache configuration information.
The shared directory is mounted to a local mounting point when the client is started, so that each container image in the shared directory can be accessed subsequently. For example, in the starting process of the client, the shared directory is mounted to the local mounting point through the NFS protocol, so that the subdirectories of the container images on the shared directory can be mounted to the local mounting point by using one NFS channel, an NFS connection is prevented from being created for each container image, and the influence on the service capability of the image cache server is reduced.
In one or more embodiments of the present application, the mount module may specifically be configured to:
and mounting the shared directory to a local mounting point through a network file system protocol according to the mirror image cache configuration information.
Corresponding to the container mirror sharing method for the mirror cache server provided by the present application, the present application provides a container mirror sharing apparatus for the mirror cache server, and fig. 8 is a schematic structural diagram of an embodiment of the container mirror sharing apparatus for the mirror cache server provided by the present application. As shown in fig. 8, the container image sharing apparatus 800 includes:
a caching module 802 for caching container mirrors in a mirror repository;
the generating module 804 is configured to generate a shared directory according to the container mirror image, where the shared directory includes subdirectories of the container mirror image, and the container mirror image is stored under the subdirectories of the container mirror image, so that the client of each computer device mounts the shared directory to a local mounting point, determines a path of the target mirror image according to the path of the local mounting point and the shared directory, and shares the target mirror image according to the path of the target mirror image.
In the embodiment of the application, the mirror cache server generates the shared directory, so that the client of each computer device mounts the shared directory to the local mounting point, and then determines the path of the target mirror. The client determines the path of the target mirror image, which is equivalent to obtaining the target mirror image, so that the target container can be started after the client determines the path of the target mirror image, and the target container does not need to be started after the target mirror image is pulled out, so that the target container can be started timely and quickly, and the starting speed of the target container is improved.
And secondly, since the container mirror images cached in the mirror image cache server can be shared through the client, the same container mirror images do not need to be stored on each computer device, so that the local disk space of the computer device is not occupied, and more space resources are saved.
And thirdly, in the process of starting and operating the target container, when the mirror image of the target container is needed, reading the mirror image of the target container from the mirror image cache server according to the path of the target mirror image. Thus, the mirror image of the target container is read in a dispersed way in the life cycle of the target container, and the whole mirror image of the target container is not read before starting, so that the instantaneous access pressure on the mirror image warehouse when the containers are started in batch is reduced. Meanwhile, great access pressure to the mirror image cache server can not be caused at the moment of batch starting of the containers, and network bottlenecks are avoided.
In one or more embodiments of the present application, the container image sharing apparatus 800 may further include:
the receiving module is used for receiving an acquisition request sent by a client of the computer equipment, and the acquisition request is used for requesting to acquire a target mirror image;
the second acquisition module is used for acquiring a relative path according to the acquisition request, wherein the relative path is a path from the local mounting point to a subdirectory of a target mirror image in the shared directory;
and the sending module is used for sending the response comprising the relative path to the client of the computer equipment so as to enable the client of the computer equipment to splice the path of the local mounting point and the relative path to obtain the path of the target mirror image.
In one or more embodiments of the present application, the second obtaining module may include:
the determining unit is used for determining whether the target mirror image is cached in the mirror image caching server according to the identification information of the target mirror image in the acquisition request;
the acquiring unit is used for acquiring a relative path according to the identification information under the condition that the target mirror image is cached in the mirror image cache server;
the system comprises a pulling unit, a storage unit and a storage unit, wherein the pulling unit is used for pulling a target mirror image from a container mirror image warehouse to a mirror image cache server under the condition that the target mirror image is not cached in the mirror image cache server;
the acquisition unit is further configured to: and after the target mirror image is pulled to the mirror image cache server, acquiring a relative path according to the identification information.
In this embodiment of the present application, when the target image is not cached in the image cache server, the image cache server may pull the required target image from the container image repository. Therefore, the mirror image cache server does not need to cache all container mirror images, and can cache common container mirror images, and the container mirror images can be dynamically pulled from the container mirror image warehouse as required, so that the embodiment of the application is more flexible in implementation.
In one or more embodiments of the present application, the obtaining request is a hypertext transfer protocol request, and the container image sharing apparatus 800 may further include:
the starting module is used for starting the hypertext transfer protocol service, and the hypertext transfer protocol service is used for receiving the hypertext transfer protocol request.
In the embodiment of the application, the hypertext transfer protocol service is started so that the HTTP request sent by the client can be received subsequently based on the HTTP.
In one or more embodiments of the present application, the shared directory includes multiple levels of subdirectories, and a container mirror is stored under a last level of subdirectories in the multiple levels of subdirectories.
In the embodiment of the application, the shared directory comprises multiple levels of subdirectories, so that the target image can be directly located in the shared directory according to the identification information of the target image. For example, the shared directory includes three levels of subdirectories, namely < library >/< name >/< tag >, and in this case, the target image can be directly located in the shared directory according to the library, the name, and the tag of the target image. Therefore, the mode of reading the target image is simpler.
In one or more embodiments of the present application, the generating module 804 is specifically configured to:
and starting the network file system service, and generating a shared directory according to the container mirror image in the process of starting the network file system service.
The present application further provides a computer device, comprising: a processor and a memory storing computer program instructions, the processor implementing the container image sharing method of the first aspect when executing the computer program instructions.
The present application further provides a mirror cache server, including: a processor and a memory storing computer program instructions, the processor implementing the container image sharing method of the second aspect when executing the computer program instructions.
Fig. 9 shows a hardware structure diagram of an embodiment of the electronic device provided in the present application.
The electronic device may be a computer device or a mirror cache server. The electronic device may comprise a processor 901 and a memory 902 storing computer program instructions.
Specifically, the processor 901 may include a Central Processing Unit (CPU), or an Application Specific Integrated Circuit (ASIC), or may be configured to implement one or more Integrated circuits of the embodiments of the present Application.
Memory 902 may include mass storage for data or instructions. By way of example, and not limitation, memory 902 may include a Hard Disk Drive (HDD), floppy Disk Drive, flash memory, optical Disk, magneto-optical Disk, tape, or Universal Serial Bus (USB) Drive or a combination of two or more of these. Memory 902 may include removable or non-removable (or fixed) media, where appropriate. The memory 902 may be internal or external to the integrated gateway disaster recovery device, where appropriate. In a particular embodiment, the memory 902 is a non-volatile solid-state memory.
The memory may include Read Only Memory (ROM), Random Access Memory (RAM), magnetic disk storage media devices, optical storage media devices, flash memory devices, electrical, optical, or other physical/tangible memory storage devices. Thus, in general, the memory includes one or more tangible (non-transitory) computer-readable storage media (e.g., memory devices) encoded with software comprising computer-executable instructions and when the software is executed (e.g., by one or more processors), it is operable to perform operations described with reference to the methods according to an aspect of the present disclosure.
The processor 901 realizes the above-described container image sharing method of the first aspect or the container image sharing method of the second aspect by reading and executing computer program instructions stored in the memory 902.
In one example, the electronic device can also include a communication interface 903 and a bus 910. As shown in fig. 9, the processor 901, the memory 902, and the communication interface 903 are connected via a bus 910 to complete communication with each other.
The communication interface 903 is mainly used for implementing communication between modules, apparatuses, units and/or devices in this embodiment of the application.
Bus 910 includes hardware, software, or both to couple the components of the online data traffic billing device to each other. By way of example, and not limitation, a bus may include an Accelerated Graphics Port (AGP) or other graphics bus, an Enhanced Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), a Hypertransport (HT) interconnect, an Industry Standard Architecture (ISA) bus, an infiniband interconnect, a Low Pin Count (LPC) bus, a memory bus, a Micro Channel Architecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a Serial Advanced Technology Attachment (SATA) bus, a video electronics standards association local (VLB) bus, or other suitable bus or a combination of two or more of these. Bus 910 can include one or more buses, where appropriate. Although specific buses are described and shown in the embodiments of the application, any suitable buses or interconnects are contemplated by the application.
In addition, the present application also provides a computer storage medium having computer program instructions stored thereon, where the computer program instructions, when executed by a processor, implement the container image sharing method of the first aspect or the container image sharing method of the second aspect.
It is to be understood that the present application is not limited to the particular arrangements and instrumentality described above and shown in the attached drawings. A detailed description of known methods is omitted herein for the sake of brevity. In the above embodiments, several specific steps are described and shown as examples. However, the method processes of the present application are not limited to the specific steps described and illustrated, and those skilled in the art can make various changes, modifications, and additions or change the order between the steps after comprehending the spirit of the present application.
The functional blocks shown in the above structural block diagrams may be implemented as hardware, software, firmware, or a combination thereof. When implemented in hardware, it may be, for example, an electronic circuit, an Application Specific Integrated Circuit (ASIC), suitable firmware, plug-in, function card, or the like. When implemented in software, the elements of the present application are the programs or code segments used to perform the required tasks. The program or code segments may be stored in a machine-readable medium or transmitted by a data signal carried in a carrier wave over a transmission medium or a communication link. A "machine-readable medium" may include any medium that can store or transfer information. The machine-readable medium may include non-transitory computer-readable storage media including, for example, electronic circuits, semiconductor memory devices, ROM, flash memory, erasable ROM (erom), floppy disks, CD-ROMs, optical disks, hard disks, fiber optic media, Radio Frequency (RF) links, and so forth. The code segments may be downloaded via computer networks such as the internet, intranet, etc.
It should also be noted that the exemplary embodiments mentioned in this application describe some methods or systems based on a series of steps or devices. However, the present application is not limited to the order of the above-described steps, that is, the steps may be performed in the order mentioned in the embodiments, may be performed in an order different from the order in the embodiments, or may be performed simultaneously.
Aspects of the present disclosure are described above with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the disclosure. It will be understood that each block of the flowchart illustrations and/or block diagrams, and combinations of blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, enable the implementation of the functions/acts specified in the flowchart and/or block diagram block or blocks. Such a processor may be, but is not limited to, a general purpose processor, a special purpose processor, an application specific processor, or a field programmable logic circuit. It will also be understood that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware for performing the specified functions or acts, or combinations of special purpose hardware and computer instructions.
As will be apparent to those skilled in the art, for convenience and brevity of description, the specific working processes of the systems, modules and units described above may refer to corresponding processes in the foregoing method embodiments, and are not described herein again. It should be understood that the scope of the present application is not limited thereto, and any person skilled in the art can easily conceive various equivalent modifications or substitutions within the technical scope of the present application, and these modifications or substitutions should be covered within the scope of the present application.

Claims (17)

1. A container mirror image sharing method is applied to a client side, and is characterized by comprising the following steps:
acquiring a path of a local mounting point, wherein the local mounting point mounts a shared directory in a mirror image cache server, the shared directory comprises subdirectories of container mirror images cached in the mirror image cache server, and the container mirror images are stored under the subdirectories of the container mirror images;
determining a path of a target mirror image according to the path of the local mounting point and the shared directory, wherein the target mirror image is a mirror image of a target container to be started;
and sharing the target mirror image cached in the mirror image cache server according to the path of the target mirror image.
2. The method of claim 1, wherein determining the path of the target image according to the path of the local mount point and the shared directory comprises:
sending an acquisition request of the target mirror image to the mirror image cache server, wherein the acquisition request is used for enabling the mirror image cache server to acquire a relative path, and the relative path is a path from the local mounting point to a subdirectory of the target mirror image in the shared directory;
receiving a response sent by the mirror cache server, wherein the response comprises the relative path;
and splicing the path of the local mounting point and the relative path to obtain the path of the target mirror image.
3. The method of claim 1, wherein the shared directory comprises a plurality of levels of subdirectories, wherein the container image is stored under a lowest level of subdirectories of the plurality of levels of subdirectories;
the determining a path of the target image according to the shared directory includes:
and splicing the path of the local mounting point and the multi-level subdirectories of the target mirror image in the shared directory to obtain the path of the target mirror image.
4. The method according to any of claims 1 to 3, wherein before the obtaining the path of the local mount point, the method further comprises:
and mounting the shared directory to the local mounting point according to the mirror cache configuration information.
5. The method of claim 4, wherein the mounting the shared directory to the local mount point according to mirror cache configuration information comprises:
and in the process of starting the client, mounting the shared directory to the local mounting point according to mirror image cache configuration information.
6. The method of claim 4, wherein the mounting the shared directory to the local mount point according to mirror cache configuration information comprises:
and mounting the shared directory to the local mounting point through a network file system protocol according to the mirror image cache configuration information.
7. A container mirror image sharing method is applied to a mirror image cache server, and is characterized by comprising the following steps:
caching container images in an image warehouse;
and generating a shared directory according to the container mirror image, wherein the shared directory comprises subdirectories of the container mirror image, and the container mirror image is stored in the subdirectories of the container mirror image, so that a client of each computer device mounts the shared directory to a local mounting point, determines a path of a target mirror image according to the path of the local mounting point and the shared directory, and shares the target mirror image according to the path of the target mirror image.
8. The method of claim 7, wherein after generating the shared directory according to the container image, the method further comprises:
receiving an acquisition request sent by a client of the computer equipment, wherein the acquisition request is used for requesting to acquire a target mirror image;
acquiring a relative path according to the acquisition request, wherein the relative path is a path from the local mounting point to a subdirectory of the target image in the shared directory;
and sending the response comprising the relative path to a client of the computer equipment so that the client of the computer equipment splices the path of the local mounting point and the relative path to obtain the path of the target mirror image.
9. The method of claim 8, wherein the obtaining the relative path according to the obtaining request comprises:
determining whether the target mirror image is cached in the mirror image caching server according to the identification information of the target mirror image in the acquisition request;
under the condition that the target mirror image is cached in the mirror image cache server, acquiring the relative path according to the identification information;
and under the condition that the target mirror image is not cached in the mirror image cache server, pulling the target mirror image from the container mirror image warehouse to the mirror image cache server, and acquiring the relative path according to the identification information.
10. The method of claim 8, wherein the get request is a hypertext transfer protocol request,
before the receiving of the acquisition request sent by the computer device, the method further includes:
starting a hypertext transfer protocol service, wherein the hypertext transfer protocol service is used for receiving the hypertext transfer protocol request.
11. The method of claim 7, wherein the shared directory comprises a plurality of levels of subdirectories, and wherein the container image is stored under a last level of subdirectories of the plurality of levels of subdirectories.
12. The method of any of claims 7 to 11, wherein the generating a shared directory from the container image comprises:
and starting the network file system service, and generating the shared directory according to the container mirror image in the process of starting the network file system service.
13. A container image sharing device applied to a client, the device comprising:
the first acquisition module is used for acquiring a path of a local mounting point, wherein the local mounting point mounts a shared directory in a mirror cache server, the shared directory comprises subdirectories of container mirrors cached in the mirror cache server, and the container mirrors are stored under the subdirectories of the container mirrors;
the determining module is used for determining a path of a target mirror image according to the path of the local mounting point and the shared directory, wherein the target mirror image is a mirror image of a target container to be started;
and the sharing module is used for sharing the target mirror image cached in the mirror image cache server according to the path of the target mirror image.
14. A container mirror image sharing device is applied to a mirror image cache server, and is characterized by comprising:
the caching module is used for caching the container mirror images in the mirror image warehouse;
and the directory generation module is used for generating a shared directory according to the container mirror image, wherein the shared directory comprises subdirectories of the container mirror image, and the container mirror image is stored in the subdirectories of the container mirror image, so that the client of each computer device mounts the shared directory to a local mounting point, determines a path of a target mirror image according to the path of the local mounting point and the shared directory, and shares the target mirror image according to the path of the target mirror image.
15. A computer device, the device comprising: a processor and a memory storing computer program instructions;
the processor, when executing the computer program instructions, implements the container image sharing method of any of claims 1-6.
16. A mirror cache server, comprising: a processor and a memory storing computer program instructions;
the processor, when executing the computer program instructions, implements the container image sharing method of any of claims 7-12.
17. A computer storage medium having computer program instructions stored thereon which, when executed by a processor, implement the container image sharing method of any one of claims 1-12.
CN202110057434.5A 2021-01-15 2021-01-15 Container mirror image sharing method, device, server, equipment and medium Pending CN112799780A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110057434.5A CN112799780A (en) 2021-01-15 2021-01-15 Container mirror image sharing method, device, server, equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110057434.5A CN112799780A (en) 2021-01-15 2021-01-15 Container mirror image sharing method, device, server, equipment and medium

Publications (1)

Publication Number Publication Date
CN112799780A true CN112799780A (en) 2021-05-14

Family

ID=75809834

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110057434.5A Pending CN112799780A (en) 2021-01-15 2021-01-15 Container mirror image sharing method, device, server, equipment and medium

Country Status (1)

Country Link
CN (1) CN112799780A (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114048181A (en) * 2021-10-20 2022-02-15 北京鲸鲮信息系统技术有限公司 Method and device for sharing files by system and container
CN114217908A (en) * 2022-02-23 2022-03-22 广州趣丸网络科技有限公司 Container starting method, system, device and equipment
CN114327291A (en) * 2021-12-30 2022-04-12 郑州云海信息技术有限公司 Configuration system, management method and system thereof, and related components
CN114785770A (en) * 2022-04-01 2022-07-22 京东科技信息技术有限公司 Mirror layer file sending method and device, electronic equipment and computer readable medium
TWI806341B (en) * 2022-01-06 2023-06-21 威聯通科技股份有限公司 Container system in host, method of dynamically mounting host data to container, and application program for the same
CN116339920A (en) * 2023-03-27 2023-06-27 北京天融信网络安全技术有限公司 Information processing method, device, equipment and medium based on cloud platform

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CA2213423A1 (en) * 1996-10-24 1998-04-24 Lucent Technologies Inc. Method for shared memory management in network nodes
CN104283941A (en) * 2014-09-16 2015-01-14 深圳市同洲电子股份有限公司 Data access method, device and system
CN106550037A (en) * 2016-11-07 2017-03-29 天脉聚源(北京)传媒科技有限公司 A kind of method and device of server data sharing
CN110704162A (en) * 2019-09-27 2020-01-17 北京百度网讯科技有限公司 Method, device and equipment for sharing container mirror image by physical machine and storage medium
CN111190547A (en) * 2019-12-30 2020-05-22 中国电子科技集团公司信息科学研究院 Distributed container mirror image storage and distribution system and method
CN111506547A (en) * 2020-04-17 2020-08-07 苏州浪潮智能科技有限公司 Folder loading method, device, equipment and medium
CN111538566A (en) * 2020-04-24 2020-08-14 咪咕文化科技有限公司 Mirror image file processing method, device and system, electronic equipment and storage medium
CN112162958A (en) * 2020-09-11 2021-01-01 北京浪潮数据技术有限公司 Network file system mounting method and device, electronic equipment and storage medium

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CA2213423A1 (en) * 1996-10-24 1998-04-24 Lucent Technologies Inc. Method for shared memory management in network nodes
CN104283941A (en) * 2014-09-16 2015-01-14 深圳市同洲电子股份有限公司 Data access method, device and system
CN106550037A (en) * 2016-11-07 2017-03-29 天脉聚源(北京)传媒科技有限公司 A kind of method and device of server data sharing
CN110704162A (en) * 2019-09-27 2020-01-17 北京百度网讯科技有限公司 Method, device and equipment for sharing container mirror image by physical machine and storage medium
CN111190547A (en) * 2019-12-30 2020-05-22 中国电子科技集团公司信息科学研究院 Distributed container mirror image storage and distribution system and method
CN111506547A (en) * 2020-04-17 2020-08-07 苏州浪潮智能科技有限公司 Folder loading method, device, equipment and medium
CN111538566A (en) * 2020-04-24 2020-08-14 咪咕文化科技有限公司 Mirror image file processing method, device and system, electronic equipment and storage medium
CN112162958A (en) * 2020-09-11 2021-01-01 北京浪潮数据技术有限公司 Network file system mounting method and device, electronic equipment and storage medium

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114048181A (en) * 2021-10-20 2022-02-15 北京鲸鲮信息系统技术有限公司 Method and device for sharing files by system and container
CN114048181B (en) * 2021-10-20 2024-04-02 北京字节跳动网络技术有限公司 Method and device for sharing files by system and container
CN114327291A (en) * 2021-12-30 2022-04-12 郑州云海信息技术有限公司 Configuration system, management method and system thereof, and related components
TWI806341B (en) * 2022-01-06 2023-06-21 威聯通科技股份有限公司 Container system in host, method of dynamically mounting host data to container, and application program for the same
CN114217908A (en) * 2022-02-23 2022-03-22 广州趣丸网络科技有限公司 Container starting method, system, device and equipment
CN114785770A (en) * 2022-04-01 2022-07-22 京东科技信息技术有限公司 Mirror layer file sending method and device, electronic equipment and computer readable medium
CN116339920A (en) * 2023-03-27 2023-06-27 北京天融信网络安全技术有限公司 Information processing method, device, equipment and medium based on cloud platform
CN116339920B (en) * 2023-03-27 2024-03-15 北京天融信网络安全技术有限公司 Information processing method, device, equipment and medium based on cloud platform

Similar Documents

Publication Publication Date Title
CN112799780A (en) Container mirror image sharing method, device, server, equipment and medium
US10002054B2 (en) Method and system for performing automatic system recovery
CN111970315A (en) Method, device and system for pushing message
US20070245134A1 (en) Testing device and testing method for computer
CN105049486A (en) Version management and file pulling control methods for static files, version management and file pulling control devices, and version control system
CN106817388B (en) Method and device for acquiring data by virtual machine and host machine and system for accessing data
CN107798064B (en) Page processing method, electronic device and computer readable storage medium
CN114637703B (en) Data access device, method, readable medium and electronic equipment
CN105915613A (en) Resource supply method and device based on cloud services
CN111669625A (en) Processing method, device and equipment for shot file and storage medium
CN111783010A (en) Webpage blank page monitoring method, device, terminal and storage medium
CN109218338B (en) Information processing system, method and device
CN111367921A (en) Data object refreshing method and device
US11057489B2 (en) Content deployment method and delivery controller
CN114637969A (en) Target object authentication method and device
CN113727208A (en) Communication method, device, equipment and medium for quickly reading and writing parameter information of optical module
CN109739615B (en) Mapping method and device of virtual hard disk and cloud computing platform
CN115993979A (en) Configuration conversion method, smooth upgrading method, device, equipment and storage medium
CN112363806A (en) Cluster management method and device, electronic equipment and storage medium
US9516111B2 (en) Communication apparatus, communication method, and computer program product
CN107656877B (en) Information processing method and apparatus thereof
CN113783740B (en) Network optimization method, device, equipment and medium
CN110750465A (en) System upgrading method, data processing method, device and equipment
KR101699159B1 (en) Communication apparatus, virtual file system module comprised in the communication apparatus, control method thereof, and recording medium for recording program for executing the control method, application saved in the recording medium for executing the control method being combined with hardware
CN113222174B (en) Model management method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination