WO2017092672A1 - 一种Docker容器运行方法和装置 - Google Patents

一种Docker容器运行方法和装置 Download PDF

Info

Publication number
WO2017092672A1
WO2017092672A1 PCT/CN2016/107978 CN2016107978W WO2017092672A1 WO 2017092672 A1 WO2017092672 A1 WO 2017092672A1 CN 2016107978 W CN2016107978 W CN 2016107978W WO 2017092672 A1 WO2017092672 A1 WO 2017092672A1
Authority
WO
WIPO (PCT)
Prior art keywords
virtual machine
container
layer data
image
docker container
Prior art date
Application number
PCT/CN2016/107978
Other languages
English (en)
French (fr)
Inventor
薄海
刘基
罗浩
线超博
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Priority to EP16869982.5A priority Critical patent/EP3324291B1/en
Publication of WO2017092672A1 publication Critical patent/WO2017092672A1/zh
Priority to US15/913,186 priority patent/US10579355B2/en

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
    • 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/45504Abstract machines for programme code execution, e.g. Java virtual machine [JVM], interpreters, emulators
    • 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
    • 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
    • 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/4555Para-virtualisation, i.e. guest operating system has to be modified
    • 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
    • G06F2009/45575Starting, stopping, suspending or resuming virtual machine instances
    • 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
    • G06F2009/45579I/O management, e.g. providing access to device drivers or storage
    • 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

