CN111414234A - Mirror image container creation method and device, computer device and storage medium - Google Patents

Mirror image container creation method and device, computer device and storage medium Download PDF

Info

Publication number
CN111414234A
CN111414234A CN202010202991.7A CN202010202991A CN111414234A CN 111414234 A CN111414234 A CN 111414234A CN 202010202991 A CN202010202991 A CN 202010202991A CN 111414234 A CN111414234 A CN 111414234A
Authority
CN
China
Prior art keywords
environment type
target
docker
slave node
node
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
CN202010202991.7A
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.)
Shenzhen Onething Technology Co Ltd
Original Assignee
Shenzhen Onething Technology 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 Shenzhen Onething Technology Co Ltd filed Critical Shenzhen Onething Technology Co Ltd
Priority to CN202010202991.7A priority Critical patent/CN111414234A/en
Publication of CN111414234A publication Critical patent/CN111414234A/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

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

The invention provides a mirror image container creating method, which comprises the following steps: acquiring a target task in a plurality of tasks to be executed, a plurality of nodes of the target task in the distributed system and a target operation environment type; connecting a first slave node of the plurality of nodes; judging whether a Docker container with the operating environment type consistent with the target operating environment type exists in the first slave node or not; if the first slave node does not have a Docker container with the operating environment type consistent with the target operating environment type, sending a pull instruction of the Docker mirror image of the target operating environment type to the first slave node through proxy service operated on a service node. The invention also provides a mirror image container creating device, a computer device and a computer readable storage medium. The invention creates a plurality of docker mirror containers of the operating environment type on one node machine.

Description