Definitions

  • the embodiments of the present invention relate to the field of communications, and in particular, to a method and an apparatus for operating a Docker container.
  • Container is an open source application container engine designed to provide an automated deployment solution for applications. Quickly create a container on a Linux system.
  • the container is a lightweight virtual machine and deploys and runs the application. It is very convenient to automate the installation, deployment and upgrade of the application through the configuration file. Docker virtualizes multiple containers, each of which is isolated from each other without interfaces, and can separate each other's production environment from the development environment without affecting each other.
  • OS-level isolation At present, the cornerstone of cloud services is OS-level isolation.
  • One or more virtual machines (VMs) run services on the same host, and Docker implements an application-level isolation, which changes the basics.
  • the development and operation unit is converted from a direct operation VM to a "container" that operates the application.
  • Docker container technology With the gradual use of Docker container technology in development, testing, and production environments, how to build applications in virtual machines before running on Dcoker is a key topic of current research.
  • One solution of the prior art is that the developer studies the deployment of the application on the virtual machine, including the deployment architecture, deployment components, installation and configuration methods, and commissioning methods of the application. After that, the developer according to the Docker container image requirements. Build the container image corresponding to the application, then deploy and configure the built container image, and test it. After the test is successful, store the container image of the application to the Docker container mirror repository. When the application needs to run, the container is Mirroring warehouse call should be The container used is mirrored and running.
  • Embodiments of the present invention provide a Docker container running method and apparatus for running an application built in a virtual machine on a Dcoker container by a simple and efficient method.
  • An embodiment of the present invention provides a container Docker container running method, including:
  • the layer data corresponding to the Docker container and the metadata information of the virtual machine image are read out from all the layer data in the virtual machine image; wherein the layer data corresponding to the Docker container is a layer required for running the Docker container corresponding to the application to be executed. data;
  • the snapshot layer file corresponding to the Docker container is generated according to the layer data corresponding to the read Docker container, wherein the snapshot layer file corresponding to the Docker container includes a snapshot of the layer data corresponding to the Docker container; the snapshot layer file corresponding to the Docker container is readable. Layer file written;
  • the snapshot layer file corresponding to the Docker container is mounted to the working directory, and the environment configuration is performed according to the metadata information of the read virtual machine image;
  • Run the pending snapshot file by running the snapshot layer file corresponding to the Docker container that is mounted to the working directory. Use the corresponding Docker container.
  • the layer data corresponding to the Docker container and the metadata information of the virtual machine image can be read out from all the layer data in the virtual machine image, and the layer data corresponding to the Docker container is used to run the corresponding application to be executed.
  • the layer data required by the Docker container, and further, the Docker container corresponding to the application to be executed can be run according to the layer data corresponding to the read Docker container and the metadata information of the virtual machine image. It can be seen that the process is simple and fast, and avoids the method of using the manual method to convert the virtual machine image of the application to be converted into a container image in the prior art, and the developer does not need to know the whole virtual machine image corresponding to the application to be executed.
  • the deployment method of the container image is also known. It can be seen that the method provided by the embodiment of the present invention can easily and efficiently run the application built in the virtual machine on the Dcoker container, and reduces the requirements for the developer.
  • the layer data corresponding to the Docker container and the metadata information of the virtual machine image are read out from all the layer data in the virtual machine image, and the specific information includes:
  • the virtual machine image driver is invoked, and the metadata information of the layer data and the virtual machine image corresponding to the Docker container is read out from all the layer data in the virtual machine image by the invoked virtual machine image driver.
  • the format of the virtual machine image to be read can be configured in the virtual machine image driver, so that the virtual machine image can be successfully read by the virtual machine image, thus directly reading the virtual machine image.
  • the purpose of the Docker container corresponding layer data and the metadata information of the virtual machine image avoids the method of manually converting the virtual machine image of the application to be converted into a container image in the prior art, and the developer does not need to understand
  • the method for constructing the container image is also known. It can be seen that the method provided by the embodiment of the present invention can simply and efficiently run the application built in the virtual machine on the Dcoker container and reduce the application. The requirements for developers.
  • the layer data corresponding to the Docker container includes:
  • Layer data in all layer data in the virtual machine image except kernel files, system directories, and files in the root directory.
  • the file is to be executed in the embodiment of the present invention, because the Docker container of the application to be executed is not running the kernel file, the system directory, and the file in the root directory.
  • the application's Docker container can also not read the kernel files, system directories, and files in the root directory of the virtual machine image. This can reduce network load and improve data processing speed.
  • performing environment configuration according to the metadata information of the read virtual machine image specifically:
  • the system parameters are environment variables.
  • the parameters of the system are configured to match the system parameters after the configuration with the metadata information of the virtual machine image corresponding to the application to be executed, thereby improving the running of the application to be executed. Success rate.
  • the method before acquiring the virtual machine image corresponding to the identifier of the to-be-executed application according to the identifier of the to-be-executed application included in the execution command, the method further includes:
  • the virtual machine image corresponding to the to-be-executed application is generated, and the virtual machine image is stored in the virtual machine image storage area.
  • the virtual machine image corresponding to the identifier of the to-be-executed application is obtained according to the identifier of the to-be-executed application included in the execution command, which includes:
  • the virtual machine image corresponding to the identifier of the to-be-executed application is obtained from the virtual machine image storage area according to the identifier of the to-be-executed application included in the execution command.
  • the virtual machine image corresponding to the identifier of the application to be executed can be quickly determined according to the identifier of the application to be executed, and the data processing speed is improved.
  • An embodiment of the present invention provides a container Docker container running method, including:
  • Snapshot layer files corresponding to all layer data are generated according to all layer data read out; the snapshot layer file corresponding to all layer data is a readable and writable layer file;
  • the layer data other than the layer data corresponding to the Docker container is deleted from the snapshot layer file corresponding to all the layer data of the first working directory; wherein the layer data corresponding to the Docker container is the Docker for running the application to be executed.
  • the layer file remaining in the snapshot layer file corresponding to all layer data after the deletion operation, and the metadata information of the virtual machine image are packaged to obtain a preprocess image
  • the metadata information of the pre-processed image and the container image is packaged, and the container image corresponding to the identifier of the application to be executed is obtained;
  • the layer data corresponding to the Docker container and the metadata information of the virtual machine image can be read out from all the layer data in the virtual machine image, and the layer data corresponding to the Docker container is used to run the corresponding application to be executed.
  • the layer data required by the Docker container, and further, the Docker container corresponding to the application to be executed can be run according to the layer data corresponding to the read Docker container and the metadata information of the virtual machine image. It can be seen that the process is simple and fast, and avoids the method of using the manual method to convert the virtual machine image of the application to be converted into a container image in the prior art, and the developer does not need to know the whole virtual machine image corresponding to the application to be executed.
  • the deployment method of the container image is also known. It can be seen that the method provided by the embodiment of the present invention can easily and efficiently run the application built in the virtual machine on the Dcoker container, and reduces the requirements for the developer.
  • the metadata information of all layer data and the virtual machine image is read out from the virtual machine image, and specifically includes:
  • the virtual machine image driver is invoked, and metadata information of all layer data and virtual machine images is read out from the virtual machine image through the invoked virtual machine image driver.
  • information such as the format of the virtual machine image to be read can be configured in the virtual machine image driver, so that the virtual machine image can be successfully read through the virtual machine image.
  • the layer data corresponding to the Docker container includes:
  • Layer data in all layer data in the virtual machine image except kernel files, system directories, and files in the root directory;
  • the metadata information of the container image includes: the storage format and storage location of the information in the pre-processed image, and the hierarchical relationship between the data of each layer in the layer data corresponding to the Docker container.
  • the kernel file, the system directory, and the files in the root directory may not be run. Therefore, in the embodiment of the present invention, the kernel file, the system directory, and the root are used. Files such as files in the directory are deleted from the snapshot layer files corresponding to all layer data. Therefore, the newly generated container image does not include kernel files, system directories, files in the root directory, etc., and the container image is run. In this case, it is possible to not read kernel files, system directories, and files in the root directory, thus reducing network load and speeding up data processing.
  • the method further includes:
  • running the container image corresponding to the identifier of the application to be executed specifically:
  • the snapshot layer file corresponding to the Docker container is generated according to the layer data corresponding to the read Docker container, wherein the snapshot layer file corresponding to the Docker container includes a snapshot of the layer data corresponding to the Docker container; the snapshot layer file corresponding to the Docker container is readable. Layer file written;
  • the Docker container corresponding to the application to be executed can be run by reading the container image.
  • the method for converting the virtual machine image of the application to be executed into the container image by using the manual method in the prior art is avoided, and the developer does not need to understand the overall deployment of the virtual machine image corresponding to the application to be executed, and also understand the container image.
  • the method of the present invention can be seen that the method provided by the embodiment of the present invention can easily and efficiently run an application built in a virtual machine on a Dcoker container, and reduces requirements for developers.
  • the layer data corresponding to the Docker container and the metadata information of the container image are read out from the container image, and specifically include:
  • the container mirror driver is called, and the metadata information of the layer data and the container image corresponding to the Docker container is read out from the container image by the called container mirror driver.
  • information such as the format of the container image to be read can be configured in the container image driver, so that the container image can be successfully read through the container image.
  • performing environment configuration according to the metadata information in the read container image specifically:
  • the system parameters are environment variables.
  • the parameters of the system are configured to match the system parameters after the configuration with the metadata information of the virtual machine image corresponding to the application to be executed, thereby improving the running of the application to be executed. Success rate.
  • the method before acquiring the virtual machine image corresponding to the identifier of the to-be-executed application according to the identifier of the to-be-executed application included in the execution command, the method further includes:
  • the virtual machine image corresponding to the identifier of the to-be-executed application is generated, and the virtual machine image corresponding to the identifier of the application to be executed is stored in the virtual machine image storage area.
  • the virtual machine image includes:
  • the virtual machine image corresponding to the identifier of the to-be-executed application is obtained from the virtual machine image storage area according to the identifier of the to-be-executed application included in the execution command.
  • the virtual machine image corresponding to the identifier of the application to be executed can be quickly determined according to the identifier of the application to be executed, and the data processing speed is improved.
  • An embodiment of the present invention provides a container Docker container running device, including:
  • a receiving unit configured to receive an execution command for instructing to run a Docker container corresponding to the application to be executed; wherein the execution command includes an identifier of the application to be executed;
  • An obtaining unit configured to obtain a virtual machine image corresponding to the identifier of the to-be-executed application according to the identifier of the to-be-executed application included in the execution command;
  • a processing unit configured to read, from all layer data in the virtual machine image, layer data corresponding to the Docker container and metadata information of the virtual machine image; and generate a snapshot layer corresponding to the Docker container according to the layer data corresponding to the read Docker container File, mount the snapshot layer file corresponding to the Docker container to the working directory, and perform environment configuration according to the metadata information of the read virtual machine image; run the snapshot layer file corresponding to the Docker container mounted to the working directory, and run Execute the Docker container corresponding to the application;
  • the layer data corresponding to the Docker container is the layer data required for running the Docker container corresponding to the application to be executed;
  • the snapshot layer file corresponding to the Docker container includes a snapshot of the layer data corresponding to the Docker container;
  • the snapshot layer file corresponding to the Docker container is Readable and writable layer files.
  • processing unit is specifically configured to:
  • the virtual machine image driver is invoked, and the metadata information of the layer data and the virtual machine image corresponding to the Docker container is read out from all the layer data in the virtual machine image by the invoked virtual machine image driver.
  • the layer data corresponding to the Docker container includes:
  • Layer data in all layer data in the virtual machine image except kernel files, system directories, and files in the root directory.
  • processing unit is specifically configured to:
  • the system parameters are performed according to the metadata information of the virtual machine image corresponding to the read application to be executed.
  • the configuration is such that the system parameters after the configuration match the metadata information of the virtual machine image corresponding to the application to be executed;
  • the system parameters are environment variables.
  • the method further includes: generating a unit, configured to:
  • the virtual machine image corresponding to the to-be-executed application is generated, and the virtual machine image is stored in the virtual machine image storage area.
  • the virtual machine image corresponding to the identifier of the to-be-executed application is obtained from the virtual machine image storage area according to the identifier of the to-be-executed application included in the execution command.
  • An embodiment of the present invention provides a container Docker container running device, including:
  • a receiving unit configured to receive an execution command for instructing to run a Docker container corresponding to the application to be executed; wherein the execution command includes an identifier of the application to be executed;
  • An obtaining unit configured to obtain a virtual machine image corresponding to the identifier of the to-be-executed application according to the identifier of the to-be-executed application included in the execution command;
  • a conversion unit configured to read metadata information of all layer data and virtual machine images from the virtual machine image; generate snapshot layer files corresponding to all layer data according to all layer data read out; and snapshot layer files corresponding to all layer data a layer file that is readable and writable; the snapshot layer file corresponding to all the layer data is mounted to the first working directory; and the corresponding Docker container is deleted from the snapshot layer file corresponding to all the layer data of the first working directory.
  • the layer data other than the layer data; the layer file remaining in the snapshot layer file corresponding to all layer data after the deletion operation, and the metadata information of the virtual machine image are packaged to obtain a pre-process image;
  • the processing unit is configured to run a Docker container corresponding to the application to be executed by running a container image corresponding to the identifier of the application to be executed.
  • the conversion unit is specifically configured to:
  • the virtual machine image driver is invoked, and metadata information of all layer data and virtual machine images is read out from the virtual machine image through the invoked virtual machine image driver.
  • the layer data corresponding to the Docker container includes:
  • Layer data in all layer data in the virtual machine image except kernel files, system directories, and files in the root directory;
  • the metadata information of the container image includes: the storage format and storage location of the information in the pre-processed image, and the hierarchical relationship between the data of each layer in the layer data corresponding to the Docker container.
  • the conversion unit is further configured to:
  • processing unit is specifically configured to:
  • the snapshot layer file corresponding to the Docker container is generated according to the layer data corresponding to the read Docker container, wherein the snapshot layer file corresponding to the Docker container includes a snapshot of the layer data corresponding to the Docker container; the snapshot layer file corresponding to the Docker container is readable. Layer file written;
  • the snapshot layer file corresponding to the Docker container is mounted to the second working directory, and the environment configuration is performed according to the metadata information of the read container image;
  • processing unit is specifically configured to:
  • the container mirror driver is called, and the metadata information of the layer data and the container image corresponding to the Docker container is read out from the container image by the called container mirror driver.
  • processing unit is specifically configured to:
  • the system parameters are performed according to the metadata information in the container image corresponding to the read application to be executed. Configured so that the system parameters after the configuration match the metadata information in the container image corresponding to the application to be executed;
  • the system parameters are environment variables.
  • the method further includes: generating a unit, configured to:
  • the virtual machine image corresponding to the identifier of the to-be-executed application is generated, and the virtual machine image corresponding to the identifier of the application to be executed is stored in the virtual machine image storage area.
  • the virtual machine image corresponding to the identifier of the to-be-executed application is obtained from the virtual machine image storage area according to the identifier of the to-be-executed application included in the execution command.
  • An embodiment of the present invention provides a container Docker container running device, including:
  • a transceiver configured to receive an execution command for instructing to run a Docker container corresponding to the application to be executed; wherein the execution command includes an identifier of the application to be executed;
  • a memory configured to store a virtual machine image corresponding to the identifier of the application to be executed
  • the processor is configured to obtain a virtual machine image corresponding to the identifier of the to-be-executed application according to the identifier of the to-be-executed application included in the execution command, and read the layer data and the virtual machine corresponding to the Docker container from all layer data in the virtual machine image.
  • Mirroring metadata information generating a snapshot layer file corresponding to the Docker container according to the layer data corresponding to the read Docker container, and mounting the snapshot layer file corresponding to the Docker container to the working directory, and according to the read virtual machine image
  • the data information is configured by the environment; the Docker container corresponding to the application to be executed is run by running the snapshot layer file corresponding to the Docker container that is mounted to the working directory;
  • the layer data corresponding to the Docker container is the layer data required for running the Docker container corresponding to the application to be executed;
  • the snapshot layer file corresponding to the Docker container includes a snapshot of the layer data corresponding to the Docker container;
  • the snapshot layer file corresponding to the Docker container is Readable and writable layer files.
  • the processor is specifically configured to:
  • the virtual machine image driver is invoked, and the metadata information of the layer data and the virtual machine image corresponding to the Docker container is read out from all the layer data in the virtual machine image by the invoked virtual machine image driver.
  • the layer data corresponding to the Docker container includes:
  • Layer data in all layer data in the virtual machine image except kernel files, system directories, and files in the root directory.
  • the processor is specifically configured to:
  • the system parameters are environment variables.
  • the processor is further configured to:
  • the virtual machine image corresponding to the to-be-executed application is generated, and the virtual machine image is stored in the virtual machine image storage area.
  • the virtual machine image corresponding to the identifier of the to-be-executed application is obtained from the virtual machine image storage area according to the identifier of the to-be-executed application included in the execution command.
  • An embodiment of the present invention provides a container Docker container running device, including:
  • a transceiver configured to receive an execution command for instructing to run a Docker container corresponding to the application to be executed; wherein the execution command includes an identifier of the application to be executed;
  • a memory configured to store a virtual machine image corresponding to the identifier of the application to be executed
  • the processor is configured to obtain a virtual machine image corresponding to the identifier of the application to be executed according to the identifier of the to-be-executed application included in the execution command, and read out metadata information of all layer data and the virtual machine image from the virtual machine image; All the layer data is generated, and the snapshot layer file corresponding to all layer data is generated; the snapshot layer file corresponding to all layer data is a readable and writable layer file; and the snapshot layer file corresponding to all layer data is mounted to the first working directory; The layer data other than the layer data corresponding to the Docker container is deleted from the snapshot layer file corresponding to all the layer data of the first working directory; the remaining layer in the snapshot layer file corresponding to all layer data after the deletion operation is performed.
  • the file and the metadata information of the virtual machine image are packaged to obtain a pre-processed image; and the metadata information of the container image is generated according to the pre-processed image; wherein the metadata information of the container image includes the format information of the pre-processed image;
  • the metadata information of the image and the container image is packaged, and the container image corresponding to the identifier of the application to be executed is obtained; , Docker container layer data corresponding to layers of data to be used to run applications corresponding to execution Docker containers required; Run the Docker container corresponding to the application to be executed by running the container image corresponding to the ID of the application to be executed.
  • the processor is specifically configured to:
  • the virtual machine image driver is invoked, and metadata information of all layer data and virtual machine images is read out from the virtual machine image through the invoked virtual machine image driver.
  • the layer data corresponding to the Docker container includes:
  • Layer data in all layer data in the virtual machine image except kernel files, system directories, and files in the root directory;
  • the metadata information of the container image includes: the storage format and storage location of the information in the pre-processed image, and the hierarchical relationship between the data of each layer in the layer data corresponding to the Docker container.
  • the processor is further configured to:
  • the processor is specifically configured to:
  • the snapshot layer file corresponding to the Docker container is generated according to the layer data corresponding to the read Docker container, wherein the snapshot layer file corresponding to the Docker container includes a snapshot of the layer data corresponding to the Docker container; the snapshot layer file corresponding to the Docker container is readable. Layer file written;
  • the snapshot layer file corresponding to the Docker container is mounted to the second working directory, and the environment configuration is performed according to the metadata information of the read container image;
  • the processor is specifically configured to:
  • the processor is specifically configured to:
  • the system parameters are environment variables.
  • the processor is further configured to:
  • the virtual machine image corresponding to the identifier of the to-be-executed application is generated, and the virtual machine image corresponding to the identifier of the application to be executed is stored in the virtual machine image storage area.
  • the virtual machine image corresponding to the identifier of the to-be-executed application is obtained from the virtual machine image storage area according to the identifier of the to-be-executed application included in the execution command.
  • an execution command is sent to indicate that the Docker container corresponding to the application to be executed is executed.
  • the execution command includes an identifier of the application to be executed, and the application to be executed is obtained according to the identifier of the application to be executed included in the execution command.
  • the virtual machine image corresponding to the identifier; the layer data corresponding to the Docker container and the metadata information of the virtual machine image are read out from all the layer data in the virtual machine image; wherein the layer data corresponding to the Docker container is used to run the to-be-executed application
  • the layer data required by the corresponding Docker container; the snapshot layer file corresponding to the Docker container is generated according to the layer data corresponding to the read Docker container, wherein the snapshot layer file corresponding to the Docker container includes a snapshot of the layer data corresponding to the Docker container; Docker
  • the snapshot layer file corresponding to the container is a readable and writable layer file; the snapshot layer file corresponding to the Docker container is mounted to the working directory, and the environment configuration is performed according to the metadata information of the read virtual machine image;
  • the snapshot layer file corresponding to the Docker container of the working directory, and the Dock corresponding to the application to be executed is run.
  • the layer data corresponding to the Docker container and the metadata information of the virtual machine image can be read out from all the layer data in the virtual machine image, and the layer data corresponding to the Docker container is used to run the corresponding application to be executed.
  • the layer data required by the Docker container, and further, the Docker container corresponding to the application to be executed can be run according to the layer data corresponding to the read Docker container and the metadata information of the virtual machine image. It can be seen that the process is simple and fast, and avoids the method of manually converting the virtual machine image of the application to be converted into the container image in the prior art.
  • the method also requires the developer to understand the overall deployment of the virtual machine image corresponding to the application to be executed, and also to understand the method of constructing the container image. It can be seen that the method provided by the embodiment of the present invention can be easily and efficiently run on the Dcoker container.
  • the application built in the virtual machine reduces the requirements for developers.
  • FIG. 1 is a schematic diagram of a system architecture applicable to a Docker container operation according to an embodiment of the present invention
  • FIG. 2a is a schematic flowchart of a method for running a Docker container according to an embodiment of the present invention
  • 2b is a schematic flowchart of a method for running a Docker container according to an embodiment of the present invention
  • FIG. 3 is a schematic structural diagram of a Docker container running device according to an embodiment of the present invention.
  • FIG. 4 is a schematic structural diagram of another Docker container running device according to an embodiment of the present invention.
  • FIG. 5 is a schematic structural diagram of another Docker container running device according to an embodiment of the present invention.
  • FIG. 6 is a schematic structural diagram of another Docker container running device according to an embodiment of the present invention.
  • FIG. 1 is a schematic diagram showing a system architecture applicable to a Docker container running method according to an embodiment of the present invention.
  • the Docker client 1100 and the Docker container running device 1101 are included.
  • a virtual machine mirroring driver 1102 and a container mirroring driver 1103 are also included, and a virtual machine image storage area 1106 for storing virtual machine images, and a container image storage area 1104 for storing container images.
  • the Docker client 1100 is configured to send a run command to the Docker container running device 1101 to instruct the Docker container running the application to be run, and receive the Docker container running device. Set the running result of the virtual machine image returned by 1101 or the running result of the container image.
  • the Docker container running device 1101 is configured to receive a running command sent by the Docker client 1100 for instructing to run the Docker container, and according to the running command, drive the virtual machine image driver to run the virtual machine image, and the Docker container running device 1101 receives the virtual machine image and returns The result of running the virtual machine image. Or convert the virtual machine image to a container image, and then run the container image through the driver container image driver, and the container mirror driver returns the result of the container image.
  • the container mirror driver 1103 is used to run the container image, and the virtual machine mirror driver 1102 is used to run the virtual machine image.
  • the virtual machine image driver 1102 supports recognition of virtual machine images, support for virtual machine image layering, and support for maintenance of metadata in virtual machine images.
  • the system architecture applicable to the embodiment of the present invention further includes a Docker-based image conversion device 1105, and the Docker-based image conversion device 1105 is configured to convert the virtual machine image into a container image and store the container image in the container image storage.
  • the container mirroring driver 1103 obtains the container image from the container mirror storage area 1104. Specifically, after the virtual machine image driver obtains the virtual machine image corresponding to the to-be-executed application from the virtual machine image storage area, the virtual machine image is read out, and the read virtual machine image is converted by the Docker-based image conversion device 1105. The container is mirrored and the container image is stored in the container image storage area 1104.
  • the application to be executed is a conventional application.
  • the to-be-executed application has successfully built a virtual machine image in the virtual machine.
  • the Docker container technology it is now necessary to run the to-be-executed application previously built in the virtual machine in the Docker container.
  • the following embodiments are provided for the application to be executed.
  • FIG. 2a exemplarily shows a schematic flowchart of a method for operating a Docker container according to an embodiment of the present invention.
  • an embodiment of the present invention provides a Docker container running method, as shown in FIG. 2a, including:
  • Step 201 Receive an execution command for instructing a Docker container corresponding to the running application to be executed, where the execution command includes an identifier of the application to be executed.
  • Step 202 Obtain a virtual machine image corresponding to the identifier of the application to be executed according to the identifier of the to-be-executed application included in the execution command.
  • the virtual machine image corresponding to the identifier of the application to be executed may be obtained from the virtual machine image storage area. Then, through step 203, performing a read operation on the virtual machine image;
  • Step 203 Read the layer data corresponding to the Docker container and the metadata information of the virtual machine image from all the layer data in the virtual machine image; wherein the layer data corresponding to the Docker container is used to run the Docker container corresponding to the application to be executed. Required layer data;
  • Step 204 Generate a snapshot layer file corresponding to the Docker container according to the layer data corresponding to the read Docker container, where the snapshot layer file corresponding to the Docker container includes a snapshot of the layer data corresponding to the Docker container; the snapshot layer file corresponding to the Docker container is Readable and writable layer file;
  • Step 205 The snapshot layer file corresponding to the Docker container is mounted to the working directory, and the environment configuration is performed according to the metadata information of the read virtual machine image;
  • Step 206 Run the Docker container corresponding to the application to be executed by running the snapshot layer file corresponding to the Docker container that is mounted to the working directory.
  • the method provided by the foregoing steps 201 to 206 in the embodiment of the present invention is to directly run the virtual machine image corresponding to the Docker container, and the two solutions are simple and efficient to implement the application built in the virtual machine before running on the Dcoker.
  • the process of constructing the container image corresponding to the application running in the virtual machine in a manual manner in the prior art is avoided, and the requirement for the developer is reduced.
  • the virtual machine image corresponding to the application to be executed is generated based on the virtual machine technology, and the virtual machine image is stored in the virtual machine image storage area.
  • the foregoing step 202 includes: obtaining a virtual machine image corresponding to the identifier of the to-be-executed application from the virtual machine image storage area according to the identifier of the to-be-executed application included in the execution command.
  • the virtual machine image storage area can be obtained locally or in the cloud.
  • the virtual machine image corresponding to the identifier of the application to be executed is taken from the local virtual machine image or downloaded from the cloud to the local machine.
  • step 203 a read operation is performed on the virtual machine image.
  • the virtual machine mirror driver is invoked, and the layer data corresponding to the Docker container and the metadata information of the virtual machine image are read out from all the layer data in the virtual machine image by the invoked virtual machine mirror driver.
  • the virtual machine image driver may be based on the virtual machine image. The format successfully reads the virtual machine image.
  • all layer data included in the virtual machine image is virtual machine data information that is actually stored in the virtual machine image, such as an operating system, a library file, a runnable program, a configuration, and the like. All layer data included in the virtual machine image is divided into two parts, which are the layer data corresponding to the Docker container, and other layer data.
  • the layer data corresponding to the Docker container is the layer data required for running the Docker container corresponding to the application to be executed, that is, the layer data that must be read out when running the application to be executed.
  • the layer data corresponding to the Docker container includes: layer data of all the layer data in the virtual machine image except the kernel file, the system directory, and the files in the root directory.
  • the other layer data is layer data that does not need to be read out when running the application to be executed, such as kernel files, system directories, and files in the root directory.
  • the metadata information of the virtual machine image is specifically the format information of the virtual machine image, such as the storage format, storage location, and hierarchical relationship of the information in the virtual machine image file.
  • the layer data corresponding to the read Docker container and the metadata information of the virtual machine image are saved locally.
  • a snapshot corresponding to the layer data corresponding to the Docker container is generated according to the layer data corresponding to the Docker container, and the obtained snapshot is the snapshot layer file corresponding to the Docker container.
  • the snapshot layer file corresponding to the Docker container is also a working layer file, which can be used to store files generated during the running of the Docker container.
  • the snapshot layer file corresponding to the Docker container is mounted to the working directory to perform read and write operations on the snapshot layer.
  • the block device of the virtual machine image is generated according to each layer data in the layer data corresponding to the Docker container in the virtual machine image, and the block device of the virtual machine image is mounted to the working directory of the Docker container; Specifically, it is a device type on a Linux system.
  • the system parameter is configured according to the metadata information of the virtual machine image corresponding to the read application to be executed, so that the system parameter after the configuration and the virtual machine image metadata corresponding to the application to be executed are configured.
  • the information is matched; wherein the system parameters are environment variables and related parameter information of the application to be run.
  • the snapshot layer file achieves the purpose of running the Docker container corresponding to the application to be executed, and the result obtained by running the snapshot layer file corresponding to the Docker container mounted in the working directory is the result of the virtual machine image.
  • an execution command for instructing a Docker container corresponding to the running application to be executed is received; wherein the execution command includes an identifier of the application to be executed; and the application to be executed included in the execution command is And the virtual machine image corresponding to the identifier of the application to be executed; the layer data corresponding to the Docker container and the metadata information of the virtual machine image are read out from all the layer data in the virtual machine image; wherein the layer data corresponding to the Docker container The layer data required for running the Docker container corresponding to the application to be executed; generating the snapshot layer file corresponding to the Docker container according to the layer data corresponding to the read Docker container, wherein the snapshot layer file corresponding to the Docker container includes the Docker container corresponding A snapshot of the layer data; the snapshot layer file corresponding to the Docker container is a readable and writable layer file; the snapshot layer file corresponding to the Docker container is mounted to the working directory, and the environment is based on
  • the layer data corresponding to the Docker container and the metadata information of the virtual machine image can be read out from all the layer data in the virtual machine image, and the layer data corresponding to the Docker container is used to run the corresponding application to be executed.
  • the layer data required by the Docker container, and further, the Docker container corresponding to the application to be executed can be run according to the layer data corresponding to the read Docker container and the metadata information of the virtual machine image.
  • the process is simple and fast, and avoids the method of using the manual method to convert the virtual machine image of the application to be converted into a container image in the prior art, and the developer does not need to know the whole virtual machine image corresponding to the application to be executed.
  • the deployment method of the container image is also known. It can be seen that the method provided by the embodiment of the present invention can easily and efficiently run the application built in the virtual machine on the Dcoker container, and reduces the requirements for the developer.
  • FIG. 2b is a schematic flow chart showing another Docker container running method provided by an embodiment of the present invention.
  • an embodiment of the present invention provides a Docker container running method, as shown in FIG. 2b. Show, including:
  • Step 211 Receive an execution command for instructing to run a Docker container corresponding to the application to be executed, where the execution command includes an identifier of the application to be executed.
  • Step 212 Obtain a virtual machine image corresponding to the identifier of the to-be-executed application according to the identifier of the to-be-executed application included in the execution command.
  • Step 213 Read metadata information of all layer data and virtual machine images from the virtual machine image
  • Step 214 Generate, according to all layer data read out, a snapshot layer file corresponding to all layer data; the snapshot layer file corresponding to all layer data is a readable and writable layer file;
  • Step 215 Mount the snapshot layer file corresponding to all the layer data to the first working directory
  • step 216 the layer data other than the layer data corresponding to the Docker container is deleted from the snapshot layer file corresponding to all the layer data of the first working directory; wherein the layer data corresponding to the Docker container is used to run the application to be executed.
  • Step 217 packetizing the remaining layer files in the snapshot layer file corresponding to all the layer data after the deletion operation, and the metadata information of the virtual machine image to obtain a pre-processed image;
  • Step 218 Generate metadata information of the container image according to the pre-processed image, where the metadata information of the container image includes format information of the pre-processed image;
  • step 219 the metadata information of the pre-processed image and the container image is packaged, and the container image corresponding to the identifier of the application to be executed is obtained.
  • Step 221 Run the Docker container corresponding to the application to be executed by running the container image corresponding to the identifier of the application to be executed.
  • the container image of the Docker container can be stored in the local container image storage area, or the container image of the Docker container can be uploaded to the container image repository.
  • the container mirror storage area in Figure 1 can be an area mirrored by the local storage container or a container mirrored warehouse, so that the container mirroring driver can obtain the container image from the container mirror storage area.
  • the metadata information of all the layer data and the virtual machine image can be read out from the virtual machine image, and all the layer data includes the layer data corresponding to the Docker container, and the layer data corresponding to the Docker container is used.
  • the process is simple and fast, and avoids the method of using the manual method to convert the virtual machine image of the application to be converted into a container image in the prior art, and the developer does not need to know the whole virtual machine image corresponding to the application to be executed.
  • the deployment method of the container image is also known. It can be seen that the method provided by the embodiment of the present invention can easily and efficiently run the application built in the virtual machine on the Dcoker container, and reduces the requirements for the developer.
  • the virtual machine image corresponding to the identifier of the application to be executed is generated, and the virtual machine image corresponding to the identifier of the application to be executed is stored in the virtual machine image storage area.
  • the method includes: obtaining a virtual machine image corresponding to the identifier of the to-be-executed application from the virtual machine image storage area according to the identifier of the to-be-executed application included in the execution command.
  • the virtual machine image storage area can be obtained locally or in the cloud.
  • the virtual machine image corresponding to the identifier of the application to be executed is taken from the local virtual machine image or downloaded from the cloud to the local machine.
  • a read operation is performed on the virtual machine image.
  • step 212 to step 219 the virtual machine image is converted into a container image, and then the container image is run through step 221 to achieve the purpose of running the Docker container corresponding to the application to be executed.
  • step 213 optionally, the virtual machine image driver is invoked, and the metadata information of all layer data and the virtual machine image is read out from the virtual machine image by the invoked virtual machine image driver.
  • all layer data included in the virtual machine image is virtual machine data information that is actually stored in the virtual machine image, such as an operating system, a library file, a runnable program, a configuration, and the like. All layer data included in the virtual machine image is divided into two parts, which are the layer data corresponding to the Docker container, and other layer data.
  • the layer data corresponding to the Docker container is the layer data required for running the Docker container corresponding to the application to be executed, that is, the layer data that must be read out when running the application to be executed.
  • the layer data corresponding to the Docker container includes: layer data of all the layer data in the virtual machine image except the kernel file, the system directory, and the files in the root directory.
  • the other layer data is layer data that does not need to be read out when running the application to be executed, such as kernel files, system directories, and files in the root directory.
  • the metadata information of the virtual machine image is specifically the format information of the virtual machine image, such as the storage format, storage location, and hierarchical relationship of the information in the virtual machine image file.
  • the layer data corresponding to the read Docker container and the metadata information of the virtual machine image are saved locally.
  • step 214 optionally, based on the snapshot mechanism in the virtual machine, and the virtual machine mirror driver supports creating a snapshot layer for the virtual machine image, so that the virtual machine image is superimposed with the snapshot layer.
  • the layering in the virtual machine image is similar to the layering of the container image.
  • the layering of the container image is mostly based on the layering of the file system, and the layering of the virtual machine image is generally implemented based on the storage block.
  • the Docker container in the embodiment of the present invention specifically refers to a container created in the Docker technology for the application to be executed, and is built in the virtual machine before the application is executed. Therefore, the virtual application belongs to a virtual machine in the virtual machine. Mirroring.
  • the snapshot layer file corresponding to all layer data is generated based on the snapshot mechanism in the virtual machine.
  • the snapshot layer file corresponding to all layer data is a readable and writable layer file.
  • the snapshot layer file corresponding to the layer data is mounted to the first working directory, and the first working directory is used as the root directory of the Docker container, and the snapshot layer file corresponding to the layer data is mounted at this time.
  • the root directory is the first working directory.
  • the block device of the virtual machine image is generated according to each layer data in all layer data in the virtual machine image, and the block device of the virtual machine image is mounted to the first working directory; the block device is specifically a Linux system. A type of device on the top.
  • the layer data of the layer data corresponding to the Docker container in all the layer data included in the virtual machine image is determined from the first working directory, and the snapshot layer file is readable and writable, so the snapshot layer file can be
  • the system file in the virtual machine image is deleted, for example, the layer data except the layer data corresponding to the Docker container in all the layer data included in the determined virtual machine image is deleted.
  • the layer data corresponding to the Docker container includes: layer data of all the layer data in the virtual machine image except the kernel file, the system directory, and the files in the root directory. For example, the file at the beginning of Initramfs, the file at the beginning of vmlinuz, and so on.
  • the metadata information of the container image includes: a storage format of the information in the pre-processed image, a storage location, and a hierarchical relationship between the layers of the layer data corresponding to the Docker container. Specifically, it can be the identifier of the container image, the size, the hierarchical relationship of the pre-processed image, the image identification (ID), the parent image ID, the creation time, the environment variable, the entry program, the applicable Docker version, and the Author information. Information such as architecture information (such as amd64) and OS system (such as linux).
  • the container image corresponding to the identifier of the application to be executed is stored in the container mirror storage area; the snapshot layer file corresponding to all layer data is deleted, and the uninstallation is to be performed.
  • a container image is obtained.
  • the container mirroring driver is invoked, and the metadata information of the layer data and the container image corresponding to the Docker container is read out from the container image by the invoked container mirror driver.
  • the layer data corresponding to the Docker container and the metadata information of the container image are read out from the container image; wherein the layer data corresponding to the Docker container is the layer data required for running the Docker container corresponding to the application to be executed. At this time, only the layer data existing in the container image is the layer data corresponding to the Docker container.
  • the snapshot layer file corresponding to the Docker container is generated according to the layer data corresponding to the read Docker container, wherein the snapshot layer file corresponding to the Docker container includes a snapshot of the layer data corresponding to the Docker container; the snapshot layer file corresponding to the Docker container is readable.
  • the snapshot layer file corresponding to the Docker container is generated in the Docker container.
  • the snapshot layer file corresponding to the Docker container is also a working layer file, which can be used to store files generated during the running of the Docker container.
  • the snapshot layer file corresponding to the Docker container is mounted to the second working directory, and the environment configuration is performed according to the metadata information of the read container image.
  • the block device of the container image is generated according to each layer data in the layer data corresponding to the Docker container, and the block device mirrored by the container is mounted to the second working directory; the block device is specifically a type on the Linux system. Equipment type.
  • the second working directory may be a working directory with the first working directory, or may be a different working directory.
  • the system parameter It is the environment variable and related parameter information of the application to be run.
  • the above method provided by the embodiment of the present invention can quickly and frequently convert the virtual machine image corresponding to the application to be converted into a container image, so that the Dcoker creates a container for the application to be executed, and through the container image when running the container of the application to be executed.
  • the driver directly runs the container image of the application to be executed.
  • an execution command for instructing a Docker container corresponding to the running application to be executed is received; wherein the execution command includes an identifier of the application to be executed; and according to the to-be-executed application included in the execution command Identifying a virtual machine image corresponding to the identifier of the application to be executed; reading metadata information of all layer data and virtual machine image from the virtual machine image; and generating a snapshot layer file corresponding to all layer data according to all layer data read out
  • the snapshot layer file corresponding to all layer data is a readable and writable layer file; the snapshot layer file corresponding to all layer data is mounted to the first working directory; and the snapshot corresponding to all layer data mounted to the first working directory
  • the layer data other than the layer data corresponding to the Docker container is deleted; wherein the layer data corresponding to the Docker container is the layer data required for running the Docker container corresponding to the application to be executed; all layers after the deletion operation will
  • Pre-processing image generating metadata information of the container image according to the pre-processed image; wherein the metadata information of the container image includes format information of the pre-processed image; and packaging the metadata information of the pre-processed image and the container image to obtain the to-be-executed application
  • the container image corresponding to the identifier of the application; the Docker container corresponding to the application to be executed is run by running the container image corresponding to the identifier of the application to be executed.
  • the layer data corresponding to the Docker container and the metadata information of the virtual machine image can be read out from all the layer data in the virtual machine image, and the layer data corresponding to the Docker container is used to run the corresponding application to be executed.
  • the layer data required by the Docker container, and further, the Docker container corresponding to the application to be executed can be run according to the layer data corresponding to the read Docker container and the metadata information of the virtual machine image. It can be seen that the process is simple and fast, and avoids the method of using the manual method to convert the virtual machine image of the application to be converted into a container image in the prior art, and the developer does not need to know the whole virtual machine image corresponding to the application to be executed.
  • the deployment method of the container image is also known. It can be seen that the method provided by the embodiment of the present invention can easily and efficiently run the application built in the virtual machine on the Dcoker container, and reduces the requirements for the developer.
  • FIG. 3 exemplarily shows a schematic structural diagram of a Docker container running device according to an embodiment of the present invention.
  • an embodiment of the present invention provides a Docker container running device 300, as shown in FIG.
  • the receiving unit 301, the obtaining unit 302, the processing unit 303, and the generating unit 304 are:
  • a receiving unit configured to receive an execution command for instructing to run a Docker container corresponding to the application to be executed; wherein the execution command includes an identifier of the application to be executed;
  • An obtaining unit configured to obtain a virtual machine image corresponding to the identifier of the to-be-executed application according to the identifier of the to-be-executed application included in the execution command;
  • a processing unit configured to read, from all layer data in the virtual machine image, layer data corresponding to the Docker container and metadata information of the virtual machine image; and generate a snapshot layer corresponding to the Docker container according to the layer data corresponding to the read Docker container File, mount the snapshot layer file corresponding to the Docker container to the working directory, and perform environment configuration according to the metadata information of the read virtual machine image; run the snapshot layer file corresponding to the Docker container mounted to the working directory, and run Execute the Docker container corresponding to the application;
  • the layer data corresponding to the Docker container is the layer data required for running the Docker container corresponding to the application to be executed;
  • the snapshot layer file corresponding to the Docker container includes a snapshot of the layer data corresponding to the Docker container;
  • the snapshot layer file corresponding to the Docker container is Readable and writable layer files.
  • processing unit is specifically configured to:
  • the virtual machine image driver is invoked, and the metadata information of the layer data and the virtual machine image corresponding to the Docker container is read out from all the layer data in the virtual machine image by the invoked virtual machine image driver.
  • the layer data corresponding to the Docker container includes:
  • Layer data in all layer data in the virtual machine image except kernel files, system directories, and files in the root directory.
  • processing unit is specifically configured to:
  • the system parameters are environment variables.
  • the method further includes: generating a unit, configured to:
  • the virtual machine image corresponding to the identifier of the to-be-executed application is obtained from the virtual machine image storage area according to the identifier of the to-be-executed application included in the execution command.
  • an execution command is sent to indicate that the Docker container corresponding to the application to be executed is executed.
  • the execution command includes an identifier of the application to be executed, and the application to be executed is obtained according to the identifier of the application to be executed included in the execution command.
  • the virtual machine image corresponding to the identifier; the layer data corresponding to the Docker container and the metadata information of the virtual machine image are read out from all the layer data in the virtual machine image; wherein the layer data corresponding to the Docker container is used to run the to-be-executed application
  • the layer data required by the corresponding Docker container; the snapshot layer file corresponding to the Docker container is generated according to the layer data corresponding to the read Docker container, wherein the snapshot layer file corresponding to the Docker container includes a snapshot of the layer data corresponding to the Docker container; Docker
  • the snapshot layer file corresponding to the container is a readable and writable layer file; the snapshot layer file corresponding to the Docker container is mounted to the working directory, and the environment configuration is performed according to the metadata information of the read virtual machine image;
  • the snapshot layer file corresponding to the Docker container of the working directory, and the Dock corresponding to the application to be executed is run.
  • the layer data corresponding to the Docker container and the metadata information of the virtual machine image can be read out from all the layer data in the virtual machine image, and the layer data corresponding to the Docker container is used to run the corresponding application to be executed.
  • the layer data required by the Docker container, and further, the Docker container corresponding to the application to be executed can be run according to the layer data corresponding to the read Docker container and the metadata information of the virtual machine image. It can be seen that the process is simple and fast, and avoids the method of using the manual method to convert the virtual machine image of the application to be converted into a container image in the prior art, and the developer does not need to know the whole virtual machine image corresponding to the application to be executed.
  • the deployment method of the container image is also known. It can be seen that the method provided by the embodiment of the present invention can easily and efficiently run the application built in the virtual machine on the Dcoker container, and reduces the requirements for the developer.
  • FIG. 4 is a schematic structural diagram of a running device of a Docker container according to an embodiment of the present invention.
  • an operating device 400 of a Docker container provided by an embodiment of the present invention, such as As shown in FIG. 4, the receiving unit 401, the obtaining unit 402, the converting unit 403, the processing unit 404, and the generating unit 405 are included:
  • a receiving unit configured to receive an execution command for instructing to run a Docker container corresponding to the application to be executed; wherein the execution command includes an identifier of the application to be executed;
  • An obtaining unit configured to obtain a virtual machine image corresponding to the identifier of the to-be-executed application according to the identifier of the to-be-executed application included in the execution command;
  • a conversion unit configured to read metadata information of all layer data and virtual machine images from the virtual machine image; generate snapshot layer files corresponding to all layer data according to all layer data read out; and snapshot layer files corresponding to all layer data a layer file that is readable and writable; the snapshot layer file corresponding to all the layer data is mounted to the first working directory; and the corresponding Docker container is deleted from the snapshot layer file corresponding to all the layer data of the first working directory.
  • the layer data other than the layer data; the layer file remaining in the snapshot layer file corresponding to all layer data after the deletion operation, and the metadata information of the virtual machine image are packaged to obtain a pre-process image;
  • the processing unit is configured to run a Docker container corresponding to the application to be executed by running a container image corresponding to the identifier of the application to be executed.
  • the conversion unit is specifically configured to:
  • the virtual machine image driver is invoked, and metadata information of all layer data and virtual machine images is read out from the virtual machine image through the invoked virtual machine image driver.
  • the layer data corresponding to the Docker container includes:
  • Layer data in all layer data in the virtual machine image except kernel files, system directories, and files in the root directory;
  • the metadata information of the container image includes: the storage format and storage location of the information in the pre-processed image, and the hierarchical relationship between the data of each layer in the layer data corresponding to the Docker container.
  • the conversion unit is further configured to:
  • processing unit is specifically configured to:
  • the snapshot layer file corresponding to the Docker container is generated according to the layer data corresponding to the read Docker container, wherein the snapshot layer file corresponding to the Docker container includes a snapshot of the layer data corresponding to the Docker container; the snapshot layer file corresponding to the Docker container is readable. Layer file written;
  • the snapshot layer file corresponding to the Docker container is mounted to the second working directory, and the environment configuration is performed according to the metadata information of the read container image;
  • processing unit is specifically configured to:
  • the container mirror driver is called, and the metadata information of the layer data and the container image corresponding to the Docker container is read out from the container image by the called container mirror driver.
  • processing unit is specifically configured to:
  • the system parameters are environment variables.
  • the method further includes: generating a unit, configured to:
  • the virtual machine image corresponding to the identifier of the to-be-executed application is generated, and the virtual machine image corresponding to the identifier of the application to be executed is stored in the virtual machine image storage area.
  • an execution command for instructing a Docker container corresponding to the running application to be executed is received; wherein the execution command includes an identifier of the application to be executed; and according to the to-be-executed application included in the execution command Identifying a virtual machine image corresponding to the identifier of the application to be executed; reading metadata information of all layer data and virtual machine image from the virtual machine image; and generating a snapshot layer file corresponding to all layer data according to all layer data read out
  • the snapshot layer file corresponding to all layer data is a readable and writable layer file; the snapshot layer file corresponding to all layer data is mounted to the first working directory; and the snapshot corresponding to all layer data mounted to the first working directory
  • the layer data other than the layer data corresponding to the Docker container is deleted; wherein the layer data corresponding to the Docker container is the layer data required for running the Docker container corresponding to the application to be executed; all layers after the deletion operation will
  • Pre-processing image generating metadata information of the container image according to the pre-processed image; wherein the metadata information of the container image includes format information of the pre-processed image; and packaging the metadata information of the pre-processed image and the container image to obtain the to-be-executed application
  • the container image corresponding to the identifier of the application; the Docker container corresponding to the application to be executed is run by running the container image corresponding to the identifier of the application to be executed.
  • the layer data corresponding to the Docker container and the metadata information of the virtual machine image can be read out from all the layer data in the virtual machine image, and the layer data corresponding to the Docker container is used to run the corresponding application to be executed.
  • the layer data required by the Docker container, and further, the Docker container corresponding to the application to be executed can be run according to the layer data corresponding to the read Docker container and the metadata information of the virtual machine image. It can be seen that the process is simple and fast, and avoids the method of using the manual method to convert the virtual machine image of the application to be converted into a container image in the prior art, and the developer does not need to know the whole virtual machine image corresponding to the application to be executed.
  • the deployment method of the container image is also known. It can be seen that the method provided by the embodiment of the present invention can easily and efficiently run the application built in the virtual machine on the Dcoker container, and reduces the requirements for the developer.
  • FIG. 5 exemplarily shows a schematic structural diagram of another Docker container running device according to an embodiment of the present invention.
  • an embodiment of the present invention provides another Docker container running device 530, as shown in FIG. 5, including a transceiver 510, a processor 500, and a memory 520:
  • a processor that reads a program in memory and runs the following process:
  • the processor is configured to obtain a virtual machine image corresponding to the identifier of the to-be-executed application according to the identifier of the to-be-executed application included in the execution command, and read the layer data and the virtual machine corresponding to the Docker container from all layer data in the virtual machine image.
  • Mirroring metadata information generating a snapshot layer file corresponding to the Docker container according to the layer data corresponding to the read Docker container, and mounting the snapshot layer file corresponding to the Docker container to the working directory, and according to the read virtual machine image
  • the data information is configured by the environment; the Docker container corresponding to the application to be executed is run by running the snapshot layer file corresponding to the Docker container that is mounted to the working directory;
  • the layer data corresponding to the Docker container is the layer data required for running the Docker container corresponding to the application to be executed;
  • the snapshot layer file corresponding to the Docker container includes a snapshot of the layer data corresponding to the Docker container;
  • the snapshot layer file corresponding to the Docker container is Readable and writable layer file;
  • the memory is configured to store the foregoing program, and a virtual machine image corresponding to the identifier of the application to be executed.
  • the processor is specifically configured to:
  • the virtual machine image driver is invoked, and the metadata information of the layer data and the virtual machine image corresponding to the Docker container is read out from all the layer data in the virtual machine image by the invoked virtual machine image driver.
  • the layer data corresponding to the Docker container includes:
  • Layer data in all layer data in the virtual machine image except kernel files, system directories, and files in the root directory.
  • the processor is specifically configured to:
  • the system parameters are environment variables.
  • the processor is further configured to:
  • the virtual machine image corresponding to the to-be-executed application is generated, and the virtual machine image is stored in the virtual machine image storage area.
  • the virtual machine image corresponding to the identifier of the to-be-executed application is obtained from the virtual machine image storage area according to the identifier of the to-be-executed application included in the execution command.
  • the embodiment of the present invention is configured to receive an execution command for instructing a Docker container corresponding to the application to be executed, where the execution command includes an identifier of the to-be-executed application, and obtains an execution to be executed according to the identifier of the to-be-executed application included in the execution command.
  • the virtual machine image corresponding to the identifier of the application; the layer data corresponding to the Docker container and the metadata information of the virtual machine image are read out from all the layer data in the virtual machine image; wherein the layer data corresponding to the Docker container is used for running to be executed Applying the layer data required by the corresponding Docker container; generating a snapshot layer file corresponding to the Docker container according to the layer data corresponding to the read Docker container, wherein the snapshot layer file corresponding to the Docker container includes a snapshot of the layer data corresponding to the Docker container;
  • the snapshot layer file corresponding to the Docker container is a readable and writable layer file; the snapshot layer file corresponding to the Docker container is mounted to the working directory, and the environment configuration is performed according to the metadata information of the read virtual machine image; To the snapshot layer file corresponding to the Docker container of the working directory, run the D corresponding to the application to be executed.
  • the layer data corresponding to the Docker container and the metadata information of the virtual machine image can be read out from all the layer data in the virtual machine image, and the layer data corresponding to the Docker container is used to run the corresponding application to be executed.
  • the layer data required by the Docker container, and further, the Docker container corresponding to the application to be executed can be run according to the layer data corresponding to the read Docker container and the metadata information of the virtual machine image. It can be seen that the process is simple and fast, and avoids the method of using the manual method to convert the virtual machine image of the application to be converted into a container image in the prior art, and the developer does not need to know the whole virtual machine image corresponding to the application to be executed.
  • the deployment method of the container image is also known. It can be seen that the method provided by the embodiment of the present invention can easily and efficiently run the application built in the virtual machine on the Dcoker container, and reduces the requirements for the developer.
  • FIG. 6 is a schematic structural diagram showing another running device of a Docker container according to an embodiment of the present invention.
  • FIG. 6 another Docker container running device 630 provided by the embodiment of the present invention, as shown in FIG. 6, includes a transceiver 610, a processor 600, and a memory 620:
  • a processor that reads a program in memory and runs the following process:
  • the processor is configured to obtain a virtual machine image corresponding to the identifier of the application to be executed according to the identifier of the to-be-executed application included in the execution command, and read out metadata information of all layer data and the virtual machine image from the virtual machine image; All the layer data is generated, and the snapshot layer file corresponding to all layer data is generated; the snapshot layer file corresponding to all layer data is a readable and writable layer file; and the snapshot layer file corresponding to all layer data is mounted to the first working directory; The layer data other than the layer data corresponding to the Docker container is deleted from the snapshot layer file corresponding to all the layer data of the first working directory; the remaining layer in the snapshot layer file corresponding to all layer data after the deletion operation is performed.
  • the file and the metadata information of the virtual machine image are packaged to obtain a pre-processed image; and the metadata information of the container image is generated according to the pre-processed image; wherein the metadata information of the container image includes the format information of the pre-processed image;
  • the metadata information of the image and the container image is packaged, and the container image corresponding to the identifier of the application to be executed is obtained; , Docker containers corresponding data layer for layer data corresponding to the application running Docker containers need to be performed; the container to be executed by running the mirroring application corresponding to the identifier, the application operation to be performed corresponding to Docker containers;
  • the memory is configured to store the foregoing program, and a virtual machine image and a container image corresponding to the identifier of the application to be executed.
  • the processor is specifically configured to:
  • the virtual machine image driver is invoked, and metadata information of all layer data and virtual machine images is read out from the virtual machine image through the invoked virtual machine image driver.
  • the layer data corresponding to the Docker container includes:
  • Layer data in all layer data in the virtual machine image except kernel files, system directories, and files in the root directory;
  • the metadata information of the container image includes: a storage format and a storage location of the information in the preprocessed image. And the hierarchical relationship between the data of each layer in the layer data corresponding to the Docker container.
  • the processor is further configured to:
  • the processor is specifically configured to:
  • the snapshot layer file corresponding to the Docker container is generated according to the layer data corresponding to the read Docker container, wherein the snapshot layer file corresponding to the Docker container includes a snapshot of the layer data corresponding to the Docker container; the snapshot layer file corresponding to the Docker container is readable. Layer file written;
  • the snapshot layer file corresponding to the Docker container is mounted to the second working directory, and the environment configuration is performed according to the metadata information of the read container image;
  • the processor is specifically configured to:
  • the container mirror driver is called, and the metadata information of the layer data and the container image corresponding to the Docker container is read out from the container image by the called container mirror driver.
  • the processor is specifically configured to:
  • the system parameters are environment variables.
  • the processor is further configured to:
  • the virtual machine image corresponding to the identifier of the to-be-executed application is generated, and the virtual machine image corresponding to the identifier of the application to be executed is stored in the virtual machine image storage area.
  • the virtual machine image corresponding to the identifier of the to-be-executed application is obtained from the virtual machine image storage area according to the identifier of the to-be-executed application included in the execution command.
  • an execution command for instructing a Docker container corresponding to the running application to be executed is received; wherein the execution command includes an identifier of the application to be executed; and according to the to-be-executed application included in the execution command Identifying a virtual machine image corresponding to the identifier of the application to be executed; reading metadata information of all layer data and virtual machine image from the virtual machine image; and generating a snapshot layer file corresponding to all layer data according to all layer data read out
  • the snapshot layer file corresponding to all layer data is a readable and writable layer file; the snapshot layer file corresponding to all layer data is mounted to the first working directory; and the snapshot corresponding to all layer data mounted to the first working directory
  • the layer data other than the layer data corresponding to the Docker container is deleted; wherein the layer data corresponding to the Docker container is the layer data required for running the Docker container corresponding to the application to be executed; all layers after the deletion operation will
  • Pre-processing image generating metadata information of the container image according to the pre-processed image; wherein the metadata information of the container image includes format information of the pre-processed image; and packaging the metadata information of the pre-processed image and the container image to obtain the to-be-executed application
  • the container image corresponding to the identifier of the application; the Docker container corresponding to the application to be executed is run by running the container image corresponding to the identifier of the application to be executed.
  • the layer data corresponding to the Docker container and the metadata information of the virtual machine image can be read out from all the layer data in the virtual machine image, and the layer data corresponding to the Docker container is used to run the corresponding application to be executed.
  • the layer data required by the Docker container, and further, the Docker container corresponding to the application to be executed can be run according to the layer data corresponding to the read Docker container and the metadata information of the virtual machine image. It can be seen that the process is simple and fast, and avoids the method of using the manual method to convert the virtual machine image of the application to be converted into a container image in the prior art, and the developer does not need to know the whole virtual machine image corresponding to the application to be executed.
  • the deployment method of the container image is also known. It can be seen that the method provided by the embodiment of the present invention can easily and efficiently run the application built in the virtual machine on the Dcoker container, and reduces the requirements for the developer.
  • embodiments of the present invention may be provided as a method, or computer program Order product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment, or a combination of software and hardware. Moreover, the invention can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) including computer usable program code.
  • computer-usable storage media including but not limited to disk storage, CD-ROM, optical storage, etc.
  • the computer program instructions can also be stored in a computer readable memory that can direct a computer or other programmable data processing device to operate in a particular manner, such that the instructions stored in the computer readable memory produce an article of manufacture comprising the instruction device.
  • the apparatus implements the functions specified in one or more blocks of a flow or a flow and/or block diagram of the flowchart.
  • These computer program instructions can also be loaded onto a computer or other programmable data processing device such that a series of operational steps are executed on a computer or other programmable device to produce computer-implemented processing for operation on a computer or other programmable device.
  • the instructions provide steps for implementing the functions specified in one or more of the flow or in a block or blocks of a flow diagram.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

一种Docker容器运行方法和装置,用于通过简单高效的方法在Docker容器上运行之前在虚拟机中构建的应用。其中,根据接收到的执行命令中包括的待执行应用的标识,获取待执行应用对应的虚拟机镜像,由于可从虚拟机镜像中的所有层数据中读出Docker容器对应的层数据和虚拟机镜像的元数据信息,且Docker容器对应的层数据为用于运行待执行应用对应的Docker容器所需要的层数据,进而根据该读出的Docker容器对应的层数据和虚拟机镜像的元数据信息,运行待执行应用对应的Docker容器。

Description

一种Docker容器运行方法和装置
本申请要求于2015年12月3日提交中国专利局、申请号为201510883372.8、发明名称为“一种Docker容器运行方法和装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本发明实施例涉及通信领域,尤其涉及一种Docker容器运行方法和装置。
背景技术
集装箱(Docker)是一个开源的应用容器引擎,旨在提供一种应用的自动化部署解决方案,在Linux系统上迅速创建一个容器(container),容器即为轻量级虚拟机,并部署和运行应用,并通过配置文件可以轻松实现应用的自动化安装、部署和升级,非常方便。Docker虚拟出多个容器,每个容器之间相互隔离没有接口,可以将彼此的生产环境和开发环境分开,互不影响。
目前云服务的基石是操作系统级别的隔离,在同一台宿主机上通过一个或多个虚拟机(Vitual Machine,简称VM)运行业务,而Docker实现了一种应用级别的隔离,它改变了基本的开发、操作单元,由直接操作VM转换为操作应用运行的“容器”。随着Docker容器技术在开发、测试、生产环境的逐步使用,如何在Dcoker上运行之前在虚拟机中构建的应用,是目前重点研究的一个课题。
现有技术的一种方案为:开发人员研究应用在虚拟机上的部署,具体包括该应用的部署架构、部署组件、安装配置方式、调测方式等信息,之后,开发人员依据Docker容器镜像要求,构建该应用对应的容器镜像,之后对构建完成的容器镜像进行部署和配置,并进行测试,测试成功之后将该应用的容器镜像存储至Docker的容器镜像仓库,需要运行该应用时,从容器镜像仓库调用该应 用的容器镜像并运行。
可见,上述方法在运行以前构建在虚拟机上的应用的虚拟机镜像时,需要先将根据该应用的虚拟机镜像通过人工方式转换为容器镜像。该方法中,开发人员需要研究该应用在虚拟机上的部署,并且还需要了解Docker容器镜像要求,并构建该应用的容器镜像,该过程对开发人员要求较高,且由于应用在虚拟机上的部署时间经历较长,且较为复杂,因此需要浪费开发人员的大量精力和时间。
综上,亟需一种Docker容器运行方法和装置,用于通过简单高效的方法在Dcoker容器上运行之前在虚拟机中构建的应用。
发明内容
本发明实施例提供一种Docker容器运行方法和装置,用于通过简单高效的方法在Dcoker容器上运行之前在虚拟机中构建的应用。
本发明实施例提供一种集装箱Docker容器运行方法,包括:
接收用于指示运行待执行应用对应的Docker容器的执行命令;其中,执行命令中包括待执行应用的标识;
根据执行命令中包括的待执行应用的标识,获取待执行应用的标识对应的虚拟机镜像;
从虚拟机镜像中的所有层数据中读出Docker容器对应的层数据和虚拟机镜像的元数据信息;其中,Docker容器对应的层数据为用于运行待执行应用对应的Docker容器所需要的层数据;
根据读出的Docker容器对应的层数据,生成Docker容器对应的快照层文件,其中,Docker容器对应的快照层文件包括Docker容器对应的层数据的快照;Docker容器对应的快照层文件为可读可写的层文件;
将Docker容器对应的快照层文件挂载至工作目录,并根据读出的虚拟机镜像的元数据信息进行环境配置;
通过运行挂载至工作目录的Docker容器对应的快照层文件,运行待执行应 用对应的Docker容器。
由于本发明实施例中可以从虚拟机镜像中的所有层数据中读出Docker容器对应的层数据和虚拟机镜像的元数据信息,且Docker容器对应的层数据为用于运行待执行应用对应的Docker容器所需要的层数据,进而,可根据该读出的Docker容器对应的层数据和虚拟机镜像的元数据信息,运行待执行应用对应的Docker容器。可见,该过程简便快捷,且避免了现有技术中使用人工的方式将待执行应用的虚拟机镜像转换为容器镜像的方法,也无需开发人员既要了解待执行应用对应的虚拟机镜像的整体部署,也要了解容器镜像的构建方法,可见,本发明实施例提供的方法能够简单高效的在Dcoker容器上运行之前在虚拟机中构建的应用,且降低了对开发人员的要求。
可选地,从虚拟机镜像中的所有层数据中读出Docker容器对应的层数据和虚拟机镜像的元数据信息,具体包括:
调用虚拟机镜像驱动,并通过所调用的虚拟机镜像驱动从虚拟机镜像中的所有层数据中读出Docker容器对应的层数据和虚拟机镜像的元数据信息。
具体来说,可在虚拟机镜像驱动中配置所需读取的虚拟机镜像的格式等信息,如此,可成功通过虚拟机镜像读取虚拟机镜像,如此则实现了直接读取虚拟机镜像中的Docker容器对应的层数据和虚拟机镜像的元数据信息的目的,避免了现有技术中使用人工的方式将待执行应用的虚拟机镜像转换为容器镜像的方法,也无需开发人员既要了解待执行应用对应的虚拟机镜像的整体部署,也要了解容器镜像的构建方法,可见,本发明实施例提供的方法能够简单高效的在Dcoker容器上运行之前在虚拟机中构建的应用,且降低了对开发人员的要求。
可选地,Docker容器对应的层数据包括:
虚拟机镜像中的所有层数据中除内核文件、系统目录,以及根(boot)目录下的文件之外的层数据。
由于运行待执行应用程序的Docker容器时,可以不运行内核文件、系统目录,以及根(boot)目录下的文件等文件,因此本发明实施例中在运行待执行 应用程序的Docker容器,也可不读取虚拟机镜像中的内核文件、系统目录,以及根(boot)目录下的文件等文件,如此,可减轻网络负荷,提高数据处理速度。
可选地,根据读出的虚拟机镜像的元数据信息进行环境配置,具体包括:
根据读出的待执行应用对应的虚拟机镜像的元数据信息,对系统参数进行配置,以使配置之后的系统参数与待执行应用对应的虚拟机镜像的元数据信息相匹配;
其中,系统参数为环境变量。
具体来说,在运行待执行应用之前,将系统的参数进行配置,以使配置之后的系统参数与待执行应用对应的虚拟机镜像的元数据信息相匹配,如此,可提高运行待执行应用的成功率。
可选地,根据执行命令中包括的待执行应用的标识,获取待执行应用的标识对应的虚拟机镜像之前,还包括:
基于虚拟机技术,生成待执行应用对应的虚拟机镜像,并将虚拟机镜像存储于虚拟机镜像存储区域;
根据执行命令中包括的待执行应用的标识,获取待执行应用的标识对应的虚拟机镜像,具体包括:
根据执行命令中包括的待执行应用的标识,从虚拟机镜像存储区域,获取待执行应用的标识对应的虚拟机镜像。
如此,可根据待执行应用的标识快速的确定出待执行应用的标识对应的虚拟机镜像,提高了数据处理速度。
本发明实施例提供一种集装箱Docker容器运行方法,包括:
接收用于指示运行待执行应用对应的Docker容器的执行命令;其中,执行命令中包括待执行应用的标识;
根据执行命令中包括的待执行应用的标识,获取待执行应用的标识对应的虚拟机镜像;
从虚拟机镜像中读出所有层数据和虚拟机镜像的元数据信息;
根据读出的所有层数据,生成所有层数据对应的快照层文件;所有层数据对应的快照层文件为可读可写的层文件;
将所有层数据对应的快照层文件挂载至第一工作目录;
从挂载至第一工作目录的所有层数据对应的快照层文件中,删除Docker容器对应的层数据之外的层数据;其中,Docker容器对应的层数据为用于运行待执行应用对应的Docker容器所需要的层数据;
将进行删除操作之后的所有层数据对应的快照层文件中剩余的层文件,以及虚拟机镜像的元数据信息进行打包,得到预处理镜像;
根据预处理镜像,生成容器镜像的元数据信息;其中,容器镜像的元数据信息包括预处理镜像的格式信息;
将预处理镜像和容器镜像的元数据信息打包,得到待执行应用的标识对应的容器镜像;
通过运行待执行应用的标识对应的容器镜像,运行待执行应用对应的Docker容器。
由于本发明实施例中可以从虚拟机镜像中的所有层数据中读出Docker容器对应的层数据和虚拟机镜像的元数据信息,且Docker容器对应的层数据为用于运行待执行应用对应的Docker容器所需要的层数据,进而,可根据该读出的Docker容器对应的层数据和虚拟机镜像的元数据信息,运行待执行应用对应的Docker容器。可见,该过程简便快捷,且避免了现有技术中使用人工的方式将待执行应用的虚拟机镜像转换为容器镜像的方法,也无需开发人员既要了解待执行应用对应的虚拟机镜像的整体部署,也要了解容器镜像的构建方法,可见,本发明实施例提供的方法能够简单高效的在Dcoker容器上运行之前在虚拟机中构建的应用,且降低了对开发人员的要求。
可选地,从虚拟机镜像中读出所有层数据和虚拟机镜像的元数据信息,具体包括:
调用虚拟机镜像驱动,并通过所调用的虚拟机镜像驱动从虚拟机镜像中读出所有层数据和虚拟机镜像的元数据信息。
具体来说,可在虚拟机镜像驱动中配置所需读取的虚拟机镜像的格式等信息,如此,可成功通过虚拟机镜像读取虚拟机镜像。
可选地,Docker容器对应的层数据包括:
虚拟机镜像中的所有层数据中除内核文件、系统目录,以及根(boot)目录下的文件之外的层数据;
容器镜像的元数据信息包括:预处理镜像中信息的存放格式、存放位置,以及Docker容器对应的层数据中各个层数据之间的层次关系。
由于运行待执行应用程序的Docker容器时,可以不运行内核文件、系统目录,以及根(boot)目录下的文件等文件,因此本发明实施例中将内核文件、系统目录,以及根(boot)目录下的文件等文件从所有层数据对应的快照层文件中删除,如此,新生成的容器镜像中就不包括内核文件、系统目录,以及根(boot)目录下的文件等文件,运行容器镜像时,也就可以不读取内核文件、系统目录,以及根(boot)目录下的文件等文件,如此,可减轻网络负荷,提高数据处理速度。
可选地,将预处理镜像和容器镜像的元数据信息打包,得到待执行应用的标识对应的容器镜像之后,还包括:
将待执行应用的标识对应的容器镜像存储于容器镜像存储区域;
删除所有层数据对应的快照层文件,卸载待执行应用的标识对应的虚拟机镜像。如此,可减少资源占用,减小系统负荷。
可选地,运行待执行应用的标识对应的容器镜像,具体包括:
从容器镜像中读出Docker容器对应的层数据和容器镜像的元数据信息;其中,Docker容器对应的层数据为用于运行待执行应用对应的Docker容器所需要的层数据;
根据读出的Docker容器对应的层数据,生成Docker容器对应的快照层文件,其中,Docker容器对应的快照层文件包括Docker容器对应的层数据的快照;Docker容器对应的快照层文件为可读可写的层文件;
将Docker容器对应的快照层文件挂载至第二工作目录,并根据读出的容器 镜像的元数据信息进行环境配置;
通过运行挂载至第二工作目录的快照层文件,运行待执行应用对应的Docker容器。
如此,可通过读取容器镜像,运行待执行应用对应的Docker容器。且避免了现有技术中使用人工的方式将待执行应用的虚拟机镜像转换为容器镜像的方法,也无需开发人员既要了解待执行应用对应的虚拟机镜像的整体部署,也要了解容器镜像的构建方法,可见,本发明实施例提供的方法能够简单高效的在Dcoker容器上运行之前在虚拟机中构建的应用,且降低了对开发人员的要求。
可选地,从容器镜像中读出Docker容器对应的层数据和容器镜像的元数据信息,具体包括:
调用容器镜像驱动,并通过所调用的容器镜像驱动从容器镜像中读出Docker容器对应的层数据和容器镜像的元数据信息。
具体来说,可在容器镜像驱动中配置所需读取的容器镜像的格式等信息,如此,可成功通过容器镜像读取容器镜像。
可选地,根据读出的容器镜像中的元数据信息进行环境配置,具体包括:
根据读出的待执行应用对应的容器镜像中的元数据信息,对系统参数进行配置,以使配置之后的系统参数与待执行应用对应的容器镜像中的元数据信息相匹配;
其中,系统参数为环境变量。
具体来说,在运行待执行应用之前,将系统的参数进行配置,以使配置之后的系统参数与待执行应用对应的虚拟机镜像的元数据信息相匹配,如此,可提高运行待执行应用的成功率。
可选地,根据执行命令中包括的待执行应用的标识,获取待执行应用的标识对应的虚拟机镜像之前,还包括:
基于虚拟机技术,生成待执行应用的标识对应的虚拟机镜像,并将待执行应用的标识对应的虚拟机镜像存储于虚拟机镜像存储区域;
根据执行命令中包括的待执行应用的标识,获取待执行应用的标识对应的 虚拟机镜像,具体包括:
根据执行命令中包括的待执行应用的标识,从虚拟机镜像存储区域,获取待执行应用的标识对应的虚拟机镜像。
如此,可根据待执行应用的标识快速的确定出待执行应用的标识对应的虚拟机镜像,提高了数据处理速度。
本发明实施例提供一种集装箱Docker容器运行装置,包括:
接收单元,用于接收用于指示运行待执行应用对应的Docker容器的执行命令;其中,执行命令中包括待执行应用的标识;
获取单元,用于根据执行命令中包括的待执行应用的标识,获取待执行应用的标识对应的虚拟机镜像;
处理单元,用于从虚拟机镜像中的所有层数据中读出Docker容器对应的层数据和虚拟机镜像的元数据信息;根据读出的Docker容器对应的层数据,生成Docker容器对应的快照层文件,将Docker容器对应的快照层文件挂载至工作目录,并根据读出的虚拟机镜像的元数据信息进行环境配置;通过运行挂载至工作目录的Docker容器对应的快照层文件,运行待执行应用对应的Docker容器;
其中,Docker容器对应的层数据为用于运行待执行应用对应的Docker容器所需要的层数据;Docker容器对应的快照层文件包括Docker容器对应的层数据的快照;Docker容器对应的快照层文件为可读可写的层文件。
可选地,处理单元,具体用于:
调用虚拟机镜像驱动,并通过所调用的虚拟机镜像驱动从虚拟机镜像中的所有层数据中读出Docker容器对应的层数据和虚拟机镜像的元数据信息。
可选地,Docker容器对应的层数据包括:
虚拟机镜像中的所有层数据中除内核文件、系统目录,以及根(boot)目录下的文件之外的层数据。
可选地,处理单元,具体用于:
根据读出的待执行应用对应的虚拟机镜像的元数据信息,对系统参数进行 配置,以使配置之后的系统参数与待执行应用对应的虚拟机镜像的元数据信息相匹配;
其中,系统参数为环境变量。
可选地,还包括,生成单元,用于:
基于虚拟机技术,生成待执行应用对应的虚拟机镜像,并将虚拟机镜像存储于虚拟机镜像存储区域;
获取单元,具体用于:
根据执行命令中包括的待执行应用的标识,从虚拟机镜像存储区域,获取待执行应用的标识对应的虚拟机镜像。
本发明实施例提供一种集装箱Docker容器运行装置,包括:
接收单元,用于接收用于指示运行待执行应用对应的Docker容器的执行命令;其中,执行命令中包括待执行应用的标识;
获取单元,用于根据执行命令中包括的待执行应用的标识,获取待执行应用的标识对应的虚拟机镜像;
转换单元,用于从虚拟机镜像中读出所有层数据和虚拟机镜像的元数据信息;根据读出的所有层数据,生成所有层数据对应的快照层文件;所有层数据对应的快照层文件为可读可写的层文件;将所有层数据对应的快照层文件挂载至第一工作目录;从挂载至第一工作目录的所有层数据对应的快照层文件中,删除Docker容器对应的层数据之外的层数据;将进行删除操作之后的所有层数据对应的快照层文件中剩余的层文件,以及虚拟机镜像的元数据信息进行打包,得到预处理镜像;根据预处理镜像,生成容器镜像的元数据信息;其中,容器镜像的元数据信息包括预处理镜像的格式信息;将预处理镜像和容器镜像的元数据信息打包,得到待执行应用的标识对应的容器镜像;其中,Docker容器对应的层数据为用于运行待执行应用对应的Docker容器所需要的层数据;
处理单元,用于通过运行待执行应用的标识对应的容器镜像,运行待执行应用对应的Docker容器。
可选地,转换单元,具体用于:
调用虚拟机镜像驱动,并通过所调用的虚拟机镜像驱动从虚拟机镜像中读出所有层数据和虚拟机镜像的元数据信息。
可选地,Docker容器对应的层数据包括:
虚拟机镜像中的所有层数据中除内核文件、系统目录,以及根(boot)目录下的文件之外的层数据;
容器镜像的元数据信息包括:预处理镜像中信息的存放格式、存放位置,以及Docker容器对应的层数据中各个层数据之间的层次关系。
可选地,转换单元,还用于:
将待执行应用的标识对应的容器镜像存储于容器镜像存储区域;
删除所有层数据对应的快照层文件,卸载待执行应用的标识对应的虚拟机镜像。
可选地,处理单元,具体用于:
从容器镜像中读出Docker容器对应的层数据和容器镜像的元数据信息;其中,Docker容器对应的层数据为用于运行待执行应用对应的Docker容器所需要的层数据;
根据读出的Docker容器对应的层数据,生成Docker容器对应的快照层文件,其中,Docker容器对应的快照层文件包括Docker容器对应的层数据的快照;Docker容器对应的快照层文件为可读可写的层文件;
将Docker容器对应的快照层文件挂载至第二工作目录,并根据读出的容器镜像的元数据信息进行环境配置;
通过运行挂载至第二工作目录的快照层文件,运行待执行应用对应的Docker容器。
可选地,处理单元,具体用于:
调用容器镜像驱动,并通过所调用的容器镜像驱动从容器镜像中读出Docker容器对应的层数据和容器镜像的元数据信息。
可选地,处理单元,具体用于:
根据读出的待执行应用对应的容器镜像中的元数据信息,对系统参数进行 配置,以使配置之后的系统参数与待执行应用对应的容器镜像中的元数据信息相匹配;
其中,系统参数为环境变量。
可选地,还包括,生成单元,用于:
基于虚拟机技术,生成待执行应用的标识对应的虚拟机镜像,并将待执行应用的标识对应的虚拟机镜像存储于虚拟机镜像存储区域;
获取单元,具体用于:
根据执行命令中包括的待执行应用的标识,从虚拟机镜像存储区域,获取待执行应用的标识对应的虚拟机镜像。
本发明实施例提供一种集装箱Docker容器运行装置,包括:
收发器,用于接收用于指示运行待执行应用对应的Docker容器的执行命令;其中,执行命令中包括待执行应用的标识;
存储器,用于存储待执行应用的标识对应的虚拟机镜像;
处理器,用于根据执行命令中包括的待执行应用的标识,获取待执行应用的标识对应的虚拟机镜像;从虚拟机镜像中的所有层数据中读出Docker容器对应的层数据和虚拟机镜像的元数据信息;根据读出的Docker容器对应的层数据,生成Docker容器对应的快照层文件,将Docker容器对应的快照层文件挂载至工作目录,并根据读出的虚拟机镜像的元数据信息进行环境配置;通过运行挂载至工作目录的Docker容器对应的快照层文件,运行待执行应用对应的Docker容器;
其中,Docker容器对应的层数据为用于运行待执行应用对应的Docker容器所需要的层数据;Docker容器对应的快照层文件包括Docker容器对应的层数据的快照;Docker容器对应的快照层文件为可读可写的层文件。
可选地,处理器,具体用于:
调用虚拟机镜像驱动,并通过所调用的虚拟机镜像驱动从虚拟机镜像中的所有层数据中读出Docker容器对应的层数据和虚拟机镜像的元数据信息。
可选地,Docker容器对应的层数据包括:
虚拟机镜像中的所有层数据中除内核文件、系统目录,以及根(boot)目录下的文件之外的层数据。
可选地,处理器,具体用于:
根据读出的待执行应用对应的虚拟机镜像的元数据信息,对系统参数进行配置,以使配置之后的系统参数与待执行应用对应的虚拟机镜像的元数据信息相匹配;
其中,系统参数为环境变量。
可选地,处理器,还用于:
基于虚拟机技术,生成待执行应用对应的虚拟机镜像,并将虚拟机镜像存储于虚拟机镜像存储区域;
根据执行命令中包括的待执行应用的标识,从虚拟机镜像存储区域,获取待执行应用的标识对应的虚拟机镜像。
本发明实施例提供一种集装箱Docker容器运行装置,包括:
收发器,用于接收用于指示运行待执行应用对应的Docker容器的执行命令;其中,执行命令中包括待执行应用的标识;
存储器,用于存储待执行应用的标识对应的虚拟机镜像;
处理器,用于根据执行命令中包括的待执行应用的标识,获取待执行应用的标识对应的虚拟机镜像;从虚拟机镜像中读出所有层数据和虚拟机镜像的元数据信息;根据读出的所有层数据,生成所有层数据对应的快照层文件;所有层数据对应的快照层文件为可读可写的层文件;将所有层数据对应的快照层文件挂载至第一工作目录;从挂载至第一工作目录的所有层数据对应的快照层文件中,删除Docker容器对应的层数据之外的层数据;将进行删除操作之后的所有层数据对应的快照层文件中剩余的层文件,以及虚拟机镜像的元数据信息进行打包,得到预处理镜像;根据预处理镜像,生成容器镜像的元数据信息;其中,容器镜像的元数据信息包括预处理镜像的格式信息;将预处理镜像和容器镜像的元数据信息打包,得到待执行应用的标识对应的容器镜像;其中,Docker容器对应的层数据为用于运行待执行应用对应的Docker容器所需要的层数据; 通过运行待执行应用的标识对应的容器镜像,运行待执行应用对应的Docker容器。
可选地,处理器,具体用于:
调用虚拟机镜像驱动,并通过所调用的虚拟机镜像驱动从虚拟机镜像中读出所有层数据和虚拟机镜像的元数据信息。
可选地,Docker容器对应的层数据包括:
虚拟机镜像中的所有层数据中除内核文件、系统目录,以及根(boot)目录下的文件之外的层数据;
容器镜像的元数据信息包括:预处理镜像中信息的存放格式、存放位置,以及Docker容器对应的层数据中各个层数据之间的层次关系。
可选地,处理器,还用于:
将待执行应用的标识对应的容器镜像存储于容器镜像存储区域;
删除所有层数据对应的快照层文件,卸载待执行应用的标识对应的虚拟机镜像。
可选地,处理器,具体用于:
从容器镜像中读出Docker容器对应的层数据和容器镜像的元数据信息;其中,Docker容器对应的层数据为用于运行待执行应用对应的Docker容器所需要的层数据;
根据读出的Docker容器对应的层数据,生成Docker容器对应的快照层文件,其中,Docker容器对应的快照层文件包括Docker容器对应的层数据的快照;Docker容器对应的快照层文件为可读可写的层文件;
将Docker容器对应的快照层文件挂载至第二工作目录,并根据读出的容器镜像的元数据信息进行环境配置;
通过运行挂载至第二工作目录的快照层文件,运行待执行应用对应的Docker容器。
可选地,处理器,具体用于:
调用容器镜像驱动,并通过所调用的容器镜像驱动从容器镜像中读出 Docker容器对应的层数据和容器镜像的元数据信息。
可选地,处理器,具体用于:
根据读出的待执行应用对应的容器镜像中的元数据信息,对系统参数进行配置,以使配置之后的系统参数与待执行应用对应的容器镜像中的元数据信息相匹配;
其中,系统参数为环境变量。
可选地,处理器,还用于:
基于虚拟机技术,生成待执行应用的标识对应的虚拟机镜像,并将待执行应用的标识对应的虚拟机镜像存储于虚拟机镜像存储区域;
根据执行命令中包括的待执行应用的标识,从虚拟机镜像存储区域,获取待执行应用的标识对应的虚拟机镜像。
本发明实施例中,接收用于指示运行待执行应用对应的Docker容器的执行命令;其中,执行命令中包括待执行应用的标识;根据执行命令中包括的待执行应用的标识,获取待执行应用的标识对应的虚拟机镜像;从虚拟机镜像中的所有层数据中读出Docker容器对应的层数据和虚拟机镜像的元数据信息;其中,Docker容器对应的层数据为用于运行待执行应用对应的Docker容器所需要的层数据;根据读出的Docker容器对应的层数据,生成Docker容器对应的快照层文件,其中,Docker容器对应的快照层文件包括Docker容器对应的层数据的快照;Docker容器对应的快照层文件为可读可写的层文件;将Docker容器对应的快照层文件挂载至工作目录,并根据读出的虚拟机镜像的元数据信息进行环境配置;通过运行挂载至工作目录的Docker容器对应的快照层文件,运行待执行应用对应的Docker容器。由于本发明实施例中可以从虚拟机镜像中的所有层数据中读出Docker容器对应的层数据和虚拟机镜像的元数据信息,且Docker容器对应的层数据为用于运行待执行应用对应的Docker容器所需要的层数据,进而,可根据该读出的Docker容器对应的层数据和虚拟机镜像的元数据信息,运行待执行应用对应的Docker容器。可见,该过程简便快捷,且避免了现有技术中使用人工的方式将待执行应用的虚拟机镜像转换为容器镜像的方 法,也无需开发人员既要了解待执行应用对应的虚拟机镜像的整体部署,也要了解容器镜像的构建方法,可见,本发明实施例提供的方法能够简单高效的在Dcoker容器上运行之前在虚拟机中构建的应用,且降低了对开发人员的要求。
附图说明
为了更清楚地说明本发明实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简要介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域的普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1为本发明实施例提供的一种Docker容器运行适用的系统架构示意图;
图2a为本发明实施例提供一种Docker容器运行方法的流程示意图;
图2b为本发明实施例提供的一种Docker容器运行方法的流程示意图;
图3为本发明实施例提供一种Docker容器运行装置的结构示意图;
图4为本发明实施例提供的另一种Docker容器运行装置的结构示意图;
图5为本发明实施例提供另一种Docker容器运行装置的结构示意图;
图6为本发明实施例提供的另一种Docker容器运行装置的结构示意图。
具体实施方式
为了使本发明的目的、技术方案及有益效果更加清楚明白,以下结合附图及实施例,对本发明进行进一步详细说明。应当理解,此处所描述的具体实施例仅仅用以解释本发明,并不用于限定本发明。
图1示例性示出了本发明实施例提供的一种Docker容器运行方法适用的系统架构示意图,如图1所示,包括Docker客户端1100、Docker容器运行装置1101。可选地,还包括虚拟机镜像驱动1102和容器镜像驱动1103,以及用于存储虚拟机镜像的虚拟机镜像存储区域1106,和用于存储容器镜像的容器镜像存储区域1104。Docker客户端1100用于向Docker容器运行装置1101发送用于指示运行待运行应用的Docker容器的运行命令,并接收Docker容器运行装 置1101返回的虚拟机镜像的运行结果或容器镜像的运行结果。
Docker容器运行装置1101用于接收Docker客户端1100发送的用于指示运行Docker容器的运行命令,并根据该运行命令,驱动虚拟机镜像驱动运行虚拟机镜像,Docker容器运行装置1101接收虚拟机镜像返回的虚拟机镜像的运行结果。或者将虚拟机镜像转换为容器镜像,之后通过驱动容器镜像驱动运行容器镜像,容器镜像驱动返回的容器镜像的运行结果。容器镜像驱动1103用于运行容器镜像,虚拟机镜像驱动1102用于运行虚拟机镜像。虚拟机镜像驱动1102支持识别虚拟机镜像、支持虚拟机镜像分层,以及支持虚拟机镜像中的元数据的维护。
可选地,本发明实施例适用的系统架构还包括一个基于Docker的镜像转换装置1105,基于Docker的镜像转换装置1105用于将虚拟机镜像转换为容器镜像,并将容器镜像存储于容器镜像存储区域1104中。容器镜像驱动1103从容器镜像存储区域1104中获取容器镜像。具体来说,虚拟机镜像驱动从虚拟机镜像存储区域获取待执行应用对应的虚拟机镜像之后,读出该虚拟机镜像,并通过基于Docker的镜像转换装置1105将读出的该虚拟机镜像转换为容器镜像,并将容器镜像存储于容器镜像存储区域1104中。
本发明实施例中,待执行应用为一个常规的应用程序,在上述步骤201之前,基于虚拟机技术,待执行应用已经在虚拟机中构建成功了虚拟机镜像。随着Docker容器技术的发展,现在需要将以前构建在虚拟机中的待执行应用运行在Docker容器中,本发明实施例中针对该类待执行应用,特提供如下实施例。
图2a示例性示出了本发明实施例提供一种Docker容器运行方法的流程示意图。
基于上述内容,本发明实施例提供一种Docker容器运行方法,如图2a所示,包括:
步骤201,接收用于指示运行待执行应用对应的Docker容器的执行命令;其中,执行命令中包括待执行应用的标识;
步骤202,根据执行命令中包括的待执行应用的标识,获取待执行应用的标识对应的虚拟机镜像;可选地,可从虚拟机镜像存储区域获取待执行应用的标识对应的虚拟机镜像,之后再通过步骤203,对该虚拟机镜像执行读的动作;
步骤203,从虚拟机镜像中的所有层数据中读出Docker容器对应的层数据和虚拟机镜像的元数据信息;其中,Docker容器对应的层数据为用于运行待执行应用对应的Docker容器所需要的层数据;
步骤204,根据读出的Docker容器对应的层数据,生成Docker容器对应的快照层文件,其中,Docker容器对应的快照层文件包括Docker容器对应的层数据的快照;Docker容器对应的快照层文件为可读可写的层文件;
步骤205,将Docker容器对应的快照层文件挂载至工作目录,并根据读出的虚拟机镜像的元数据信息进行环境配置;
步骤206,通过运行挂载至工作目录的Docker容器对应的快照层文件,运行待执行应用对应的Docker容器。
本发明实施例中上述步骤201至步骤206所提供的方法为直接运行Docker容器对应的虚拟机镜像,该两种方案均简单高效的实现了在Dcoker上运行之前在虚拟机中构建的应用的目的,且避免了现有技术中通过人工的方式构建之前运行在虚拟机中的应用对应的容器镜像的过程,降低了对开发人员的要求。
上述步骤201之前,可选地,基于虚拟机技术,生成待执行应用对应的虚拟机镜像,并将虚拟机镜像存储于虚拟机镜像存储区域。如此,上述步骤202,具体包括:根据执行命令中包括的待执行应用的标识,从虚拟机镜像存储区域,获取待执行应用的标识对应的虚拟机镜像。该虚拟机镜像存储区域可在本地,也可在云端,获取待执行应用的标识对应的虚拟机镜像具体是指从本地将虚拟机镜像取出,或者从云端将虚拟机镜像下载至本地。之后通过步骤203,对该虚拟机镜像执行读的动作。
上述步骤203中,可选地,调用虚拟机镜像驱动,并通过所调用的虚拟机镜像驱动从虚拟机镜像中的所有层数据中读出Docker容器对应的层数据和虚拟机镜像的元数据信息。本发明实施例中虚拟机镜像驱动可以根据虚拟机镜像 的格式成功读取虚拟机镜像。
具体来说,虚拟机镜像中包括的所有层数据为虚拟机镜像中真正存储的虚拟机数据信息,比如操作系统、库文件、可运行程序、配置等。虚拟机镜像中包括的所有层数据具体分为两个部分,分别为Docker容器对应的层数据,以及其它层数据。Docker容器对应的层数据为用于运行待执行应用对应的Docker容器所需要的层数据,也就是运行待执行应用所必须需要读出的层数据。可选地,Docker容器对应的层数据包括:虚拟机镜像中的所有层数据中除内核文件、系统目录,以及根(boot)目录下的文件之外的层数据。其它层数据是运行待执行应用不需要必须读出的层数据,比如,内核文件、系统目录,以及根(boot)目录下的文件。
具体来说,虚拟机镜像的元数据信息具体为虚拟机镜像的格式信息,比如记录虚拟机镜像文件中信息的存放格式、存放位置、层次关系等信息。优选地,将读出的Docker容器对应的层数据和虚拟机镜像的元数据信息保存在本地。
上述步骤204中,具体来说,基于虚拟机中的快照机制,根据Docker容器对应的层数据,生成Docker容器对应的层数据对应的快照,得到的快照即为Docker容器对应的快照层文件。该Docker容器对应的快照层文件也为一个工作层文件,可用于存储Docker容器运行过程中产生的文件。
上述步骤205,具体来说,将Docker容器对应的快照层文件挂载至工作目录,以便对该快照层进行读和写的操作。具体来说,根据虚拟机镜像中的Docker容器对应的层数据中的各个层数据,生成该虚拟机镜像的块设备,将该虚拟机镜像的块设备挂载到Docker容器的工作目录;块设备具体为Linux系统上的一种设备类型。
上述步骤205,可选地,根据读出的待执行应用对应的虚拟机镜像的元数据信息,对系统参数进行配置,以使配置之后的系统参数与待执行应用对应的虚拟机镜像的元数据信息相匹配;其中,系统参数为环境变量、待运行应用的相关参数信息。
可选地,通过上述步骤206中的运行挂载至工作目录的Docker容器对应的 快照层文件,达到了运行待执行应用对应的Docker容器的目的,运行挂载至工作目录的Docker容器对应的快照层文件所得到的结果即为虚拟机镜像的运行结果。
从上述内容可看出,本发明实施例中,接收用于指示运行待执行应用对应的Docker容器的执行命令;其中,执行命令中包括待执行应用的标识;根据执行命令中包括的待执行应用的标识,获取待执行应用的标识对应的虚拟机镜像;从虚拟机镜像中的所有层数据中读出Docker容器对应的层数据和虚拟机镜像的元数据信息;其中,Docker容器对应的层数据为用于运行待执行应用对应的Docker容器所需要的层数据;根据读出的Docker容器对应的层数据,生成Docker容器对应的快照层文件,其中,Docker容器对应的快照层文件包括Docker容器对应的层数据的快照;Docker容器对应的快照层文件为可读可写的层文件;将Docker容器对应的快照层文件挂载至工作目录,并根据读出的虚拟机镜像的元数据信息进行环境配置;通过运行挂载至工作目录的Docker容器对应的快照层文件,运行待执行应用对应的Docker容器。由于本发明实施例中可以从虚拟机镜像中的所有层数据中读出Docker容器对应的层数据和虚拟机镜像的元数据信息,且Docker容器对应的层数据为用于运行待执行应用对应的Docker容器所需要的层数据,进而,可根据该读出的Docker容器对应的层数据和虚拟机镜像的元数据信息,运行待执行应用对应的Docker容器。可见,该过程简便快捷,且避免了现有技术中使用人工的方式将待执行应用的虚拟机镜像转换为容器镜像的方法,也无需开发人员既要了解待执行应用对应的虚拟机镜像的整体部署,也要了解容器镜像的构建方法,可见,本发明实施例提供的方法能够简单高效的在Dcoker容器上运行之前在虚拟机中构建的应用,且降低了对开发人员的要求。
图2b示例性示出了本发明实施例提供的另一种Docker容器运行方法的流程示意图。
基于相同构思,本发明实施例提供一种Docker容器运行方法,如图2b所 示,包括:
步骤211,接收用于指示运行待执行应用对应的Docker容器的执行命令;其中,执行命令中包括待执行应用的标识;
步骤212,根据执行命令中包括的待执行应用的标识,获取待执行应用的标识对应的虚拟机镜像;
步骤213,从虚拟机镜像中读出所有层数据和虚拟机镜像的元数据信息;
步骤214,根据读出的所有层数据,生成所有层数据对应的快照层文件;所有层数据对应的快照层文件为可读可写的层文件;
步骤215,将所有层数据对应的快照层文件挂载至第一工作目录;
步骤216,从挂载至第一工作目录的所有层数据对应的快照层文件中,删除Docker容器对应的层数据之外的层数据;其中,Docker容器对应的层数据为用于运行待执行应用对应的Docker容器所需要的层数据;
步骤217,将进行删除操作之后的所有层数据对应的快照层文件中剩余的层文件,以及虚拟机镜像的元数据信息进行打包,得到预处理镜像;
步骤218,根据预处理镜像,生成容器镜像的元数据信息;其中,容器镜像的元数据信息包括预处理镜像的格式信息;
步骤219,将预处理镜像和容器镜像的元数据信息打包,得到待执行应用的标识对应的容器镜像;
步骤221,通过运行待执行应用的标识对应的容器镜像,运行待执行应用对应的Docker容器。具体来说,可将Docker容器的容器镜像存储于本地容器镜像存储区域,也可将Docker容器的容器镜像上传至容器镜像仓库。图1中的容器镜像存储区域即可为本地存储容器镜像的区域,也可为容器镜像仓库,以使容器镜像驱动可以从该容器镜像存储区域中获取容器镜像。
可见,由于本发明实施例中可以从虚拟机镜像中读出所有层数据和虚拟机镜像的元数据信息,且所有层数据中包括Docker容器对应的层数据,且Docker容器对应的层数据为用于运行待执行应用对应的Docker容器所需要的层数据,进而,可根据该读出的Docker容器对应的层数据和虚拟机镜像的元数据信息, 运行待执行应用对应的Docker容器。可见,该过程简便快捷,且避免了现有技术中使用人工的方式将待执行应用的虚拟机镜像转换为容器镜像的方法,也无需开发人员既要了解待执行应用对应的虚拟机镜像的整体部署,也要了解容器镜像的构建方法,可见,本发明实施例提供的方法能够简单高效的在Dcoker容器上运行之前在虚拟机中构建的应用,且降低了对开发人员的要求。
上述步骤211之前,可选地,基于虚拟机技术,生成待执行应用的标识对应的虚拟机镜像,并将待执行应用的标识对应的虚拟机镜像存储于虚拟机镜像存储区域;之后,上述步骤212,具体包括:根据执行命令中包括的待执行应用的标识,从虚拟机镜像存储区域,获取待执行应用的标识对应的虚拟机镜像。该虚拟机镜像存储区域可在本地,也可在云端,获取待执行应用的标识对应的虚拟机镜像具体是指从本地将虚拟机镜像取出,或者从云端将虚拟机镜像下载至本地。之后通过步骤203,对该虚拟机镜像执行读的动作。
上述步骤212至步骤219,将虚拟机镜像转换为容器镜像,之后通过步骤221运行容器镜像,达到运行待执行应用对应的Docker容器的目的。
上述步骤213中,可选地,调用虚拟机镜像驱动,并通过所调用的虚拟机镜像驱动从虚拟机镜像中读出所有层数据和虚拟机镜像的元数据信息。
具体来说,虚拟机镜像中包括的所有层数据为虚拟机镜像中真正存储的虚拟机数据信息,比如操作系统、库文件、可运行程序、配置等。虚拟机镜像中包括的所有层数据具体分为两个部分,分别为Docker容器对应的层数据,以及其它层数据。Docker容器对应的层数据为用于运行待执行应用对应的Docker容器所需要的层数据,也就是运行待执行应用所必须需要读出的层数据。可选地,Docker容器对应的层数据包括:虚拟机镜像中的所有层数据中除内核文件、系统目录,以及根(boot)目录下的文件之外的层数据。其它层数据是运行待执行应用不需要必须读出的层数据,比如,内核文件、系统目录,以及根(boot)目录下的文件。
具体来说,虚拟机镜像的元数据信息具体为虚拟机镜像的格式信息,比如记录虚拟机镜像文件中信息的存放格式、存放位置、层次关系等信息。优选地, 将读出的Docker容器对应的层数据和虚拟机镜像的元数据信息保存在本地。
上述步骤214中,可选地,基于虚拟机中的快照机制,且虚拟机镜像驱动支持为虚拟机镜像创建快照层,以便使虚拟机镜像与快照层进行叠加。虚拟机镜像中的分层与容器镜像的分层类似,容器镜像的分层,多是基于文件系统的分层,而虚拟机镜像的分层,一般基于存储块来实现。
具体来说,本发明实施例中Docker容器具体是指Docker技术中为待执行应用所创建的容器,待执行应用之前构建在虚拟机中,因此,待执行应用在虚拟机中对应存在一个虚拟机镜像。基于虚拟机中的快照机制,生成所有层数据对应的快照层文件。所有层数据对应的快照层文件为可读可写的层文件。
上述步骤215中,可选地,将层数据对应的快照层文件挂载至第一工作目录,第一工作目录即作为该Docker容器的根目录,此时层数据对应的快照层文件挂载的根目录即为第一工作目录。具体来说,根据虚拟机镜像中的所有层数据中的各个层数据,生成该虚拟机镜像的块设备,将该虚拟机镜像的块设备挂载到第一工作目录;块设备具体为Linux系统上的一种设备类型。
上述步骤216中,从第一工作目录中确定出虚拟机镜像包括的所有层数据中除Docker容器对应的层数据之外的层数据,由于快照层文件可读可写,因此可在快照层文件中删除虚拟机镜像中的系统文件,比如,删除确定出的虚拟机镜像包括的所有层数据中除Docker容器对应的层数据之外的层数据。具体来说,Docker容器对应的层数据包括:虚拟机镜像中的所有层数据中除内核文件、系统目录,以及根(boot)目录下的文件之外的层数据。比如Initramfs开头的文件,vmlinuz开头的文件等。
上述步骤218中,容器镜像的元数据信息包括:预处理镜像中信息的存放格式、存放位置,以及Docker容器对应的层数据中各个层数据之间的层次关系。具体可为容器镜像的标识、大小、预处理镜像的层次关系、镜像标识(Identification,简称ID)、父镜像ID、创建时间、环境变量、入口程序、适用的Docker版本、创建者(Author)信息、架构信息(如amd64)、OS系统(如linux)等信息。
可选地,为了减少资源占用,减小系统负荷,在上述步骤219之后,将待执行应用的标识对应的容器镜像存储于容器镜像存储区域;删除所有层数据对应的快照层文件,卸载待执行应用的标识对应的虚拟机镜像。
通过上述步骤212至上述步骤219之后,得到容器镜像。可选地,上述步骤221中,调用容器镜像驱动,并通过所调用的容器镜像驱动从容器镜像中读出Docker容器对应的层数据和容器镜像的元数据信息。
从容器镜像中读出Docker容器对应的层数据和容器镜像的元数据信息;其中,Docker容器对应的层数据为用于运行待执行应用对应的Docker容器所需要的层数据。此时,容器镜像中仅存在的层数据为Docker容器对应的层数据。
根据读出的Docker容器对应的层数据,生成Docker容器对应的快照层文件,其中,Docker容器对应的快照层文件包括Docker容器对应的层数据的快照;Docker容器对应的快照层文件为可读可写的层文件。基于快照机制,在Docker容器中生成Docker容器对应的快照层文件,该Docker容器对应的快照层文件也为一个工作层文件,可用于存储Docker容器运行过程中产生的文件。
将Docker容器对应的快照层文件挂载至第二工作目录,并根据读出的容器镜像的元数据信息进行环境配置。具体来说,根据Docker容器对应的层数据中的各个层数据,生成该容器镜像的块设备,将该容器镜像的块设备挂载到第二工作目录;块设备具体为Linux系统上的一种设备类型。本发明实施例中,第二工作目录可与第一工作目录为一个工作目录,也可为不同的工作目录。
根据读出的待执行应用对应的容器镜像中的元数据信息,对系统参数进行配置,以使配置之后的系统参数与待执行应用对应的容器镜像中的元数据信息相匹配;其中,系统参数为环境变量、待运行应用的相关参数信息。
通过运行挂载至第二工作目录的快照层文件,运行待执行应用对应的Docker容器。
通过本发明实施例提供的上述方法可以快速、大量将待执行应用对应的虚拟机镜像转换为容器镜像,从而使Dcoker为待执行应用创建容器,并在运行待执行应用的容器时,通过容器镜像驱动直接运行待执行应用的容器镜像。
从上述内容可看出,本发明实施例中接收用于指示运行待执行应用对应的Docker容器的执行命令;其中,执行命令中包括待执行应用的标识;根据执行命令中包括的待执行应用的标识,获取待执行应用的标识对应的虚拟机镜像;从虚拟机镜像中读出所有层数据和虚拟机镜像的元数据信息;根据读出的所有层数据,生成所有层数据对应的快照层文件;所有层数据对应的快照层文件为可读可写的层文件;将所有层数据对应的快照层文件挂载至第一工作目录;从挂载至第一工作目录的所有层数据对应的快照层文件中,删除Docker容器对应的层数据之外的层数据;其中,Docker容器对应的层数据为用于运行待执行应用对应的Docker容器所需要的层数据;将进行删除操作之后的所有层数据对应的快照层文件中剩余的层文件,以及虚拟机镜像的元数据信息进行打包,得到预处理镜像;根据预处理镜像,生成容器镜像的元数据信息;其中,容器镜像的元数据信息包括预处理镜像的格式信息;将预处理镜像和容器镜像的元数据信息打包,得到待执行应用的标识对应的容器镜像;通过运行待执行应用的标识对应的容器镜像,运行待执行应用对应的Docker容器。由于本发明实施例中可以从虚拟机镜像中的所有层数据中读出Docker容器对应的层数据和虚拟机镜像的元数据信息,且Docker容器对应的层数据为用于运行待执行应用对应的Docker容器所需要的层数据,进而,可根据该读出的Docker容器对应的层数据和虚拟机镜像的元数据信息,运行待执行应用对应的Docker容器。可见,该过程简便快捷,且避免了现有技术中使用人工的方式将待执行应用的虚拟机镜像转换为容器镜像的方法,也无需开发人员既要了解待执行应用对应的虚拟机镜像的整体部署,也要了解容器镜像的构建方法,可见,本发明实施例提供的方法能够简单高效的在Dcoker容器上运行之前在虚拟机中构建的应用,且降低了对开发人员的要求。
图3示例性示出了本发明实施例提供一种Docker容器运行装置的结构示意图。
基于相同构思,本发明实施例提供一种Docker容器运行装置300,如图3 所示,包括接收单元301、获取单元302、处理单元303、生成单元304:
接收单元,用于接收用于指示运行待执行应用对应的Docker容器的执行命令;其中,执行命令中包括待执行应用的标识;
获取单元,用于根据执行命令中包括的待执行应用的标识,获取待执行应用的标识对应的虚拟机镜像;
处理单元,用于从虚拟机镜像中的所有层数据中读出Docker容器对应的层数据和虚拟机镜像的元数据信息;根据读出的Docker容器对应的层数据,生成Docker容器对应的快照层文件,将Docker容器对应的快照层文件挂载至工作目录,并根据读出的虚拟机镜像的元数据信息进行环境配置;通过运行挂载至工作目录的Docker容器对应的快照层文件,运行待执行应用对应的Docker容器;
其中,Docker容器对应的层数据为用于运行待执行应用对应的Docker容器所需要的层数据;Docker容器对应的快照层文件包括Docker容器对应的层数据的快照;Docker容器对应的快照层文件为可读可写的层文件。
可选地,处理单元,具体用于:
调用虚拟机镜像驱动,并通过所调用的虚拟机镜像驱动从虚拟机镜像中的所有层数据中读出Docker容器对应的层数据和虚拟机镜像的元数据信息。
可选地,Docker容器对应的层数据包括:
虚拟机镜像中的所有层数据中除内核文件、系统目录,以及根(boot)目录下的文件之外的层数据。
可选地,处理单元,具体用于:
根据读出的待执行应用对应的虚拟机镜像的元数据信息,对系统参数进行配置,以使配置之后的系统参数与待执行应用对应的虚拟机镜像的元数据信息相匹配;
其中,系统参数为环境变量。
可选地,还包括,生成单元,用于:
基于虚拟机技术,生成待执行应用对应的虚拟机镜像,并将虚拟机镜像存 储于虚拟机镜像存储区域;
获取单元,具体用于:
根据执行命令中包括的待执行应用的标识,从虚拟机镜像存储区域,获取待执行应用的标识对应的虚拟机镜像。
本发明实施例中,接收用于指示运行待执行应用对应的Docker容器的执行命令;其中,执行命令中包括待执行应用的标识;根据执行命令中包括的待执行应用的标识,获取待执行应用的标识对应的虚拟机镜像;从虚拟机镜像中的所有层数据中读出Docker容器对应的层数据和虚拟机镜像的元数据信息;其中,Docker容器对应的层数据为用于运行待执行应用对应的Docker容器所需要的层数据;根据读出的Docker容器对应的层数据,生成Docker容器对应的快照层文件,其中,Docker容器对应的快照层文件包括Docker容器对应的层数据的快照;Docker容器对应的快照层文件为可读可写的层文件;将Docker容器对应的快照层文件挂载至工作目录,并根据读出的虚拟机镜像的元数据信息进行环境配置;通过运行挂载至工作目录的Docker容器对应的快照层文件,运行待执行应用对应的Docker容器。由于本发明实施例中可以从虚拟机镜像中的所有层数据中读出Docker容器对应的层数据和虚拟机镜像的元数据信息,且Docker容器对应的层数据为用于运行待执行应用对应的Docker容器所需要的层数据,进而,可根据该读出的Docker容器对应的层数据和虚拟机镜像的元数据信息,运行待执行应用对应的Docker容器。可见,该过程简便快捷,且避免了现有技术中使用人工的方式将待执行应用的虚拟机镜像转换为容器镜像的方法,也无需开发人员既要了解待执行应用对应的虚拟机镜像的整体部署,也要了解容器镜像的构建方法,可见,本发明实施例提供的方法能够简单高效的在Dcoker容器上运行之前在虚拟机中构建的应用,且降低了对开发人员的要求。
图4示例性示出了本发明实施例提供的一种Docker容器的运行装置的结构示意图。
基于相同构思,本发明实施例提供的一种Docker容器的运行装置400,如 图4所示,包括接收单元401、获取单元402、转换单元403、处理单元404、生成单元405:
接收单元,用于接收用于指示运行待执行应用对应的Docker容器的执行命令;其中,执行命令中包括待执行应用的标识;
获取单元,用于根据执行命令中包括的待执行应用的标识,获取待执行应用的标识对应的虚拟机镜像;
转换单元,用于从虚拟机镜像中读出所有层数据和虚拟机镜像的元数据信息;根据读出的所有层数据,生成所有层数据对应的快照层文件;所有层数据对应的快照层文件为可读可写的层文件;将所有层数据对应的快照层文件挂载至第一工作目录;从挂载至第一工作目录的所有层数据对应的快照层文件中,删除Docker容器对应的层数据之外的层数据;将进行删除操作之后的所有层数据对应的快照层文件中剩余的层文件,以及虚拟机镜像的元数据信息进行打包,得到预处理镜像;根据预处理镜像,生成容器镜像的元数据信息;其中,容器镜像的元数据信息包括预处理镜像的格式信息;将预处理镜像和容器镜像的元数据信息打包,得到待执行应用的标识对应的容器镜像;其中,Docker容器对应的层数据为用于运行待执行应用对应的Docker容器所需要的层数据;
处理单元,用于通过运行待执行应用的标识对应的容器镜像,运行待执行应用对应的Docker容器。
可选地,转换单元,具体用于:
调用虚拟机镜像驱动,并通过所调用的虚拟机镜像驱动从虚拟机镜像中读出所有层数据和虚拟机镜像的元数据信息。
可选地,Docker容器对应的层数据包括:
虚拟机镜像中的所有层数据中除内核文件、系统目录,以及根(boot)目录下的文件之外的层数据;
容器镜像的元数据信息包括:预处理镜像中信息的存放格式、存放位置,以及Docker容器对应的层数据中各个层数据之间的层次关系。
可选地,转换单元,还用于:
将待执行应用的标识对应的容器镜像存储于容器镜像存储区域;
删除所有层数据对应的快照层文件,卸载待执行应用的标识对应的虚拟机镜像。
可选地,处理单元,具体用于:
从容器镜像中读出Docker容器对应的层数据和容器镜像的元数据信息;其中,Docker容器对应的层数据为用于运行待执行应用对应的Docker容器所需要的层数据;
根据读出的Docker容器对应的层数据,生成Docker容器对应的快照层文件,其中,Docker容器对应的快照层文件包括Docker容器对应的层数据的快照;Docker容器对应的快照层文件为可读可写的层文件;
将Docker容器对应的快照层文件挂载至第二工作目录,并根据读出的容器镜像的元数据信息进行环境配置;
通过运行挂载至第二工作目录的快照层文件,运行待执行应用对应的Docker容器。
可选地,处理单元,具体用于:
调用容器镜像驱动,并通过所调用的容器镜像驱动从容器镜像中读出Docker容器对应的层数据和容器镜像的元数据信息。
可选地,处理单元,具体用于:
根据读出的待执行应用对应的容器镜像中的元数据信息,对系统参数进行配置,以使配置之后的系统参数与待执行应用对应的容器镜像中的元数据信息相匹配;
其中,系统参数为环境变量。
可选地,还包括,生成单元,用于:
基于虚拟机技术,生成待执行应用的标识对应的虚拟机镜像,并将待执行应用的标识对应的虚拟机镜像存储于虚拟机镜像存储区域;
获取单元,具体用于:
根据执行命令中包括的待执行应用的标识,从虚拟机镜像存储区域,获取 待执行应用的标识对应的虚拟机镜像。
从上述内容可看出,本发明实施例中接收用于指示运行待执行应用对应的Docker容器的执行命令;其中,执行命令中包括待执行应用的标识;根据执行命令中包括的待执行应用的标识,获取待执行应用的标识对应的虚拟机镜像;从虚拟机镜像中读出所有层数据和虚拟机镜像的元数据信息;根据读出的所有层数据,生成所有层数据对应的快照层文件;所有层数据对应的快照层文件为可读可写的层文件;将所有层数据对应的快照层文件挂载至第一工作目录;从挂载至第一工作目录的所有层数据对应的快照层文件中,删除Docker容器对应的层数据之外的层数据;其中,Docker容器对应的层数据为用于运行待执行应用对应的Docker容器所需要的层数据;将进行删除操作之后的所有层数据对应的快照层文件中剩余的层文件,以及虚拟机镜像的元数据信息进行打包,得到预处理镜像;根据预处理镜像,生成容器镜像的元数据信息;其中,容器镜像的元数据信息包括预处理镜像的格式信息;将预处理镜像和容器镜像的元数据信息打包,得到待执行应用的标识对应的容器镜像;通过运行待执行应用的标识对应的容器镜像,运行待执行应用对应的Docker容器。由于本发明实施例中可以从虚拟机镜像中的所有层数据中读出Docker容器对应的层数据和虚拟机镜像的元数据信息,且Docker容器对应的层数据为用于运行待执行应用对应的Docker容器所需要的层数据,进而,可根据该读出的Docker容器对应的层数据和虚拟机镜像的元数据信息,运行待执行应用对应的Docker容器。可见,该过程简便快捷,且避免了现有技术中使用人工的方式将待执行应用的虚拟机镜像转换为容器镜像的方法,也无需开发人员既要了解待执行应用对应的虚拟机镜像的整体部署,也要了解容器镜像的构建方法,可见,本发明实施例提供的方法能够简单高效的在Dcoker容器上运行之前在虚拟机中构建的应用,且降低了对开发人员的要求。
图5示例性示出了本发明实施例提供另一种Docker容器运行装置的结构示意图。
基于相同构思,本发明实施例提供另一种Docker容器运行装置530,如图5所示,包括收发器510、处理器500、存储器520:
处理器,用于读取存储器中的程序,运行下列过程:
通过收发器接收用于指示运行待执行应用对应的Docker容器的执行命令;其中,执行命令中包括待执行应用的标识;
处理器,用于根据执行命令中包括的待执行应用的标识,获取待执行应用的标识对应的虚拟机镜像;从虚拟机镜像中的所有层数据中读出Docker容器对应的层数据和虚拟机镜像的元数据信息;根据读出的Docker容器对应的层数据,生成Docker容器对应的快照层文件,将Docker容器对应的快照层文件挂载至工作目录,并根据读出的虚拟机镜像的元数据信息进行环境配置;通过运行挂载至工作目录的Docker容器对应的快照层文件,运行待执行应用对应的Docker容器;
其中,Docker容器对应的层数据为用于运行待执行应用对应的Docker容器所需要的层数据;Docker容器对应的快照层文件包括Docker容器对应的层数据的快照;Docker容器对应的快照层文件为可读可写的层文件;
存储器,用于存储上述程序,以及待执行应用的标识对应的虚拟机镜像。
可选地,处理器,具体用于:
调用虚拟机镜像驱动,并通过所调用的虚拟机镜像驱动从虚拟机镜像中的所有层数据中读出Docker容器对应的层数据和虚拟机镜像的元数据信息。
可选地,Docker容器对应的层数据包括:
虚拟机镜像中的所有层数据中除内核文件、系统目录,以及根(boot)目录下的文件之外的层数据。
可选地,处理器,具体用于:
根据读出的待执行应用对应的虚拟机镜像的元数据信息,对系统参数进行配置,以使配置之后的系统参数与待执行应用对应的虚拟机镜像的元数据信息相匹配;
其中,系统参数为环境变量。
可选地,处理器,还用于:
基于虚拟机技术,生成待执行应用对应的虚拟机镜像,并将虚拟机镜像存储于虚拟机镜像存储区域;
根据执行命令中包括的待执行应用的标识,从虚拟机镜像存储区域,获取待执行应用的标识对应的虚拟机镜像。
从本发明实施例中,接收用于指示运行待执行应用对应的Docker容器的执行命令;其中,执行命令中包括待执行应用的标识;根据执行命令中包括的待执行应用的标识,获取待执行应用的标识对应的虚拟机镜像;从虚拟机镜像中的所有层数据中读出Docker容器对应的层数据和虚拟机镜像的元数据信息;其中,Docker容器对应的层数据为用于运行待执行应用对应的Docker容器所需要的层数据;根据读出的Docker容器对应的层数据,生成Docker容器对应的快照层文件,其中,Docker容器对应的快照层文件包括Docker容器对应的层数据的快照;Docker容器对应的快照层文件为可读可写的层文件;将Docker容器对应的快照层文件挂载至工作目录,并根据读出的虚拟机镜像的元数据信息进行环境配置;通过运行挂载至工作目录的Docker容器对应的快照层文件,运行待执行应用对应的Docker容器。由于本发明实施例中可以从虚拟机镜像中的所有层数据中读出Docker容器对应的层数据和虚拟机镜像的元数据信息,且Docker容器对应的层数据为用于运行待执行应用对应的Docker容器所需要的层数据,进而,可根据该读出的Docker容器对应的层数据和虚拟机镜像的元数据信息,运行待执行应用对应的Docker容器。可见,该过程简便快捷,且避免了现有技术中使用人工的方式将待执行应用的虚拟机镜像转换为容器镜像的方法,也无需开发人员既要了解待执行应用对应的虚拟机镜像的整体部署,也要了解容器镜像的构建方法,可见,本发明实施例提供的方法能够简单高效的在Dcoker容器上运行之前在虚拟机中构建的应用,且降低了对开发人员的要求。
图6示例性示出了本发明实施例提供的另一种Docker容器的运行装置的结构示意图。
基于相同构思,本发明实施例提供的另一种Docker容器的运行装置630,如图6所示,包括收发器610、处理器600、存储器620:
处理器,用于读取存储器中的程序,运行下列过程:
通过收发器接收用于指示运行待执行应用对应的Docker容器的执行命令;其中,执行命令中包括待执行应用的标识;
处理器,用于根据执行命令中包括的待执行应用的标识,获取待执行应用的标识对应的虚拟机镜像;从虚拟机镜像中读出所有层数据和虚拟机镜像的元数据信息;根据读出的所有层数据,生成所有层数据对应的快照层文件;所有层数据对应的快照层文件为可读可写的层文件;将所有层数据对应的快照层文件挂载至第一工作目录;从挂载至第一工作目录的所有层数据对应的快照层文件中,删除Docker容器对应的层数据之外的层数据;将进行删除操作之后的所有层数据对应的快照层文件中剩余的层文件,以及虚拟机镜像的元数据信息进行打包,得到预处理镜像;根据预处理镜像,生成容器镜像的元数据信息;其中,容器镜像的元数据信息包括预处理镜像的格式信息;将预处理镜像和容器镜像的元数据信息打包,得到待执行应用的标识对应的容器镜像;其中,Docker容器对应的层数据为用于运行待执行应用对应的Docker容器所需要的层数据;通过运行待执行应用的标识对应的容器镜像,运行待执行应用对应的Docker容器;
存储器,用于存储上述程序,以及待执行应用的标识对应的虚拟机镜像和容器镜像。
可选地,处理器,具体用于:
调用虚拟机镜像驱动,并通过所调用的虚拟机镜像驱动从虚拟机镜像中读出所有层数据和虚拟机镜像的元数据信息。
可选地,Docker容器对应的层数据包括:
虚拟机镜像中的所有层数据中除内核文件、系统目录,以及根(boot)目录下的文件之外的层数据;
容器镜像的元数据信息包括:预处理镜像中信息的存放格式、存放位置, 以及Docker容器对应的层数据中各个层数据之间的层次关系。
可选地,处理器,还用于:
将待执行应用的标识对应的容器镜像存储于容器镜像存储区域;
删除所有层数据对应的快照层文件,卸载待执行应用的标识对应的虚拟机镜像。
可选地,处理器,具体用于:
从容器镜像中读出Docker容器对应的层数据和容器镜像的元数据信息;其中,Docker容器对应的层数据为用于运行待执行应用对应的Docker容器所需要的层数据;
根据读出的Docker容器对应的层数据,生成Docker容器对应的快照层文件,其中,Docker容器对应的快照层文件包括Docker容器对应的层数据的快照;Docker容器对应的快照层文件为可读可写的层文件;
将Docker容器对应的快照层文件挂载至第二工作目录,并根据读出的容器镜像的元数据信息进行环境配置;
通过运行挂载至第二工作目录的快照层文件,运行待执行应用对应的Docker容器。
可选地,处理器,具体用于:
调用容器镜像驱动,并通过所调用的容器镜像驱动从容器镜像中读出Docker容器对应的层数据和容器镜像的元数据信息。
可选地,处理器,具体用于:
根据读出的待执行应用对应的容器镜像中的元数据信息,对系统参数进行配置,以使配置之后的系统参数与待执行应用对应的容器镜像中的元数据信息相匹配;
其中,系统参数为环境变量。
可选地,处理器,还用于:
基于虚拟机技术,生成待执行应用的标识对应的虚拟机镜像,并将待执行应用的标识对应的虚拟机镜像存储于虚拟机镜像存储区域;
根据执行命令中包括的待执行应用的标识,从虚拟机镜像存储区域,获取待执行应用的标识对应的虚拟机镜像。
从上述内容可看出,本发明实施例中接收用于指示运行待执行应用对应的Docker容器的执行命令;其中,执行命令中包括待执行应用的标识;根据执行命令中包括的待执行应用的标识,获取待执行应用的标识对应的虚拟机镜像;从虚拟机镜像中读出所有层数据和虚拟机镜像的元数据信息;根据读出的所有层数据,生成所有层数据对应的快照层文件;所有层数据对应的快照层文件为可读可写的层文件;将所有层数据对应的快照层文件挂载至第一工作目录;从挂载至第一工作目录的所有层数据对应的快照层文件中,删除Docker容器对应的层数据之外的层数据;其中,Docker容器对应的层数据为用于运行待执行应用对应的Docker容器所需要的层数据;将进行删除操作之后的所有层数据对应的快照层文件中剩余的层文件,以及虚拟机镜像的元数据信息进行打包,得到预处理镜像;根据预处理镜像,生成容器镜像的元数据信息;其中,容器镜像的元数据信息包括预处理镜像的格式信息;将预处理镜像和容器镜像的元数据信息打包,得到待执行应用的标识对应的容器镜像;通过运行待执行应用的标识对应的容器镜像,运行待执行应用对应的Docker容器。由于本发明实施例中可以从虚拟机镜像中的所有层数据中读出Docker容器对应的层数据和虚拟机镜像的元数据信息,且Docker容器对应的层数据为用于运行待执行应用对应的Docker容器所需要的层数据,进而,可根据该读出的Docker容器对应的层数据和虚拟机镜像的元数据信息,运行待执行应用对应的Docker容器。可见,该过程简便快捷,且避免了现有技术中使用人工的方式将待执行应用的虚拟机镜像转换为容器镜像的方法,也无需开发人员既要了解待执行应用对应的虚拟机镜像的整体部署,也要了解容器镜像的构建方法,可见,本发明实施例提供的方法能够简单高效的在Dcoker容器上运行之前在虚拟机中构建的应用,且降低了对开发人员的要求。
本领域内的技术人员应明白,本发明的实施例可提供为方法、或计算机程 序产品。因此,本发明可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本发明可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。
本发明是参照根据本发明实施例的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器运行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上运行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上运行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。
尽管已描述了本发明的优选实施例,但本领域内的技术人员一旦得知了基本创造性概念,则可对这些实施例作出另外的变更和修改。所以,所附权利要求意欲解释为包括优选实施例以及落入本发明范围的所有变更和修改。
显然,本领域的技术人员可以对本发明进行各种改动和变型而不脱离本发明的精神和范围。这样,倘若本发明的这些修改和变型属于本发明权利要求及其等同技术的范围之内,则本发明也意图包含这些改动和变型在内。