Mirror image container creation method and device, computer device and storage medium
Technical Field
The invention relates to the technical field of continuous integration, in particular to a mirror image container creation method and device, a computer device and a computer readable storage medium.
Background
Jenkins can create multiple tasks. Tasks are a general term for various tasks in a continuous integration process, and may be testing tasks, integration tasks, delivery tasks, deployment tasks, and so on.
Typically, each task needs to be executed on multiple nodes of different types of execution environments. How to create a docker mirror container with multiple operating environment types on one node machine becomes an urgent problem to be solved.
Disclosure of Invention
In view of the foregoing, there is a need for an image container creation method, an image container creation apparatus, a computer apparatus, and a computer-readable storage medium, which can create docker image containers of multiple runtime environment types on one node machine.
A first aspect of the present application provides a method for creating a mirror container, the method including:
acquiring a target task in a plurality of tasks to be executed, a plurality of nodes of the target task in the distributed system and a target operation environment type;
connecting a first slave node of the plurality of nodes;
judging whether a Docker container with the operating environment type consistent with the target operating environment type exists in the first slave node or not;
if no Docker container with the operating environment type consistent with the target operating environment type exists in the first slave node, sending a pulling instruction of the Docker mirror image of the target operating environment type to the first slave node through proxy service running in the service node, enabling the first slave node to pull the Docker mirror image of the target operating environment type from a Docker warehouse, and creating the Docker container of the target operating environment type of the first slave node according to the Docker mirror image of the target operating environment type of the first slave node.
In another possible implementation manner, the determining whether a Docker container whose execution environment type is consistent with the target execution environment type exists in the first slave node includes:
querying a running environment type of each Docker container in the first slave node;
if the inquired operation environment type comprises the target operation environment type, determining that a Docker container with the operation environment type consistent with the target operation environment type exists in the first slave node;
and if the inquired operation environment type does not comprise the target operation environment type, determining that no Docker container with the operation environment type consistent with the target operation environment type exists in the first slave node.
In another possible implementation manner, the plurality of nodes include a master node and a plurality of slave nodes, and the connecting a first slave node in the plurality of nodes includes:
connecting the main node;
and if the connection with the main node fails, connecting a first slave node in the plurality of slave nodes.
In another possible implementation manner, if the connection to the master node is successful, the method further includes:
judging whether a Docker container with the operating environment type consistent with the target operating environment type exists in the main node or not;
if no Docker container with the operating environment type consistent with the target operating environment type exists in the main node, sending a pulling instruction of the Docker mirror image of the target operating environment type to the main node through the proxy service, enabling the main node to pull the Docker mirror image of the target operating environment type from a Docker warehouse, and creating the Docker container of the target operating environment type of the main node according to the Docker mirror image of the target operating environment type of the main node;
enabling a Docker container of a target operation environment type of the main node to execute the target task through the proxy service.
In another possible implementation manner, the method further includes:
and if the connection of the first slave node fails, connecting a second slave node in the plurality of nodes.
In another possible implementation manner, after the creating a Docker container of the target runtime environment type of the first slave node according to the Docker image of the target runtime environment type of the first slave node, the method further includes:
enabling, by the proxy service, a Docker container of a target runtime environment type of the first slave node to execute the target task.
In another possible implementation manner, the causing, by the proxy service, a Docker container of a target runtime environment type of the first slave node to perform the target task includes:
sending, by the proxy service, a command to the first slave node to launch a Docker container of a target runtime environment type of the first slave node;
sending, by the proxy service, a command to the first slave node to execute the target task in a Docker container of a target runtime environment type of the first slave node.
A second aspect of the present application provides a computer apparatus comprising a memory and a processor, the memory having stored thereon a computer program operable on the processor, the computer program, when executed by the processor, implementing the mirrored container creation method.
A third aspect of the present application provides a mirror image container creating apparatus, the apparatus including:
the system comprises an acquisition unit, a processing unit and a processing unit, wherein the acquisition unit is used for acquiring a target task in a plurality of tasks to be executed, a plurality of nodes of the target task in the distributed system and a target operation environment type;
a connection unit configured to connect a first slave node among the plurality of nodes;
a judging unit, configured to judge whether a Docker container with an operating environment type consistent with the target operating environment type exists in the first slave node;
a sending unit, configured to send, to the first slave node, a pull instruction for a Docker image of the target operation environment type through a proxy service running on a service node if the first slave node does not have a Docker container of an operation environment type consistent with the target operation environment type, so that the first slave node pulls the Docker image of the target operation environment type from a Docker warehouse, and create the Docker container of the target operation environment type of the first slave node according to the Docker image of the target operation environment type of the first slave node.
A fourth aspect of the present application provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the mirror container creating method.
The mirror image container creating method can create a plurality of docker mirror image containers of the operating environment types on one node machine.
Drawings
Fig. 1 is a flowchart of a mirror image container creation method according to a preferred embodiment of the present invention.
FIG. 2 is a flow chart of a preferred embodiment of the mirror image container creating apparatus according to the present invention.
FIG. 3 is a diagram of a computer device according to a preferred embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The terms "first," "second," "third," "fourth," and the like in the description of the application and the above-described figures, if any, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It will be appreciated that the data so used may be interchanged under appropriate circumstances such that the embodiments described herein may be practiced otherwise than as specifically illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, apparatus, article, or device that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or device. In addition, technical solutions between various embodiments may be combined with each other, but must be realized by a person skilled in the art, and when the technical solutions are contradictory or cannot be realized, such a combination should not be considered to exist, and is not within the protection scope of the present invention.
Preferably, the mirror container creation method of the present invention is applied in one or more computer apparatuses. The computer device is a device capable of automatically performing numerical calculation and/or information processing according to a preset or stored instruction, and the hardware includes, but is not limited to, a microprocessor, an Application Specific Integrated Circuit (ASIC), a Programmable Gate Array (FPGA), a Digital Signal Processor (DSP), an embedded device, and the like.
The computer device can be a desktop computer, a notebook, a palm computer, a cloud server and other computing equipment. The computer device can be in man-machine interaction with a user through a keyboard, a mouse, a remote controller, a touch panel or voice control equipment and the like.
The computer device may be a node constituting a CDN (Content Delivery Network) Network or a blockchain Network.
For the sake of understanding, the following text explains some technical terms accordingly:
docker is an L XC-based advanced container engine that is OPEN-sourced by the PaaS provider DotCloud, with source code hosted on Github, using GO as the development language and following the Apache2.0 protocol.
The Docker Image (Image) is a base for constructing a container, and is a read-only template, and the Image is a file system with a hierarchical structure. One read-only layer is called a mirror and one mirror is permanently invariant. Because the Docker uses a unified file system, the Docker process considers that the entire file system is mounted in a read-write manner. But all changes occur in the top writable layer while the underlying original read-only image file does not change. Since the mirror is not writable, the mirror is stateless.
The method comprises the steps that a user can package an application and program dependence package into a portable container and then deploy the container to L inux machines supporting Docker (common L inux release versions basically support Docker), and meanwhile, process-level virtualization is achieved.
The Docker warehouse is a place for storing Docker mirror images in a centralized way and is an HTTP service.
Jenkins, an open source software project, is a continuous integration tool developed based on Java, is used for monitoring continuous and repeated work, and aims to provide an open and easy-to-use software platform to enable continuous integration of software.
Example one
Fig. 1 is a flowchart of a mirror container creating method according to an embodiment of the present invention. The mirror image container creation method is applied to service nodes in a distributed system, and is used for creating a plurality of docker mirror image containers of operating environment types on one node machine.
Referring to fig. 1, the mirror image container creation method specifically includes the following steps:
101, acquiring a target task in a plurality of tasks to be executed, a plurality of nodes of the target task in the distributed system and a target operation environment type.
In this embodiment, Jenkins in the service node may obtain a target task of a plurality of tasks to be executed, and a plurality of nodes and a target operating environment type of the target task in the distributed system.
The plurality of tasks to be executed may include tasks of any link in a continuous integration process, for example, tasks of links such as integration, testing, delivery, and the like may be included. The plurality of tasks to be performed may include testing tasks, integration tasks, delivery tasks, deployment tasks, and the like.
The target task is any one of the tasks to be executed, and can be determined by an input instruction of a user or an automatic script.
The plurality of nodes may be computing nodes (physical hosts), cloud servers, etc. in the distributed system. For example, a node in the distributed system with a low load may be determined as the plurality of nodes in the distributed system for the target task. The plurality of nodes of the target task in the distributed system may also be preset nodes or nodes designated by a user.
The runtime environment type may include CENTOSTM、UBUNTUTM、RED HATTM、WINDOWTM7、WINDOW TM10, etc.
102 connecting a first slave node of the plurality of nodes.
The plurality of nodes including a master node and a plurality of slave nodes, the connecting a first slave node of the plurality of nodes comprising:
connecting the main node;
and if the connection with the main node fails, connecting a first slave node in the plurality of slave nodes.
Specifically, each target task may correspond to a master node and at least one slave node, the slave node being a backup node for the master node. When the service node fails to connect to the master node, the service node may connect to the slave node.
In one embodiment, the JN L P (Java Network L sounding Protocol, JAVA) may be usedTMProvided a method for directly executing JAVA by browserTMApplication program path, which makes it possible to open a JAVA directly via url connection on a web pageTMApplication program) to start the connection service of the master node, and to connect the master node through the connection service of the master node. The master node may connect to the service node through a preset url. And if the connection confirmation information of the main node is not received after the preset time and/or the connection confirmation information of the main node is not received after the preset connection times, the main node is failed to be connected.
103, judging whether a Docker container with the running environment type consistent with the target running environment type exists in the first slave node.
In one embodiment, the determining whether a Docker container with a runtime environment type consistent with the target runtime environment type exists in the first slave node may include:
querying a running environment type of each Docker container in the first slave node;
if the inquired operation environment type comprises the target operation environment type, determining that a Docker container with the operation environment type consistent with the target operation environment type exists in the first slave node;
and if the inquired operation environment type does not comprise the target operation environment type, determining that no Docker container with the operation environment type consistent with the target operation environment type exists in the first slave node.
Specifically, the number of Docker containers in the first slave node and the run environment type of each Docker container may be queried by calling a Docker query instruction.
In another embodiment, if the connection of the plurality of nodes fails, a failure to execute the target task due to the connection failure of the plurality of nodes is prompted.
The Docker container is similar to a virtual machine, and operations that can be supported include start, stop, delete, and the like (i.e., operations that the service node can perform on the Docker container). The Docker container runs a specific application program, which includes code of the specific application program and a dependent file required by the specific application program. The Docker container can use a sandbox mechanism, and no interface exists between the Docker container and the sandbox container, so that the construction tasks in the jenkins system can run in the independent Docker container without mutual interference.
104, if no Docker container with the operating environment type consistent with the target operating environment type exists in the first slave node, sending a pull instruction of the Docker image of the target operating environment type to the first slave node through a proxy service running on the service node, so that the first slave node pulls the Docker image of the target operating environment type from a Docker warehouse, and creating the Docker container of the target operating environment type of the first slave node according to the Docker image of the target operating environment type of the first slave node.
Preset websites of a Docker warehouse are configured in the main node and the plurality of nodes. That is, the first slave node may pull the Docker image of the target operating environment type from a preset website according to the target operating environment type.
A Docker image may contain a complete ubuntu operating system environment with only Mysql or specific applications that the user needs installed.
Embodiment one can create a docker mirror container of multiple runtime environment types on one node machine.
In another embodiment, after the creating a Docker container of the target runtime environment type of the first slave node according to the Docker image of the target runtime environment type of the first slave node, the method further includes:
enabling, by the proxy service, a Docker container of a target runtime environment type of the first slave node to execute the target task.
In a specific embodiment, the causing, by the proxy service, the Docker container of the target runtime environment type of the first slave node to perform the target task includes:
sending, by the proxy service, a command to the first slave node to launch a Docker container of a target runtime environment type of the first slave node;
sending, by the proxy service, a command to the first slave node to execute the target task in a Docker container of a target runtime environment type of the first slave node.
After the Docker container of the target runtime environment type of the first slave node is started, the target task may be executed according to a command for executing the target task in the Docker container of the target runtime environment type of the first slave node.
The influence of node shutdown or connection faults on creation of the mirroring container is reduced through the nodes, and the stability of task execution in the Docker container is improved. The multiple Docker containers of the master node or the first slave node may simulate multiple nodes of different operating environment types, reducing the number of required nodes.
In another embodiment, if the connection to the master node is successful, the method further includes:
judging whether a Docker container with the operating environment type consistent with the target operating environment type exists in the main node or not;
if no Docker container with the operating environment type consistent with the target operating environment type exists in the main node, sending a pulling instruction of the Docker mirror image of the target operating environment type to the main node through the proxy service, enabling the main node to pull the Docker mirror image of the target operating environment type from a Docker warehouse, and creating the Docker container of the target operating environment type of the main node according to the Docker mirror image of the target operating environment type of the main node;
enabling a Docker container of a target operation environment type of the main node to execute the target task through the proxy service.
In another embodiment, the method further comprises:
and if the connection of the first slave node fails, connecting a second slave node in the plurality of nodes.
When the connection with part of the nodes fails, the rest nodes can be connected to find the connectable nodes in the nodes, so that the risk of connection failure is reduced.
In another embodiment, after the Docker container of the target runtime environment type of the first slave node executes the target task, the method further comprises:
receiving a deletion request for the target task;
and stopping running the Docker container of the target running environment type of the first slave node according to the deletion request.
Specifically, after the target image container is created, a delete request for the target task may be received; sending an instruction to the first slave node to stop running the Docker container of the target running environment type of the first slave node; sending an instruction to the first slave node to delete the Docker container of the target runtime environment type of the first slave node. Preventing the Docker container of the target runtime environment type of the first slave node from continuously running.
In another embodiment, the method further comprises:
acquiring the plurality of tasks to be executed and a Docker container of the plurality of tasks to be executed in the distributed system;
and enabling the Docker containers of the tasks to be executed to respectively execute the tasks to be executed through the proxy service.
The proxy service enables the Docker containers of the tasks to be executed to respectively execute the tasks to be executed, so that the tasks to be executed can be executed in parallel in the distributed system, and the creation efficiency of the mirror image container is improved. The tasks may be distinguished based on their identification codes.
Example two
FIG. 2 is a block diagram of a preferred embodiment of a mirrored container creation apparatus provided in accordance with an embodiment of the present invention. The mirror image container creating device 10 is applied to a service node in a distributed system, and is used for creating a docker mirror image container of a plurality of operating environment types on one node machine.
As shown in fig. 2, the mirror image container creating apparatus 10 may include: acquisition section 201, connection section 202, determination section 203, and transmission section 204.
An obtaining unit 201, configured to obtain a target task of multiple tasks to be executed, multiple nodes of the target task in the distributed system, and a target operating environment type.
In this embodiment, Jenkins in the service node may obtain a target task of a plurality of tasks to be executed, and a plurality of nodes and a target operating environment type of the target task in the distributed system.
The plurality of tasks to be executed may include tasks of any link in a continuous integration process, for example, tasks of links such as integration, testing, delivery, and the like may be included. The plurality of tasks to be performed may include testing tasks, integration tasks, delivery tasks, deployment tasks, and the like.
The target task is any one of the tasks to be executed, and can be determined by an input instruction of a user or an automatic script.
The plurality of nodes may be computing nodes (physical hosts), cloud servers, etc. in the distributed system. For example, a node in the distributed system with a low load may be determined as the plurality of nodes in the distributed system for the target task. The plurality of nodes of the target task in the distributed system may also be preset nodes or nodes designated by a user.
The runtime environment type may include CENTOSTM、UBUNTUTM、RED HATTM、WINDOWTM7、WINDOW TM10, etc.
A connection unit 202, configured to connect a first slave node in the plurality of nodes.
The plurality of nodes including a master node and a plurality of slave nodes, the connecting a first slave node of the plurality of nodes comprising:
connecting the main node;
and if the connection with the main node fails, connecting a first slave node in the plurality of slave nodes.
Specifically, each target task may correspond to a master node and at least one slave node, the slave node being a backup node for the master node. When the service node fails to connect to the master node, the service node may connect to the slave node.
In one embodiment, the JN L P (Java Network L sounding Protocol, JAVA) may be usedTMProvided a method for directly executing JAVA by browserTMApplication program path, which makes it possible to open a JAVA directly via url connection on a web pageTMApplication program) to start the connection service of the master node, and to connect the master node through the connection service of the master node. The master node may connect to the service node through a preset url. If the connection confirmation information of the main node is not received within the preset time and/or exceeds the preset timeAnd presetting connection times without receiving the connection confirmation information of the main node, and failing to connect the main node.
A determining unit 203, configured to determine whether a Docker container whose operation environment type is consistent with the target operation environment type exists in the first slave node.
In one embodiment, the determining whether a Docker container with a runtime environment type consistent with the target runtime environment type exists in the first slave node may include:
querying a running environment type of each Docker container in the first slave node;
if the inquired operation environment type comprises the target operation environment type, determining that a Docker container with the operation environment type consistent with the target operation environment type exists in the first slave node;
and if the inquired operation environment type does not comprise the target operation environment type, determining that no Docker container with the operation environment type consistent with the target operation environment type exists in the first slave node.
Specifically, the number of Docker containers in the first slave node and the run environment type of each Docker container may be queried by calling a Docker query instruction.
In another embodiment, if the connection of the plurality of nodes fails, a failure to execute the target task due to the connection failure of the plurality of nodes is prompted.
The Docker container is similar to a virtual machine, and operations that can be supported include start, stop, delete, and the like (i.e., operations that the service node can perform on the Docker container). The Docker container runs a specific application program, which includes code of the specific application program and a dependent file required by the specific application program. The Docker container can use a sandbox mechanism, and no interface exists between the Docker container and the sandbox container, so that the construction tasks in the jenkins system can run in the independent Docker container without mutual interference.
A sending unit 204, configured to send, to the first slave node through a proxy service running on the service node, a pull instruction for a Docker image of the target operating environment type to the first slave node if the first slave node does not have a Docker container with an operating environment type that is consistent with the target operating environment type, so that the first slave node pulls the Docker image of the target operating environment type from a Docker warehouse, and creates the Docker container of the target operating environment type of the first slave node according to the Docker image of the target operating environment type of the first slave node.
Preset websites of a Docker warehouse are configured in the main node and the plurality of nodes. That is, the first slave node may pull the Docker image of the target operating environment type from a preset website according to the target operating environment type.
A Docker image may contain a complete ubuntu operating system environment with only Mysql or specific applications that the user needs installed.
The image container creation apparatus 10 of the second embodiment can create docker image containers of a plurality of runtime environment types on one node machine.
In another embodiment, the mirror container creating apparatus 10 further includes an executing unit, configured to, after creating the Docker container of the target runtime environment type of the first slave node according to the Docker mirror of the target runtime environment type of the first slave node, cause, by the proxy service, the Docker container of the target runtime environment type of the first slave node to execute the target task.
In a specific embodiment, the causing, by the proxy service, the Docker container of the target runtime environment type of the first slave node to perform the target task includes:
sending, by the proxy service, a command to the first slave node to launch a Docker container of a target runtime environment type of the first slave node;
sending, by the proxy service, a command to the first slave node to execute the target task in a Docker container of a target runtime environment type of the first slave node.
After the Docker container of the target runtime environment type of the first slave node is started, the target task may be executed according to a command for executing the target task in the Docker container of the target runtime environment type of the first slave node.
The influence of node shutdown or connection faults on creation of the mirroring container is reduced through the nodes, and the stability of task execution in the Docker container is improved. The multiple Docker containers of the master node or the first slave node may simulate multiple nodes of different operating environment types, reducing the number of required nodes.
The execution unit is also used for judging whether the connection with the main node is successful; judging whether a Docker container with the operating environment type consistent with the target operating environment type exists in the main node or not; if no Docker container with the operating environment type consistent with the target operating environment type exists in the main node, sending a pulling instruction of the Docker mirror image of the target operating environment type to the main node through the proxy service, enabling the main node to pull the Docker mirror image of the target operating environment type from a Docker warehouse, and creating the Docker container of the target operating environment type of the main node according to the Docker mirror image of the target operating environment type of the main node; enabling a Docker container of a target operation environment type of the main node to execute the target task through the proxy service.
In another embodiment, the connection unit is further configured to connect a second slave node of the plurality of nodes if the connection of the first slave node fails.
When the connection with part of the nodes fails, the rest nodes can be connected to find the connectable nodes in the nodes, so that the risk of connection failure is reduced.
In another embodiment, the mirror container creating apparatus 10 may further include a stopping unit configured to receive a deletion request for the target task after the Docker container of the target runtime environment type of the first slave node executes the target task; and stopping running the Docker container of the target running environment type of the first slave node according to the deletion request.
Specifically, after the target image container is created, a delete request for the target task may be received; sending an instruction to the first slave node to stop running the Docker container of the target running environment type of the first slave node; sending an instruction to the first slave node to delete the Docker container of the target runtime environment type of the first slave node. Preventing the Docker container of the target runtime environment type of the first slave node from continuously running.
In another embodiment, the execution unit is further configured to obtain the plurality of tasks to be executed and a Docker container of the plurality of tasks to be executed in the distributed system; and enabling the Docker containers of the tasks to be executed to respectively execute the tasks to be executed through the proxy service.
The proxy service enables the Docker containers of the tasks to be executed to respectively execute the tasks to be executed, so that the tasks to be executed can be executed in parallel in the distributed system, and the creation efficiency of the mirror image container is improved. The tasks may be distinguished based on their identification codes.
EXAMPLE III
The present embodiment provides a computer-readable storage medium, which stores thereon a computer program, and when executed by a processor, the computer program implements the steps in the aforementioned mirror image container creation method embodiment, for example, 101-104 shown in fig. 1:
101, acquiring a target task in a plurality of tasks to be executed, a plurality of nodes of the target task in the distributed system and a target operation environment type;
102 connecting a first slave node of the plurality of nodes;
103, judging whether a Docker container with the operating environment type consistent with the target operating environment type exists in the first slave node;
104, if no Docker container with the operating environment type consistent with the target operating environment type exists in the first slave node, sending a pull instruction of the Docker image of the target operating environment type to the first slave node through a proxy service running on the service node, so that the first slave node pulls the Docker image of the target operating environment type from a Docker warehouse, and creating the Docker container of the target operating environment type of the first slave node according to the Docker image of the target operating environment type of the first slave node.
Alternatively, the computer program, when executed by the processor, implements the functions of the modules/units in the above-mentioned device embodiments, for example, the unit 201 and 204 in fig. 2:
an obtaining unit 201, configured to obtain a target task of multiple tasks to be executed, multiple nodes of the target task in the distributed system, and a target operating environment type;
a connection unit 202 configured to connect a first slave node of the plurality of nodes;
a determining unit 203, configured to determine whether a Docker container whose operating environment type is consistent with the target operating environment type exists in the first slave node;
a sending unit 204, configured to send, to the first slave node through a proxy service running on a service node, a pull instruction for a Docker image of the target operating environment type to the first slave node if the first slave node does not have a Docker container with an operating environment type that is consistent with the target operating environment type, so that the first slave node pulls the Docker image of the target operating environment type from a Docker warehouse, and creates the Docker container of the target operating environment type of the first slave node according to the Docker image of the target operating environment type of the first slave node.
Example four
Fig. 3 is a schematic diagram of a computer device according to an embodiment of the present invention. The computer device 1 comprises a memory 20, a processor 30, a bus 50 and a computer program 40 stored in the memory 20 and executable on the processor 30. The processor 30, when executing the computer program 40, implements the steps in the aforementioned mirror image container creation method embodiment, such as 101-104 shown in fig. 1:
101, acquiring a target task in a plurality of tasks to be executed, a plurality of nodes of the target task in the distributed system and a target operation environment type;
102 connecting a first slave node of the plurality of nodes;
103, judging whether a Docker container with the operating environment type consistent with the target operating environment type exists in the first slave node;
104, if no Docker container with the operating environment type consistent with the target operating environment type exists in the first slave node, sending a pull instruction of the Docker image of the target operating environment type to the first slave node through a proxy service running on the service node, so that the first slave node pulls the Docker image of the target operating environment type from a Docker warehouse, and creating the Docker container of the target operating environment type of the first slave node according to the Docker image of the target operating environment type of the first slave node.
Alternatively, the processor 30, when executing the computer program 40, implements the functions of the modules/units in the above device embodiments, for example, the units 201 and 204 in fig. 2:
an obtaining unit 201, configured to obtain a target task of multiple tasks to be executed, multiple nodes of the target task in the distributed system, and a target operating environment type;
a connection unit 202 configured to connect a first slave node of the plurality of nodes;
a determining unit 203, configured to determine whether a Docker container whose operating environment type is consistent with the target operating environment type exists in the first slave node;
a sending unit 204, configured to send, to the first slave node through a proxy service running on a service node, a pull instruction for a Docker image of the target operating environment type to the first slave node if the first slave node does not have a Docker container with an operating environment type that is consistent with the target operating environment type, so that the first slave node pulls the Docker image of the target operating environment type from a Docker warehouse, and creates the Docker container of the target operating environment type of the first slave node according to the Docker image of the target operating environment type of the first slave node.
Illustratively, the computer program 40 may be partitioned into one or more modules/units that are stored in the memory 20 and executed by the processor 30 to implement the present invention. The one or more modules/units may be a series of computer program instruction segments capable of performing specific functions, which are used to describe the execution process of the computer program 40 in the computer apparatus 1. For example, the computer program 40 may be divided into an acquisition unit 201, a connection unit 202, a judgment unit 203, and a transmission unit 204 in fig. 2, and the specific functions of each unit are shown in embodiment two.
The Computer device 1 may be a PC (Personal Computer), or may be a terminal device such as a smart phone, a tablet Computer, a palmtop Computer, a portable Computer, an intelligent router, an ore machine, and a network storage device. In this embodiment, the computer apparatus 1 may be an edge server.
The Processor 30 may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic device, discrete hardware component, or the like. The general purpose processor may be a microprocessor or the processor 30 may be any conventional processor or the like, the processor 30 being the control center of the computer device 1 and connecting the various parts of the whole computer device 1 with various interfaces and lines.
The memory 20 may be used for storing the computer program 40 and/or the module/unit, and the processor 30 implements various functions of the computer device 1 by running or executing the computer program and/or the module/unit stored in the memory 20 and calling data stored in the memory 20. The memory 20 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required by at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data (such as audio data) created according to the use of the computer apparatus 1, and the like. Further, the memory 20 may include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a flash memory Card (FlashCard), at least one magnetic disk storage device, a flash memory device, or other non-volatile solid state storage device.
The bus 50 may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. The bus 50 may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown in FIG. 3, but this does not mean only one bus or one type of bus.
Further, the computer apparatus 1 may further include a network interface, which may optionally include a wired interface and/or a wireless interface (such as a WI-FI interface, a bluetooth interface, etc.), and is generally used for establishing a communication connection between the computer apparatus 1 and other electronic devices.
Alternatively, the computer device 1 may further comprise a user interface, which may comprise a Display (Display), an input unit such as a Keyboard (Keyboard), and an optional user interface which may also comprise a standard wired interface, a wireless interface, alternatively, in some embodiments, the Display may be an L ED Display, a liquid crystal Display, a touch-sensitive liquid crystal Display, an O L ED (Organic L light-Emitting Diode) touch-sensitive device, and the like.
It will be appreciated by a person skilled in the art that the schematic diagram 3 is merely an example of the computer device 1 and does not constitute a limitation of the computer device 1, and may comprise more or less components than those shown, or some components may be combined, or different components.
In the above embodiments, the implementation may be wholly or partially realized by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product.
The computer instructions may be stored in or transmitted from one computer readable storage medium to another computer readable storage medium, e.g., from one website site, computer, server, or data center, over a wired (e.g., coaxial cable, fiber optic, digital subscriber line (DS L)) or wireless (e.g., infrared, wireless, microwave, etc.) medium to be stored by a computer or a data center integrated server, data center, etc. the computer readable storage medium may be any available medium that can be stored by a computer or a data storage device comprising one or more available media such as a magnetic medium, (e.g., a floppy Disk, a magnetic tape), an optical medium (e.g., a Solid State medium), a Solid State medium (e.g., a SSD), etc.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the several embodiments provided in the present application, it should be understood that the disclosed system, apparatus and method may be implemented in other manners. For example, the above-described device embodiments are merely illustrative, and for example, the division of the units is only one type of logical function division, and other division manners may be available in actual implementation, for example, a plurality of units or components may be combined or integrated into another device, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application may be substantially implemented or contributed to by the prior art, or all or part of the technical solution may be embodied in a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-only memory (ROM), a magnetic disk, or an optical disk.
It should be noted that the above-mentioned numbers of the embodiments of the present invention are merely for description, and do not represent the merits of the embodiments. And the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, apparatus, article, or method 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, apparatus, article, or method. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, apparatus, article, or method that includes the element.
The above description is only a preferred embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the present specification and the accompanying drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.