Claims (26)

  1. 一种集装箱Docker容器运行方法,其特征在于,包括:
    接收用于指示运行待执行应用对应的Docker容器的执行命令;其中,所述执行命令中包括所述待执行应用的标识;
    根据所述执行命令中包括的所述待执行应用的标识,获取所述待执行应用的标识对应的虚拟机镜像;
    从所述虚拟机镜像中的所有层数据中读出所述Docker容器对应的层数据和所述虚拟机镜像的元数据信息;其中,所述Docker容器对应的层数据为用于运行所述待执行应用对应的Docker容器所需要的层数据;
    根据读出的所述Docker容器对应的层数据,生成所述Docker容器对应的快照层文件,其中,所述Docker容器对应的快照层文件包括所述Docker容器对应的层数据的快照;
    所述Docker容器对应的快照层文件为可读可写的层文件;
    将所述Docker容器对应的快照层文件挂载至工作目录,并根据读出的所述虚拟机镜像的元数据信息进行环境配置;
    通过运行挂载至所述工作目录的所述Docker容器对应的快照层文件,运行所述待执行应用对应的Docker容器。
  2. 如权利要求1所述的方法,其特征在于,所述从所述虚拟机镜像中的所有层数据中读出所述Docker容器对应的层数据和所述虚拟机镜像的元数据信息,具体包括:
    调用虚拟机镜像驱动,并通过所调用的所述虚拟机镜像驱动从所述虚拟机镜像中的所有层数据中读出所述Docker容器对应的层数据和所述虚拟机镜像的元数据信息。
  3. 如权利要求1或2所述的方法,其特征在于,所述Docker容器对应的层数据包括:
    所述虚拟机镜像中的所有层数据中除内核文件、系统目录,以及根(boot)目录下的文件之外的层数据。
  4. 如权利要求1至3任一权利要求所述的方法,其特征在于,所述根据读出的所述虚拟机镜像的元数据信息进行环境配置,具体包括:
    根据读出的所述待执行应用对应的所述虚拟机镜像的元数据信息,对系统参数进行配置,以使配置之后的系统参数与所述待执行应用对应的所述虚拟机镜像的元数据信息相匹配;
    其中,所述系统参数为环境变量。
  5. 如权利要求1至4任一权利要求所述的方法,其特征在于,所述根据所述执行命令中包括的所述待执行应用的标识,获取所述待执行应用的标识对应的虚拟机镜像之前,还包括:
    基于虚拟机技术,生成所述待执行应用对应的所述虚拟机镜像,并将所述虚拟机镜像存储于虚拟机镜像存储区域;
    所述根据所述执行命令中包括的所述待执行应用的标识,获取所述待执行应用的标识对应的虚拟机镜像,具体包括:
    根据所述执行命令中包括的所述待执行应用的标识,从所述虚拟机镜像存储区域,获取所述待执行应用的标识对应的所述虚拟机镜像。
  6. 一种集装箱Docker容器运行方法,其特征在于,包括:
    接收用于指示运行待执行应用对应的Docker容器的执行命令;其中,所述执行命令中包括所述待执行应用的标识;
    根据所述执行命令中包括的所述待执行应用的标识,获取所述待执行应用的标识对应的虚拟机镜像;
    从所述虚拟机镜像中读出所有层数据和虚拟机镜像的元数据信息;
    根据读出的所述所有层数据,生成所述所有层数据对应的快照层文件;所述所有层数据对应的快照层文件为可读可写的层文件;
    将所述所有层数据对应的快照层文件挂载至第一工作目录;
    从挂载至所述第一工作目录的所述所有层数据对应的快照层文件中,删除 所述Docker容器对应的层数据之外的层数据;其中,所述Docker容器对应的层数据为用于运行所述待执行应用对应的Docker容器所需要的层数据;
    将进行删除操作之后的所有层数据对应的快照层文件中剩余的层文件,以及所述虚拟机镜像的元数据信息进行打包,得到预处理镜像;
    根据所述预处理镜像,生成容器镜像的元数据信息;其中,所述容器镜像的元数据信息包括所述预处理镜像的格式信息;
    将所述预处理镜像和所述容器镜像的元数据信息打包,得到所述待执行应用的标识对应的容器镜像;
    通过运行所述待执行应用的标识对应的容器镜像,运行所述待执行应用对应的Docker容器。
  7. 如权利要求6所述的方法,其特征在于,所述从所述虚拟机镜像中读出所有层数据和虚拟机镜像的元数据信息,具体包括:
    调用虚拟机镜像驱动,并通过所调用的所述虚拟机镜像驱动从所述虚拟机镜像中读出所述所有层数据和所述虚拟机镜像的元数据信息。
  8. 如权利要求6至7任一权利要求所述的方法,其特征在于,所述Docker容器对应的层数据包括:
    所述虚拟机镜像中的所有层数据中除内核文件、系统目录,以及根(boot)目录下的文件之外的层数据;
    所述容器镜像的元数据信息包括:所述预处理镜像中信息的存放格式、存放位置,以及所述Docker容器对应的层数据中各个层数据之间的层次关系。
  9. 如权利要求6至8任一权利要求所述的方法,其特征在于,所述将所述预处理镜像和所述容器镜像的元数据信息打包,得到所述待执行应用的标识对应的容器镜像之后,还包括:
    将所述待执行应用的标识对应的容器镜像存储于容器镜像存储区域;
    删除所有层数据对应的快照层文件,卸载所述待执行应用的标识对应的虚拟机镜像。
  10. 如权利要求6至9任一权利要求所述的方法,其特征在于,所述运行 所述待执行应用的标识对应的容器镜像,具体包括:
    从所述容器镜像中读出所述Docker容器对应的层数据和所述容器镜像的元数据信息;其中,所述Docker容器对应的层数据为用于运行所述待执行应用对应的Docker容器所需要的层数据;
    根据读出的所述Docker容器对应的层数据,生成所述Docker容器对应的快照层文件,其中,所述Docker容器对应的快照层文件包括所述Docker容器对应的层数据的快照;所述Docker容器对应的快照层文件为可读可写的层文件;
    将所述Docker容器对应的快照层文件挂载至第二工作目录,并根据读出的所述容器镜像的元数据信息进行环境配置;
    通过运行挂载至所述第二工作目录的所述快照层文件,运行所述待执行应用对应的Docker容器。
  11. 如权利要求10所述的方法,其特征在于,所述从所述容器镜像中读出所述Docker容器对应的层数据和所述容器镜像的元数据信息,具体包括:
    调用容器镜像驱动,并通过所调用的所述容器镜像驱动从所述容器镜像中读出所述Docker容器对应的层数据和所述容器镜像的元数据信息。
  12. 如权利要求10或11所述的方法,其特征在于,所述根据读出的所述容器镜像中的元数据信息进行环境配置,具体包括:
    根据读出的所述待执行应用对应的所述容器镜像中的元数据信息,对系统参数进行配置,以使配置之后的系统参数与所述待执行应用对应的所述容器镜像中的元数据信息相匹配;
    其中,所述系统参数为环境变量。
  13. 如权利要求6至12任一权利要求所述的方法,其特征在于,所述根据所述执行命令中包括的所述待执行应用的标识,获取所述待执行应用的标识对应的虚拟机镜像之前,还包括:
    基于虚拟机技术,生成所述待执行应用的标识对应的虚拟机镜像,并将所述待执行应用的标识对应的虚拟机镜像存储于虚拟机镜像存储区域;
    所述根据所述执行命令中包括的所述待执行应用的标识,获取所述待执行应用的标识对应的虚拟机镜像,具体包括:
    根据所述执行命令中包括的所述待执行应用的标识,从所述虚拟机镜像存储区域,获取所述待执行应用的标识对应的虚拟机镜像。
  14. 一种集装箱Docker容器运行装置,其特征在于,包括:
    接收单元,用于接收用于指示运行待执行应用对应的Docker容器的执行命令;其中,所述执行命令中包括所述待执行应用的标识;
    获取单元,用于根据所述执行命令中包括的所述待执行应用的标识,获取所述待执行应用的标识对应的虚拟机镜像;
    处理单元,用于从所述虚拟机镜像中的所有层数据中读出所述Docker容器对应的层数据和所述虚拟机镜像的元数据信息;根据读出的所述Docker容器对应的层数据,生成所述Docker容器对应的快照层文件,将所述Docker容器对应的快照层文件挂载至工作目录,并根据读出的所述虚拟机镜像的元数据信息进行环境配置;通过运行挂载至所述工作目录的所述Docker容器对应的快照层文件,运行所述待执行应用对应的Docker容器;
    其中,所述Docker容器对应的层数据为用于运行所述待执行应用对应的Docker容器所需要的层数据;所述Docker容器对应的快照层文件包括所述Docker容器对应的层数据的快照;所述Docker容器对应的快照层文件为可读可写的层文件。
  15. 如权利要求14所述的装置,其特征在于,所述处理单元,具体用于:
    调用虚拟机镜像驱动,并通过所调用的所述虚拟机镜像驱动从所述虚拟机镜像中的所有层数据中读出所述Docker容器对应的层数据和所述虚拟机镜像的元数据信息。
  16. 如权利要求14或15所述的装置,其特征在于,所述Docker容器对应的层数据包括:
    所述虚拟机镜像中的所有层数据中除内核文件、系统目录,以及根(boot)目录下的文件之外的层数据。
  17. 如权利要求14至16任一权利要求所述的装置,其特征在于,所述处理单元,具体用于:
    根据读出的所述待执行应用对应的所述虚拟机镜像的元数据信息,对系统参数进行配置,以使配置之后的系统参数与所述待执行应用对应的所述虚拟机镜像的元数据信息相匹配;
    其中,所述系统参数为环境变量。
  18. 如权利要求14至17任一权利要求所述的装置,其特征在于,还包括,生成单元,用于:
    基于虚拟机技术,生成所述待执行应用对应的所述虚拟机镜像,并将所述虚拟机镜像存储于虚拟机镜像存储区域;
    所述获取单元,具体用于:
    根据所述执行命令中包括的所述待执行应用的标识,从所述虚拟机镜像存储区域,获取所述待执行应用的标识对应的所述虚拟机镜像。
  19. 一种集装箱Docker容器运行装置,其特征在于,包括:
    接收单元,用于接收用于指示运行待执行应用对应的Docker容器的执行命令;其中,所述执行命令中包括所述待执行应用的标识;
    获取单元,用于根据所述执行命令中包括的所述待执行应用的标识,获取所述待执行应用的标识对应的虚拟机镜像;
    转换单元,用于从所述虚拟机镜像中读出所有层数据和虚拟机镜像的元数据信息;根据读出的所述所有层数据,生成所述所有层数据对应的快照层文件;所述所有层数据对应的快照层文件为可读可写的层文件;将所述所有层数据对应的快照层文件挂载至第一工作目录;从挂载至所述第一工作目录的所述所有层数据对应的快照层文件中,删除所述Docker容器对应的层数据之外的层数据;将进行删除操作之后的所有层数据对应的快照层文件中剩余的层文件,以及所述虚拟机镜像的元数据信息进行打包,得到预处理镜像;根据所述预处理镜像,生成容器镜像的元数据信息;其中,所述容器镜像的元数据信息包括所述预处理镜像的格式信息;将所述预处理镜像和所述容器镜像的元数据信息打 包,得到所述待执行应用的标识对应的容器镜像;其中,所述Docker容器对应的层数据为用于运行所述待执行应用对应的Docker容器所需要的层数据;
    处理单元,用于通过运行所述待执行应用的标识对应的容器镜像,运行所述待执行应用对应的Docker容器。
  20. 如权利要求19所述的装置,其特征在于,所述转换单元,具体用于:
    调用虚拟机镜像驱动,并通过所调用的所述虚拟机镜像驱动从所述虚拟机镜像中读出所述所有层数据和所述虚拟机镜像的元数据信息。
  21. 如权利要求19至20任一权利要求所述的装置,其特征在于,所述Docker容器对应的层数据包括:
    所述虚拟机镜像中的所有层数据中除内核文件、系统目录,以及根(boot)目录下的文件之外的层数据;
    所述容器镜像的元数据信息包括:所述预处理镜像中信息的存放格式、存放位置,以及所述Docker容器对应的层数据中各个层数据之间的层次关系。
  22. 如权利要求19至21任一权利要求所述的装置,其特征在于,所述转换单元,还用于:
    将所述待执行应用的标识对应的容器镜像存储于容器镜像存储区域;
    删除所有层数据对应的快照层文件,卸载所述待执行应用的标识对应的虚拟机镜像。
  23. 如权利要求19至22任一权利要求所述的装置,其特征在于,所述处理单元,具体用于:
    从所述容器镜像中读出所述Docker容器对应的层数据和所述容器镜像的元数据信息;其中,所述Docker容器对应的层数据为用于运行所述待执行应用对应的Docker容器所需要的层数据;
    根据读出的所述Docker容器对应的层数据,生成所述Docker容器对应的快照层文件,其中,所述Docker容器对应的快照层文件包括所述Docker容器对应的层数据的快照;所述Docker容器对应的快照层文件为可读可写的层文件;
    将所述Docker容器对应的快照层文件挂载至第二工作目录,并根据读出的所述容器镜像的元数据信息进行环境配置;
    通过运行挂载至所述第二工作目录的所述快照层文件,运行所述待执行应用对应的Docker容器。
  24. 如权利要求23所述的装置,其特征在于,所述处理单元,具体用于:
    调用容器镜像驱动,并通过所调用的所述容器镜像驱动从所述容器镜像中读出所述Docker容器对应的层数据和所述容器镜像的元数据信息。
  25. 如权利要求23或24所述的装置,其特征在于,所述处理单元,具体用于:
    根据读出的所述待执行应用对应的所述容器镜像中的元数据信息,对系统参数进行配置,以使配置之后的系统参数与所述待执行应用对应的所述容器镜像中的元数据信息相匹配;
    其中,所述系统参数为环境变量。
  26. 如权利要求23至25任一权利要求所述的装置,其特征在于,还包括,生成单元,用于:
    基于虚拟机技术,生成所述待执行应用的标识对应的虚拟机镜像,并将所述待执行应用的标识对应的虚拟机镜像存储于虚拟机镜像存储区域;
    所述获取单元,具体用于:
    根据所述执行命令中包括的所述待执行应用的标识,从所述虚拟机镜像存储区域,获取所述待执行应用的标识对应的虚拟机镜像。
PCT/CN2016/107978 2015-12-03 2016-11-30 一种Docker容器运行方法和装置 WO2017092672A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
EP16869982.5A EP3324291B1 (en) 2015-12-03 2016-11-30 Method and device for operating docker container
US15/913,186 US10579355B2 (en) 2015-12-03 2018-03-06 Docker container operating method and apparatus

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201510883372.8 2015-12-03
CN201510883372.8A CN105511943B (zh) 2015-12-03 2015-12-03 一种Docker容器运行方法和装置

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US15/913,186 Continuation US10579355B2 (en) 2015-12-03 2018-03-06 Docker container operating method and apparatus

Publications (1)

Publication Number Publication Date
WO2017092672A1 true WO2017092672A1 (zh) 2017-06-08

Family

ID=55719949

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/107978 WO2017092672A1 (zh) 2015-12-03 2016-11-30 一种Docker容器运行方法和装置

Country Status (4)

Country Link
US (1) US10579355B2 (zh)
EP (1) EP3324291B1 (zh)
CN (1) CN105511943B (zh)
WO (1) WO2017092672A1 (zh)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110955494A (zh) * 2019-11-15 2020-04-03 北京浪潮数据技术有限公司 一种虚拟机磁盘镜像构建方法、装置、设备、介质
CN111432006A (zh) * 2020-03-30 2020-07-17 中科九度(北京)空间信息技术有限责任公司 一种轻量级资源虚拟化与分配方法
US10901700B2 (en) 2019-02-27 2021-01-26 International Business Machines Corporation Automatic generation of container image in a runtime environment
CN112631737A (zh) * 2021-01-08 2021-04-09 重庆紫光华山智安科技有限公司 容器镜像构建方法、装置、电子设备及存储介质