Claims (10)

1. A mirror container creating method is applied to a service node in a distributed system, and is characterized by comprising the following steps:
acquiring a target task in a plurality of tasks to be executed, a plurality of nodes of the target task in the distributed system and a target operation environment type;
connecting a first slave node of the plurality of nodes;
judging whether a Docker container with the operating environment type consistent with the target operating environment type exists in the first slave node or not;
if no Docker container with the operating environment type consistent with the target operating environment type exists in the first slave node, sending a pulling instruction of the Docker mirror image of the target operating environment type to the first slave node through proxy service running in the service node, enabling the first slave node to pull the Docker mirror image of the target operating environment type from a Docker warehouse, and creating the Docker container of the target operating environment type of the first slave node according to the Docker mirror image of the target operating environment type of the first slave node.
2. The mirror container creation method of claim 1, wherein the determining whether a Docker container having a runtime environment type consistent with the target runtime environment type exists in the first slave node comprises:
querying a running environment type of each Docker container in the first slave node;
if the inquired operation environment type comprises the target operation environment type, determining that a Docker container with the operation environment type consistent with the target operation environment type exists in the first slave node;
and if the inquired operation environment type does not comprise the target operation environment type, determining that no Docker container with the operation environment type consistent with the target operation environment type exists in the first slave node.
3. The mirror container creation method of claim 1, wherein the plurality of nodes comprises a master node and a plurality of slave nodes, the connecting a first slave node of the plurality of nodes comprising:
connecting the main node;
and if the connection with the main node fails, connecting a first slave node in the plurality of slave nodes.
4. The mirror container creation method of claim 3, wherein if the connection to the master node is successful, the method further comprises:
judging whether a Docker container with the operating environment type consistent with the target operating environment type exists in the main node or not;
if no Docker container with the operating environment type consistent with the target operating environment type exists in the main node, sending a pulling instruction of the Docker mirror image of the target operating environment type to the main node through the proxy service, enabling the main node to pull the Docker mirror image of the target operating environment type from a Docker warehouse, and creating the Docker container of the target operating environment type of the main node according to the Docker mirror image of the target operating environment type of the main node;
enabling a Docker container of a target operation environment type of the main node to execute the target task through the proxy service.
5. The mirrored container creation method of claim 1, further comprising:
and if the connection of the first slave node fails, connecting a second slave node in the plurality of nodes.
6. The mirror container creation method according to any one of claims 1 to 3, wherein after the creating of the Docker container of the target runtime environment type of the first slave node from the Docker mirror of the target runtime environment type of the first slave node, the mirror container creation method further comprises:
enabling, by the proxy service, a Docker container of a target runtime environment type of the first slave node to execute the target task.
7. The mirror container creation method of claim 6, wherein the causing, by the proxy service, the Docker container of the target runtime environment type of the first slave node to perform the target task comprises:
sending, by the proxy service, a command to the first slave node to launch a Docker container of a target runtime environment type of the first slave node;
sending, by the proxy service, a command to the first slave node to execute the target task in a Docker container of a target runtime environment type of the first slave node.
8. A computer arrangement comprising a memory and a processor, the memory having stored thereon a computer program operable on the processor, the computer program, when executed by the processor, implementing the mirror container creation method according to any of claims 1-7.
9. A mirrored container creation apparatus, the apparatus comprising:
the system comprises an acquisition unit, a processing unit and a processing unit, wherein the acquisition unit is used for acquiring a target task in a plurality of tasks to be executed, a plurality of nodes of the target task in the distributed system and a target operation environment type;
a connection unit configured to connect a first slave node among the plurality of nodes;
a judging unit, configured to judge whether a Docker container with an operating environment type consistent with the target operating environment type exists in the first slave node;
a sending unit, configured to send, to the first slave node, a pull instruction for a Docker image of the target operation environment type through a proxy service running on a service node if the first slave node does not have a Docker container of an operation environment type consistent with the target operation environment type, so that the first slave node pulls the Docker image of the target operation environment type from a Docker warehouse, and create the Docker container of the target operation environment type of the first slave node according to the Docker image of the target operation environment type of the first slave node.
10. A computer-readable storage medium, having stored thereon a computer program which, when executed by a processor, implements the image container creation method according to any one of claims 1 to 7.
CN202010202991.7A 2020-03-20 2020-03-20 Mirror image container creation method and device, computer device and storage medium Pending CN111414234A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010202991.7A CN111414234A (en) 2020-03-20 2020-03-20 Mirror image container creation method and device, computer device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010202991.7A CN111414234A (en) 2020-03-20 2020-03-20 Mirror image container creation method and device, computer device and storage medium