Families Citing this family (53)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105511943B (zh) 2015-12-03 2019-04-12 华为技术有限公司 一种Docker容器运行方法和装置
CN106067858B (zh) * 2016-05-24 2019-02-15 中国联合网络通信集团有限公司 容器间的通信方法、装置及系统
CN106201527B (zh) * 2016-07-15 2019-06-28 北京首都在线科技股份有限公司 一种基于逻辑分区的应用程序容器系统
CN107766130B (zh) * 2016-08-22 2020-11-24 中国电信股份有限公司 虚拟机向容器迁移的方法和装置
CN108132826B (zh) 2016-11-30 2020-12-22 华为技术有限公司 跨云服务器的镜像管理方法、装置及服务器
CN106487815B (zh) * 2016-12-21 2019-10-18 乾云众创(北京)信息科技研究院有限公司 一种基于白名单的容器运行安全验证处理方法及系统
CN106681866B (zh) * 2016-12-30 2019-10-18 成都华为技术有限公司 一种保证应用一致性的方法、装置及系统
CN106991321B (zh) * 2017-04-18 2020-11-03 北京元心科技有限公司 多容器系统中无痕运行应用程序的方法及装置
CN108965214B (zh) * 2017-05-24 2021-07-23 中国移动通信集团山西有限公司 数据处理方法、装置及计算机存储介质
CN107341073B (zh) * 2017-06-08 2020-07-03 北京青云科技股份有限公司 一种实现容器主机兼容虚拟主机镜像文件的方法及装置
CN107577937B (zh) * 2017-09-01 2021-05-04 深信服科技股份有限公司 一种应用程序保护方法及系统
CN107590033B (zh) * 2017-09-07 2021-06-22 网宿科技股份有限公司 一种创建docker容器的方法、装置和系统
CN107729020B (zh) * 2017-10-11 2020-08-28 北京航空航天大学 一种实现大规模容器快速部署的方法
CN107704593B (zh) * 2017-10-12 2020-11-27 成都知道创宇信息技术有限公司 一种检测并解决Docker本地镜像与远程仓库镜像冲突的方法
CN107766050B (zh) * 2017-10-31 2021-12-07 新华三云计算技术有限公司 一种异构应用的部署方法以及装置
US10761871B2 (en) * 2017-11-14 2020-09-01 Telefonaktiebolaget Lm Ericsson (Publ) Method and apparratus for secrets injection into containers
US11340933B2 (en) 2017-11-14 2022-05-24 Telefonaktiebolaget Lm Ericsson (Publ) Method and apparatus for secrets injection into containers for 5G network elements
CN107734066A (zh) * 2017-11-16 2018-02-23 郑州云海信息技术有限公司 一种数据中心综合管理系统服务治理方法
CN108089948B (zh) * 2017-12-20 2021-02-02 北京搜狐新媒体信息技术有限公司 一种数据库备份方法及装置
CN109992956A (zh) * 2017-12-29 2019-07-09 华为技术有限公司 容器的安全策略的处理方法和相关装置
CN108446326B (zh) * 2018-02-11 2019-01-29 江苏微锐超算科技有限公司 一种基于容器的异构数据管理方法及系统
CN108415795B (zh) * 2018-02-12 2019-04-05 人和未来生物科技(长沙)有限公司 一种容器Dockerfile、容器镜像快速生成方法及系统
CN110196728B (zh) * 2018-03-27 2023-07-25 腾讯科技(深圳)有限公司 镜像升级的容器处理方法和装置
US10599463B2 (en) * 2018-03-28 2020-03-24 Nutanix, Inc. System and method for creating virtual machines from containers
CN108471420B (zh) * 2018-03-29 2021-02-09 上交所技术有限责任公司 基于网络模式识别和匹配的容器安全防御方法与装置
US10901751B2 (en) * 2018-05-17 2021-01-26 International Business Machines Corporation Temporal layers for container technologies
CN108664290B (zh) * 2018-05-17 2024-02-02 中国平安人寿保险股份有限公司 一种应用程序配置方法、装置、电子设备及存储介质
US11625360B2 (en) * 2018-06-20 2023-04-11 Kyndryl, Inc. Tailoring container images to a specific microarchitecture in virtualized environments
CN109144661A (zh) * 2018-07-05 2019-01-04 杭州电子科技大学 一种基于docker的深度学习管理方法
CN109614226B (zh) * 2018-11-20 2020-03-10 武汉烽火信息集成技术有限公司 一种基于Kubernetes的有状态应用存储管理方法
CN109933342B (zh) * 2019-03-18 2020-10-16 北京升鑫网络科技有限公司 一种从本地docker镜像中提取文件内容的方法及装置
US10809994B1 (en) 2019-04-05 2020-10-20 Sap Se Declarative multi-artefact software installation
US10942723B2 (en) * 2019-04-05 2021-03-09 Sap Se Format for multi-artefact software packages
US10956140B2 (en) 2019-04-05 2021-03-23 Sap Se Software installation through an overlay file system
US11113249B2 (en) 2019-04-05 2021-09-07 Sap Se Multitenant application server using a union file system
US11232078B2 (en) 2019-04-05 2022-01-25 Sap Se Multitenancy using an overlay file system
CN110096333B (zh) * 2019-04-18 2021-06-29 华中科技大学 一种基于非易失内存的容器性能加速方法
CN110413437B (zh) * 2019-07-26 2022-06-17 济南浪潮数据技术有限公司 网络命名空间异常处理方法、装置、设备及可读存储介质
CN110704157B (zh) * 2019-09-12 2023-06-30 深圳市元征科技股份有限公司 一种应用启动方法、相关装置及介质
CN110659246B (zh) * 2019-09-26 2022-05-03 北京百度网讯科技有限公司 基于容器的文件挂载方法、装置及电子设备
US11099882B2 (en) * 2019-09-26 2021-08-24 International Business Machines Corporation Container optimization through automatic layer suggestions
CN110688174A (zh) * 2019-09-30 2020-01-14 李福帮 容器启动方法、存储介质和电子设备
US11822947B2 (en) 2019-11-27 2023-11-21 Amazon Technologies, Inc. Automated management of machine images
CN111045786B (zh) * 2019-11-28 2020-07-24 北京大学 一种云环境下的基于镜像分层技术的容器创建系统及方法
US11429808B2 (en) 2019-12-19 2022-08-30 Varian Medical Systems International Ag Systems and methods for scalable segmentation model training
US20230078967A1 (en) * 2020-03-04 2023-03-16 Hewlett-Packard Development Company, L.P. One-time-use secret bootstrapping in container-orchestrated environments
CN111309446A (zh) * 2020-03-10 2020-06-19 山东汇贸电子口岸有限公司 一种基于分层管理的快速发布大量docker镜像的方法
CN111414231B (zh) * 2020-03-18 2022-11-29 上海云轴信息科技有限公司 一种虚拟机镜像与容器镜像相互转换的方法及设备
CN111427664B (zh) * 2020-03-25 2024-04-12 杭州电子科技大学 基于容器的协议解析方法、装置、系统以及存储介质
CN111782339B (zh) * 2020-06-28 2024-04-12 京东科技控股股份有限公司 一种容器创建方法、装置、电子设备及存储介质
CN113051036A (zh) * 2021-03-31 2021-06-29 京东方科技集团股份有限公司 基于Docker容器的应用程序许可方法、装置、设备和介质
US11966462B2 (en) * 2021-09-29 2024-04-23 Dropbox, Inc. Malicious dependency prevention
CN117909287A (zh) * 2022-10-10 2024-04-19 华为终端有限公司 快照方法、电子设备、计算机程序产品及可读存储介质

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120173866A1 (en) * 2010-12-31 2012-07-05 International Business Machines Corporation System for securing virtual machine disks on a remote shared storage subsystem
CN104951308A (zh) * 2015-06-30 2015-09-30 北京奇虎科技有限公司 Docker Registry的管理优化方式及装置
CN105045656A (zh) * 2015-06-30 2015-11-11 深圳清华大学研究院 基于虚拟容器的大数据存储与管理方法
CN105511943A (zh) * 2015-12-03 2016-04-20 华为技术有限公司 一种Docker容器运行方法和装置

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8862741B1 (en) * 2011-06-23 2014-10-14 Amazon Technologies, Inc. Layered machine images
US9477491B2 (en) * 2011-12-29 2016-10-25 Vmware, Inc. Independent synchronization of virtual desktop image layers
US9817835B2 (en) * 2013-03-12 2017-11-14 Tintri Inc. Efficient data synchronization for storage containers
CN107766130B (zh) * 2016-08-22 2020-11-24 中国电信股份有限公司 虚拟机向容器迁移的方法和装置

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120173866A1 (en) * 2010-12-31 2012-07-05 International Business Machines Corporation System for securing virtual machine disks on a remote shared storage subsystem
CN104951308A (zh) * 2015-06-30 2015-09-30 北京奇虎科技有限公司 Docker Registry的管理优化方式及装置
CN105045656A (zh) * 2015-06-30 2015-11-11 深圳清华大学研究院 基于虚拟容器的大数据存储与管理方法
CN105511943A (zh) * 2015-12-03 2016-04-20 华为技术有限公司 一种Docker容器运行方法和装置

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
See also references of EP3324291A4 *

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10901700B2 (en) 2019-02-27 2021-01-26 International Business Machines Corporation Automatic generation of container image in a runtime environment
CN110955494A (zh) * 2019-11-15 2020-04-03 北京浪潮数据技术有限公司 一种虚拟机磁盘镜像构建方法、装置、设备、介质
CN110955494B (zh) * 2019-11-15 2022-04-22 北京浪潮数据技术有限公司 一种虚拟机磁盘镜像构建方法、装置、设备、介质
CN111432006A (zh) * 2020-03-30 2020-07-17 中科九度(北京)空间信息技术有限责任公司 一种轻量级资源虚拟化与分配方法
CN111432006B (zh) * 2020-03-30 2023-03-31 中科九度(北京)空间信息技术有限责任公司 一种轻量级资源虚拟化与分配方法
CN112631737A (zh) * 2021-01-08 2021-04-09 重庆紫光华山智安科技有限公司 容器镜像构建方法、装置、电子设备及存储介质
CN112631737B (zh) * 2021-01-08 2023-11-17 重庆紫光华山智安科技有限公司 容器镜像构建方法、装置、电子设备及存储介质

Also Published As

Publication number Publication date
CN105511943B (zh) 2019-04-12
EP3324291B1 (en) 2020-08-12
US20180196654A1 (en) 2018-07-12
US10579355B2 (en) 2020-03-03
EP3324291A1 (en) 2018-05-23
CN105511943A (zh) 2016-04-20
EP3324291A4 (en) 2018-09-26

Similar Documents

Publication Publication Date Title
WO2017092672A1 (zh) 一种Docker容器运行方法和装置
US10740132B2 (en) Systems and methods for updating containers
US9983891B1 (en) Systems and methods for distributing configuration templates with application containers
CN107066242B (zh) 确定软件容器中软件的标识的方法和系统
US9047160B2 (en) Designing and building virtual images using semantically rich composable software image bundles
US10698733B1 (en) Integrated system to distribute and execute complex applications
US11403146B2 (en) Method, apparatus, and server for managing image across cloud servers
US11016785B2 (en) Method and system for mirror image package preparation and application operation
CN107766130B (zh) 虚拟机向容器迁移的方法和装置
US8583709B2 (en) Detailed inventory discovery on dormant systems
US20230125342A1 (en) Cross-platform application containerized execution
WO2021092502A1 (en) Just-in-time containers
CN104182257A (zh) 应用软件的安装方法和应用软件的安装装置
Stewart SkiffOS: Minimal cross-compiled linux for embedded containers
US20110219365A1 (en) High and low value application state
CN114265595A (zh) 一种基于智能合约的云原生应用开发与部署系统和方法
Lubin VM2Docker: automating the conversion from virtual machine to docker container
CN107229506B (zh) 一种虚拟机迁移方法及装置
Muzumdar et al. Navigating the Docker Ecosystem: A Comprehensive Taxonomy and Survey
US20240061666A1 (en) Automatically deploying a development environment on a target system
US11915007B2 (en) CI/CD pipeline to container conversion
US10990357B2 (en) Application build automation
Iovanov et al. Containerizing Solution for a Highly Distributed Systems
EP4323867A1 (en) Intelligent device extension for building software applications
Kaaretkoski Isolating software development environments

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 16869982

Country of ref document: EP

Kind code of ref document: A1

WWE Wipo information: entry into national phase

Ref document number: 2016869982

Country of ref document: EP

NENP Non-entry into the national phase

Ref country code: DE