Publications (1)

Publication Number Publication Date
CN111414234A true CN111414234A (en) 2020-07-14

Family

ID=71491396

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010202991.7A Pending CN111414234A (en) 2020-03-20 2020-03-20 Mirror image container creation method and device, computer device and storage medium

Country Status (1)

Country Link
CN (1) CN111414234A (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111736810A (en) * 2020-08-18 2020-10-02 四川新网银行股份有限公司 Method for dynamically creating node of docker container to execute task based on jenkins real-time task
CN112035238A (en) * 2020-09-11 2020-12-04 曙光信息产业(北京)有限公司 Task scheduling processing method and device, cluster system and readable storage medium
CN112099815A (en) * 2020-09-27 2020-12-18 中国银行股份有限公司 Continuous integration environment construction method and device
CN112346732A (en) * 2020-10-30 2021-02-09 深圳市优必选科技股份有限公司 Cross-language calling method and device of application program, electronic equipment and storage medium
CN113672368A (en) * 2021-08-18 2021-11-19 上海哔哩哔哩科技有限公司 Task scheduling method and system
CN114090183A (en) * 2021-11-25 2022-02-25 北京字节跳动网络技术有限公司 Application starting method and device, computer equipment and storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107431720A (en) * 2015-12-31 2017-12-01 华为技术有限公司 Mirror image dispositions method and device
CN108255737A (en) * 2018-02-27 2018-07-06 郑州云海信息技术有限公司 Based on multi version operating system testing method, system and equipment and storage medium
CN108920259A (en) * 2018-03-30 2018-11-30 华为技术有限公司 Deep learning job scheduling method, system and relevant device
CN109213494A (en) * 2018-08-03 2019-01-15 北京奇安信科技有限公司 A kind of processing method and processing device of automatic deployment cluster test host
CN109783197A (en) * 2019-01-18 2019-05-21 北京百度网讯科技有限公司 Dispatching method and device for program runtime environment
CN110399307A (en) * 2019-07-31 2019-11-01 网宿科技股份有限公司 A kind of test method, test platform and destination server

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107431720A (en) * 2015-12-31 2017-12-01 华为技术有限公司 Mirror image dispositions method and device
CN108255737A (en) * 2018-02-27 2018-07-06 郑州云海信息技术有限公司 Based on multi version operating system testing method, system and equipment and storage medium
CN108920259A (en) * 2018-03-30 2018-11-30 华为技术有限公司 Deep learning job scheduling method, system and relevant device
CN109213494A (en) * 2018-08-03 2019-01-15 北京奇安信科技有限公司 A kind of processing method and processing device of automatic deployment cluster test host
CN109783197A (en) * 2019-01-18 2019-05-21 北京百度网讯科技有限公司 Dispatching method and device for program runtime environment
CN110399307A (en) * 2019-07-31 2019-11-01 网宿科技股份有限公司 A kind of test method, test platform and destination server

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
KYLE BANKER等, 华中科技大学出版社 *
郭丽蓉 等: "《计算机信息安全与网络技术应用》", 30 April 2019, 汕头大学出版社 *

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111736810A (en) * 2020-08-18 2020-10-02 四川新网银行股份有限公司 Method for dynamically creating node of docker container to execute task based on jenkins real-time task
CN112035238A (en) * 2020-09-11 2020-12-04 曙光信息产业(北京)有限公司 Task scheduling processing method and device, cluster system and readable storage medium
CN112099815A (en) * 2020-09-27 2020-12-18 中国银行股份有限公司 Continuous integration environment construction method and device
CN112099815B (en) * 2020-09-27 2023-09-19 中国银行股份有限公司 Continuous integrated environment construction method and device
CN112346732A (en) * 2020-10-30 2021-02-09 深圳市优必选科技股份有限公司 Cross-language calling method and device of application program, electronic equipment and storage medium
CN112346732B (en) * 2020-10-30 2024-01-12 深圳市优必选科技股份有限公司 Cross-language calling method and device for application program, electronic equipment and storage medium
CN113672368A (en) * 2021-08-18 2021-11-19 上海哔哩哔哩科技有限公司 Task scheduling method and system
CN114090183A (en) * 2021-11-25 2022-02-25 北京字节跳动网络技术有限公司 Application starting method and device, computer equipment and storage medium

Similar Documents

Publication Publication Date Title
CN111414234A (en) Mirror image container creation method and device, computer device and storage medium
US20210232498A1 (en) Method for testing edge computing, device, and readable storage medium
KR102317535B1 (en) Methods and systems for implementing data tracking with software development kits
US9386079B2 (en) Method and system of virtual desktop infrastructure deployment studio
US8171406B1 (en) Automating user interface navigation
US11019156B1 (en) Automatic discovery and registration of service applications for files introduced to a user interface
CN111694592A (en) Management method and system for project version release
JP6529501B2 (en) How to generate dynamically customized context-sensitive help
CN104881318A (en) Interface calling method and device and terminal
CN105808690A (en) Directory displaying system and method
CN111290907A (en) Distributed storage network pressure measurement method and device, computer device and storage medium
US20170161181A1 (en) Testing support system, and testing support method
CN112968929A (en) Server management method and system
US10193737B2 (en) Method for performing communication between browser and mobile terminal, and browser apparatus
US11113357B2 (en) Method and system for onboarding a virtual network function package utilized by one or more network services
CN110764746B (en) Script generation method and device and computer readable storage medium
CN110879701B (en) Workflow visual configuration method, server, system and medium
JP2010224828A (en) Computer automatic kitting system
Silver Monitoring network and service availability with open-source software
JP4825120B2 (en) Service management system, service management apparatus, and service management method
US20150143333A1 (en) Native Application Variation
CN107544750B (en) Terminal device
JP2020009026A (en) Management system, information processing apparatus, setting management method, and program
CN103917944A (en) System and methods thereof for dynamically updating the contents of a folder on a device
CN112165512B (en) File release method and device, terminal equipment and storage medium

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
RJ01 Rejection of invention patent application after publication

Application publication date: 20200714

RJ01 Rejection of invention patent application after publication