CN116483514A - Container starting method and device, electronic equipment and storage medium - Google Patents

Container starting method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN116483514A
CN116483514A CN202310445491.XA CN202310445491A CN116483514A CN 116483514 A CN116483514 A CN 116483514A CN 202310445491 A CN202310445491 A CN 202310445491A CN 116483514 A CN116483514 A CN 116483514A
Authority
CN
China
Prior art keywords
container
starting
virtual machine
program
mounting
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310445491.XA
Other languages
Chinese (zh)
Inventor
赵吉壮
刘晨
李志明
吴晨
王剑
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Youzhuju Network Technology Co Ltd
Original Assignee
Beijing Youzhuju Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Youzhuju Network Technology Co Ltd filed Critical Beijing Youzhuju Network Technology Co Ltd
Priority to CN202310445491.XA priority Critical patent/CN116483514A/en
Publication of CN116483514A publication Critical patent/CN116483514A/en
Pending legal-status Critical Current

Links

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
    • 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
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

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

Abstract

The disclosure discloses a container starting method, a container starting device, electronic equipment and a storage medium. Comprising the following steps: responding to a pre-acquired container starting instruction, and mounting a pre-created container mirror image starting program to a virtual machine in a target container group; detecting the current state of the virtual machine, and creating a container identification file of the target container group when the current state is a starting state; hot-inserting the container identification file into the virtual machine and mounting the container identification file into a designated directory of the virtual machine; and carrying out joint mounting on the appointed catalogue and the container mirror image starting program in the virtual machine to obtain a first starting program, and running the first starting program to finish the container starting operation. According to the method and the device, the container mirror image starting program is used as a read-only layer, the appointed directory loaded with the container identification file is used as a writable layer, and the read-write layer separation of the container starting program is realized. Meanwhile, by means of combined mounting, the problem of poor performance of the Overlay FS+virtio-FS as a container starting program read-write layer is solved.

Description

Container starting method and device, electronic equipment and storage medium
Technical Field
The disclosure relates to the field of computer technology, and in particular, to a container starting method, a container starting device, electronic equipment and a storage medium.
Background
At present, a container mirror image starting program in Kata shares a container mirror image starting program on a host machine to a virtual machine through a virtual-fs (shared file system), file reading and writing in a Kata container are all carried out on the host machine through a virtual-fs forwarding fuse request, and when the container is restarted based on the method, the following problems exist in the starting process: the Virtio-fs file system has poor read-write performance. Meanwhile, the container is stateless, and after the container is restarted, the content in the writable layer of the container can be lost.
Disclosure of Invention
In order to solve the technical problems described above or at least partially solve the technical problems described above, the present disclosure provides a container starting method, a device, an electronic apparatus, and a storage medium.
According to one aspect of the disclosed embodiments, there is provided a container starting method, the method comprising:
responding to a pre-acquired container starting instruction, and mounting a pre-created container mirror image starting program to a virtual machine in a target container group;
detecting the current state of the virtual machine, and creating a container identification file of the target container group under the condition that the current state is a starting state;
hot-inserting the container identification file into the virtual machine and mounting the container identification file into a designated directory of the virtual machine;
and in the virtual machine, carrying out joint mounting on the appointed directory and the container mirror image starting program to obtain a first starting program, and running the first starting program to finish the container starting operation.
According to another aspect of the embodiments of the present disclosure, there is also provided a container starting apparatus including:
the response module is used for responding to the pre-acquired container starting instruction and mounting a pre-created container mirror image starting program to the virtual machine in the target container group;
the detection module is used for detecting the current state of the virtual machine and creating a container identification file of the target container group under the condition that the current state is a starting state;
the processing module is used for hot-inserting the container identification file into the virtual machine and mounting the container identification file into a designated directory of the virtual machine;
and the execution module is used for carrying out joint mounting on the appointed directory and the container mirror image starting program in the virtual machine to obtain a first starting program, and running the first starting program to finish the container starting operation.
According to another aspect of the embodiments of the present disclosure, there is also provided a storage medium including a stored program that performs the steps described above when running.
According to another aspect of the embodiments of the present disclosure, there is also provided an electronic device including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory complete communication with each other through the communication bus; wherein: a memory for storing a computer program; and a processor for executing the steps of the method by running a program stored on the memory.
The disclosed embodiments also provide a computer program product comprising instructions which, when run on a computer, cause the computer to perform the steps of the above method.
The technical scheme provided by the embodiment of the disclosure has the following advantages: according to the method provided by the embodiment of the application, the container mirror image starting program is used as a read-only layer, the appointed directory loaded with the container identification file is used as a writable layer, and the read-write layer separation of the container starting program is realized. Meanwhile, a read-only layer and a writable layer are combined and mounted in the virtual machine, so that the problem that the performance of taking the Overlay FS+virtio-FS as a container starting program read-write layer in the prior art is poor is solved. In addition, the sub-directory of the block device is used as a writable layer to store the content of the writable layer of the container, and the condition of content loss does not occur.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the disclosure and together with the description, serve to explain the principles of the disclosure.
In order to more clearly illustrate the embodiments of the present disclosure or the solutions in the prior art, the drawings that are required for the description of the embodiments or the prior art will be briefly described below, and it will be obvious to those skilled in the art that other drawings can be obtained from these drawings without inventive effort.
FIG. 1 is a schematic diagram of a Kata native container start-up process provided by an embodiment of the present disclosure;
FIG. 2 is a schematic diagram of the working principle of Virtio-fs provided by an embodiment of the present disclosure;
FIG. 3 is a flow chart of a method for starting a container according to an embodiment of the present disclosure;
FIG. 4 is a flow chart of a method for starting a container according to another embodiment of the present disclosure;
FIG. 5 is a block diagram of a container starting device provided by an embodiment of the present disclosure;
fig. 6 is a schematic structural diagram of an electronic device according to an embodiment of the disclosure.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present disclosure more apparent, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present disclosure, and it is apparent that the described embodiments are some embodiments of the present disclosure, but not all embodiments, the exemplary embodiments of the present disclosure and the descriptions thereof are used to explain the present disclosure and do not constitute undue limitations on the present disclosure. All other embodiments, which can be made by one of ordinary skill in the art without undue burden from the disclosure, are within the scope of the disclosure.
It should be noted that in this document, relational terms such as "first" and "second" and the like are used solely to distinguish one entity or action from another similar entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises an element.
Fig. 1 is a process for implementing the container startup of the existing Kata native system provided in the embodiment of the present application, as shown in fig. 1, in which Kata needs to provide a container mirror image startup procedure (container mirror image root FS) for a container in a virtual machine, and the specific implementation process is that after a file system on a host machine is stacked through an Overlay FS, the file system is transmitted to a container corresponding to the virtual machine through Vrtio-FS, and is used as a read-write layer of the container.
It should be noted that the Overlay FS is a federated file system, and the contents of multiple directories may be overlaid on another directory. The Overlay FS does not directly relate to the disk space structure, and appears to merge files of multiple directories into the same directory according to rules, and there is no requirement for specific use of file system types for multiple source directories, and even if the file system types of the source directories are different, the use is not affected. By using the Overlay FS, the read-only bottom file system and the read-write upper file system can be combined, and the finally presented file system not only meets the read-write requirement, but also ensures the data security.
As shown in FIG. 2, virtio-fs communicates between host and gust using the FUSE protocol. A FUSE server is implemented at the host end to operate the file on host, then the FUSE is mounted in the guest by taking the guest kernel as a FUSE client, and a virtual is used between the server and the client to carry the FUSE protocol instead of the traditional structural/dev/FUSE device.
Based on the above, the container mirror image starting program in Kata shares the container mirror image starting program on the host machine into the container in the virtual machine through Virtio-fs, and the file read-write of the container mirror image starting program is all transmitted to the host machine through Virtio-fs, so that the following problems exist in the actual use process: compared with a file system based on block equipment, the file system based on Virtio-fs has poor read-write performance. Meanwhile, the container is stateless, and after the container is restarted, the content in the writable layer of the container can be lost.
Based on the above, the embodiment of the disclosure provides a container starting method, a container starting device, electronic equipment and a storage medium. The method provided by the embodiment of the disclosure can be applied to any needed electronic device, for example, the method can be used as a server, a terminal and other electronic devices, is not particularly limited herein, and is convenient to describe and is hereinafter simply referred to as the electronic device.
According to an aspect of the disclosed embodiments, a method embodiment of a container start-up method is provided. Fig. 3 is a flowchart of a method for starting a container according to an embodiment of the disclosure, as shown in fig. 3, where the method includes:
step S11, in response to a pre-acquired container starting instruction, a pre-created container mirror starting program is mounted to the virtual machines in the target container group.
The method provided by the embodiment of the application is applied to a container background resident program (Containerd), and the container background resident program can receive a container starting instruction issued by a container cluster through a CRI interface. Specifically, when a target container group in the container cluster needs to be started, the container background resident program needs to acquire a container image starting program (container image rootfs) and mount a container identification file locally, and finally, the container start is realized through combined mounting of the container image starting program and the container identification file, wherein the target container group is any container group (Pod) in the container cluster.
Specifically, in response to a pre-acquired container startup instruction, a pre-created container image startup program is mounted to a virtual machine in a target container group, including the following steps A1-A3:
and A1, acquiring a container starting instruction.
In the embodiment of the application, when the container cluster starts the target container group through CRI, the container background resident program obtains a container starting instruction issued by the container cluster.
And step A2, responding to the container starting instruction, and acquiring a pre-created container mirror image starting program.
And step A3, mounting the container mirror image starting program to the virtual machine.
In an embodiment of the present application, the container background resident program obtains a container image startup program created in advance using Overlay snapshotter in response to a container startup instruction. The container background resident program transmits the container image starting program to a Virtual Machine (VM) in the target container group through Virtual io-fs, so that the container image starting program is mounted on the Virtual Machine. It will be appreciated that the container background resident program is one implementation of CRI that can interface with various runtimes (e.g., runc, kata) through the shim of the container background resident program and also prepare a launch program (roofts) for launch of the container, which function is implemented by the snapshotter component in the container background resident program.
It should be noted that the container is constructed based on a read-only layer and a writable layer. The embodiment of the application utilizes the container background resident program to mount the container mirror image starting program to the virtual machine, and aims to take the container mirror image starting program as a read-only layer of the container when the container is started.
Step S12, detecting the current state of the virtual machine, and creating a container identification file of the target container group under the condition that the current state is a starting state.
In the embodiment of the application, after the container image startup program is installed on the virtual machine, the container background resident program receives the operation environment creation instruction, and creates the operation environment at the time of container startup, namely, pod Sandbox based on the operation environment creation instruction. In the process, the container background resident program can call the container background resident program Containerd-shim-kata-v2 to start the virtual machine, and then the current state of the virtual machine is detected. And if the current state is the starting state, determining that the virtual machine is started successfully. At this time, the container identification file of the target container group is created, and after the container identification file is successfully created, the successful creation of the running environment is marked.
In an embodiment of the present application, creating a container identification file of a target container group includes the following steps B1-B2:
and step B1, acquiring a preset container identification template file and a container identification corresponding to the target container group.
And step B2, creating a container identification file corresponding to the target container group by using the container identification template file and the container identification.
In this embodiment of the present application, the container background resident program may call the container background resident program-shim-kata-v 2 to copy the container identification template file (template. Qcow2 file) to the local directory/run/kata-containers/sadbox/< sadbox >/< podUid >, qcow2, and it should be noted that, since the container identification template file is a blank file created in advance, after copying to the local directory, it is necessary to obtain the container identification (i.e., pod UID) of the target container group, and update the container identification file with the container identification, i.e., create the container identification file (< podUid >. Qcow2 file) corresponding to the completed target container group.
It should be noted that, writing the container identifier of the target container group into the container identifier template file of the local directory to obtain the container identifier file, and then mounting the container identifier file to the virtual machine specified directory. Therefore, a precondition is provided for the subsequent construction of the container writable layer through the localized container identification file, and meanwhile, the container identification file can be mounted to a designated directory of the virtual machine subsequently, so that separation of the read-only layer and the writable layer can be realized.
Step S13, the container identification file is hot-plugged into the virtual machine and is mounted to a designated directory of the virtual machine.
In an embodiment of the present application, after creating the container identification file of the target container group, the method further includes the following steps C1-C3:
and C1, acquiring the number of containers in the container group and the container identification of each container.
In this embodiment of the present application, after the container identifier file is deployed in the virtual machine, a subdirectory corresponding to each container in the target container group needs to be created in the virtual machine. Specifically, the number of containers in the target Container group and the Container identifier (Container name) of each Container are first obtained.
And C2, under the appointed directory of the virtual machine, creating the initial subdirectories with the same quantity as the containers.
In the embodiment of the application, in order to realize the starting of each container in the target container group, the number of the containers is required to be ensured to be consistent with that of the subdirectories, and based on the starting, the initial subdirectories with the same number as that of the containers in the target container group are created under a specified directory, so that the container identification files hung on the target container group under each subdirectory are convenient to follow.
And step C3, updating the directory name of the initial subdirectory by using the container identifier to obtain the subdirectory.
In the embodiment of the present application, after the initial subdirectories are created, a one-to-one correspondence between each initial subdirectory and the container needs to be established. At this time, the container identifier may be used as a directory name of the initial subdirectory, so as to obtain a subdirectory corresponding to each container in the target container group.
It should be noted that, the sub-directories are created by using the container identification and the number of containers, and on one hand, the sub-directories are associated with the containers one by one. On the other hand, the method is convenient for carrying out joint mounting by the sub-directory and the container mirror image starting program in the virtual machine, and realizes the read-write separation of the container.
In this embodiment of the present application, hot-inserting a container identification file into a virtual machine, and mounting the container identification file into a specified directory of the virtual machine includes: the container identification file is hot plugged (hot plug) to the virtual machine through a preset protocol (virtio-blk protocol) and displayed as a block device under the virtual machine. At this time, the kata-agent component in the virtual machine formats the block device, and sequentially mounts the formatted block device to each sub-directory in the specified directory.
It should be noted that, by mounting the block devices to each subdirectory in the designated directory in sequence, so that the capability of the writable layer is improved by using the subdirectory on which the block device is mounted as the writable layer, and the persistence of the block device file (i.e. the persistence of the writable layer of the container) in the virtual machine is realized, even if the container is restarted, the content of the writable layer can be ensured not to be lost.
Step S14, in the virtual machine, the appointed catalogue and the container mirror image starting program are jointly mounted to obtain a first starting program, and the first starting program is operated to complete the starting operation of the container.
In this embodiment of the present application, the joint mounting is performed on the specified directory and the container image startup procedure, to obtain a first startup procedure, including: acquiring a combined mounting instruction; and responding to the combined mounting instruction, and carrying out combined mounting on the subdirectory on which the block equipment is mounted and the container mirror image starting program to obtain a first starting program, wherein the container mirror image starting program in the first starting program is used as a read-only layer, and the subdirectory is used as a writable layer.
In the embodiment of the application, after the container identification file is mounted to the subdirectory under the appointed directory in the virtual machine, the joint mounting mechanism is triggered to take effect, and at the moment, the joint mounting instruction can be obtained. After responding to the combined mounting instruction, taking the container mirror image starting program as a read-only layer of the container starting program, and taking the subdirectory loaded with the container identification file as a writable layer of the container starting program, thereby obtaining a first starting program. At this time, a first starting program is run in the virtual machine, and then the starting of the container in the target container group can be completed.
According to the method provided by the embodiment of the application, the container mirror image starting program realized by using the Overlay FS+Virtio-FS is used as a read-only layer, the subdirectory loaded with the block equipment is used as a writable layer, and the read-write layer separation of the container starting program is realized. Meanwhile, the read-only layer and the writable layer are jointly mounted in the virtual machine through the Overlay, so that the problem of poor performance of the Overlay FS+virtio-FS as a container starting program read-write layer in the prior art is solved. In addition, the sub-directory of the block device is used as a writable layer to store the content of the writable layer of the container, and the condition of content loss does not occur.
Fig. 4 is a flowchart of a method for starting a container according to an embodiment of the disclosure, where, as shown in fig. 4, the method further includes:
step S21, acquire a container restart instruction.
In the embodiment of the application, under the condition that a restart occurs to one container in the target container group, the container background resident program detects that a container restart event occurs, and generates a container restart instruction based on the container restart event.
Step S22, responding Rong Qichong start-up instructions, deleting a first start-up program in the virtual machine, taking the container mirror image start-up program as a read-only layer, and carrying out joint mounting by taking the subdirectory as a writable layer to obtain a second start-up program.
In the embodiment of the application, the container background resident program responds to the container restarting instruction, and deletes the first starting program existing in the virtual machine of the target container group. It should be noted that, after the container is restarted, the read-only layer will change, so that the first startup procedure existing at present needs to be deleted, then the joint mount operation is re-executed, specifically, the container mirror startup procedure is taken as the read-only layer, and the subdirectory on which the block device is mounted is taken as the writable layer, so as to obtain the second startup procedure. And finally, the second starting program is operated to finish the restarting operation of the container, and the writable layer after restarting is unchanged.
In step S23, the second start-up procedure is executed to complete the capacitor restarting operation.
In the embodiment of the application, the container background resident program directly runs the second starting program to finish the container starting operation, so that the content in the corresponding writable layer of the container cannot be lost after the container is restarted.
According to the method provided by the embodiment of the application, the block equipment is used for storing the content of the writable layer of the container, after the container is restarted, the content of the read-only layer is replaced, and the read-only layer and the writable layer are subjected to joint mounting again in the virtual machine through the overlay, so that the purpose that the writable layer cannot be lost under the condition that the container is restarted is achieved.
According to an aspect of the disclosed embodiments, a method embodiment of a container start-up method is provided. The implementation process is as follows:
step (1), using overlay snapshotter, creating a container mirror startup procedure and transmitting to the virtual machines in the target container group through Virtio-fs as a read-only layer of the container startup procedure.
And (2) copying a container identification template file (template. Qcow2) after the virtual machine is started, and creating a container identification file corresponding to the target container group (< PodUid >. Qcow2).
And (3) connecting the Containerd-shim-kata-v2 with a hypervisor interface through a qmp interface, and hot-inserting a container identification file (< PodUid >. Qcow 2) into the virtual machine to display the container identification file as a block device.
And (4) formatting and mounting the block device of the hot plug in step (3) to a specified directory by the kata-agent in the virtual machine, and creating a sub-directory by taking the container identifier in the target container group as a name.
And (5) taking the container mirror image starting program in the virtual machine as a read-only layer, taking the subdirectories in the step (4) as a writable layer, and jointly mounting an Overlay FS through an Overlay to serve as a final container starting program of the container.
Step (6), when the container is restarted, executing step (5), wherein the container identification file (< PodUid >. Qcow 2) is persisted in the virtual machine, so that the content in the container is not affected by the restarting, namely, the persisting capability of the writable layer of the container is achieved.
Fig. 5 is a block diagram of a container starting apparatus according to an embodiment of the present disclosure, where the apparatus may be implemented as part or all of an electronic device by software, hardware, or a combination of both. As shown in fig. 5, the apparatus includes:
the response module 51 is configured to respond to a container startup instruction acquired in advance, and mount a container mirror startup program created in advance to a virtual machine in the target container group;
the detection module 52 is configured to detect a current state of the virtual machine, and create a container identification file of the target container group if the current state is a startup state;
the processing module 53 is configured to hot plug the container identification file into the virtual machine and mount the container identification file into a specified directory of the virtual machine;
and the execution module 54 is configured to jointly mount the specified directory and the container image startup program in the virtual machine, obtain a first startup program, and run the first startup program to complete the container startup operation.
In the embodiment of the present application, the response module 51 is configured to obtain a container start instruction; responding to a container starting instruction, and acquiring a pre-created container mirror image starting program; and mounting the container mirror image starting program to the virtual machine.
In this embodiment of the present application, the detection module 52 is configured to obtain a preset container identifier template file and a container identifier corresponding to the target container group; and creating a container identification file corresponding to the target container group by using the container identification template file and the container identification.
In an embodiment of the present application, the container starting device further includes: the creation module is used for obtaining the number of containers in the target container group and the container identification of each container; creating initial subdirectories with the same quantity as the quantity of the containers under the appointed directory of the virtual machine; and updating the directory name of the initial subdirectory by using the container identifier to obtain the subdirectory.
In this embodiment of the present application, the processing module 53 is configured to hot plug the container identification file into the virtual machine through a preset protocol, and display the container identification file as a block device under the virtual machine; the block devices are mounted in turn to respective subdirectories in the designated directory.
In the embodiment of the present application, the execution module 54 is configured to obtain a joint mount instruction; and responding to the combined mounting instruction, and carrying out combined mounting on the subdirectory on which the block equipment is mounted and the container mirror image starting program to obtain a first starting program, wherein the container mirror image starting program in the first starting program is used as a read-only layer, and the subdirectory is used as a writable layer.
In an embodiment of the present application, the container starting device further includes: the restarting module is used for acquiring a container restarting instruction; responding to Rong Qichong start instructions, deleting a first start program in the virtual machine, taking a container mirror image start program as a read-only layer, and carrying out joint mounting on a subdirectory as a writable layer to obtain a second start program; and running a second starting program to finish the restarting operation of the container.
The embodiment of the disclosure also provides an electronic device, as shown in fig. 6, the electronic device may include: the device comprises a processor 1501, a communication interface 1502, a memory 1503 and a communication bus 1504, wherein the processor 1501, the communication interface 1502 and the memory 1503 are in communication with each other through the communication bus 1504.
A memory 1503 for storing a computer program;
the processor 1501, when executing the computer program stored in the memory 1503, implements the steps of the above embodiments.
The communication bus mentioned by the above terminal may be a peripheral component interconnect standard (Peripheral Component Interconnect, abbreviated as PCI) bus or an extended industry standard architecture (Extended Industry Standard Architecture, abbreviated as EISA) bus, etc. The communication bus may be classified as an address bus, a data bus, a control bus, or the like. For ease of illustration, the figures are shown with only one bold line, but not with only one bus or one type of bus.
The communication interface is used for communication between the terminal and other devices.
The memory may include random access memory (Random Access Memory, RAM) or non-volatile memory (non-volatile memory), such as at least one disk memory. Optionally, the memory may also be at least one memory device located remotely from the aforementioned processor.
The processor may be a general-purpose processor, including a central processing unit (Central Processing Unit, CPU for short), a network processor (Network Processor, NP for short), etc.; but also digital signal processors (Digital Signal Processing, DSP for short), application specific integrated circuits (Application Specific Integrated Circuit, ASIC for short), field-programmable gate arrays (Field-Programmable Gate Array, FPGA for short) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
In yet another embodiment provided by the present disclosure, there is also provided a computer-readable storage medium having instructions stored therein that, when run on a computer, cause the computer to perform the container starting method of any one of the above embodiments.
In yet another embodiment provided by the present disclosure, there is also provided a computer program product containing instructions that, when run on a computer, cause the computer to perform the container starting method of any one of the above embodiments.
In the above embodiments, it may be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, produces a flow or function in accordance with embodiments of the present disclosure, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a computer network, or other programmable apparatus. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center by a wired (e.g., coaxial cable, fiber optic, digital subscriber line), or wireless (e.g., infrared, wireless, microwave, etc.). The computer readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. that contains an integration of one or more available media. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid State Disk), etc.
The foregoing description is only of the preferred embodiments of the present disclosure, and is not intended to limit the scope of the present disclosure. Any modification, equivalent replacement, improvement, etc. made within the spirit and principles of the present disclosure are included in the protection scope of the present disclosure.
The foregoing is merely a specific embodiment of the disclosure to enable one skilled in the art to understand or practice the disclosure. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the disclosure. Thus, the present disclosure is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (10)

1. A method of starting a container, the method comprising:
responding to a pre-acquired container starting instruction, and mounting a pre-created container mirror image starting program to a virtual machine in a target container group;
detecting the current state of the virtual machine, and creating a container identification file of the target container group under the condition that the current state is a starting state;
hot-plugging the container identification file into the virtual machine and mounting the container identification file into a designated directory of the virtual machine;
and in the virtual machine, carrying out joint mounting on the appointed directory and the container mirror image starting program to obtain a first starting program, and running the first starting program to finish the container starting operation.
2. The method of claim 1, wherein the mounting the pre-created container image boot program to the virtual machines within the target set of containers in response to the pre-acquired container boot instructions comprises:
acquiring a container starting instruction;
responding to the container starting instruction, and acquiring a pre-created container mirror image starting program;
and mounting the container mirror image starting program to the virtual machine.
3. The method of claim 1, wherein creating the container identification file for the target set of containers comprises:
acquiring a preset container identification template file and a container identification corresponding to the target container group;
and creating a container identification file corresponding to the target container group by using the container identification template file and the container identification.
4. The method of claim 1, wherein after creating the container identification file for the target set of containers, the method further comprises:
acquiring the number of containers in the target container group and the container identification of each container;
creating initial subdirectories with the same quantity as the containers under the appointed directory of the virtual machine;
and updating the directory name of the initial subdirectory by using the container identifier to obtain the subdirectory.
5. The method of claim 4, wherein the hot-inserting the container identification file into the virtual machine and mounting the container identification file to a specified directory of the virtual machine comprises:
hot-inserting the container identification file into the virtual machine through a preset protocol, and displaying the container identification file as block equipment under the virtual machine;
and mounting the block equipment to each subdirectory in the appointed catalogue in turn.
6. The method of claim 5, wherein the jointly mounting the specified directory and the container image startup procedure to obtain a first startup procedure comprises:
acquiring a combined mounting instruction;
and responding to the combined mounting instruction, and carrying out combined mounting on the subdirectory on which the block equipment is mounted and the container mirror image starting program to obtain a first starting program, wherein the container mirror image starting program in the first starting program is used as a read-only layer, and the subdirectory is used as a writable layer.
7. The method according to claim 1, wherein the method further comprises:
acquiring a container restarting instruction;
responding to the container restarting instruction, deleting a first starting program in the virtual machine, taking the container mirror image starting program as a read-only layer, and carrying out joint mounting by taking the subdirectory as a writable layer to obtain a second starting program;
and operating the second starting program to finish the restarting operation of the container.
8. A container starting device, comprising:
the response module is used for responding to the pre-acquired container starting instruction and mounting a pre-created container mirror image starting program to the virtual machine in the target container group;
the detection module is used for detecting the current state of the virtual machine and creating a container identification file of the target container group under the condition that the current state is a starting state;
the processing module is used for hot-inserting the container identification file into the virtual machine and mounting the container identification file into a designated directory of the virtual machine;
and the execution module is used for carrying out joint mounting on the appointed directory and the container mirror image starting program in the virtual machine to obtain a first starting program, and running the first starting program to finish the container starting operation.
9. A storage medium comprising a stored program, wherein the program when run performs the method steps of any of the preceding claims 1 to 7.
10. The electronic equipment is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory are communicated with each other through the communication bus; wherein:
a memory for storing a computer program;
a processor for executing the method steps of any one of claims 1 to 7 by running a program stored on a memory.
CN202310445491.XA 2023-04-23 2023-04-23 Container starting method and device, electronic equipment and storage medium Pending CN116483514A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310445491.XA CN116483514A (en) 2023-04-23 2023-04-23 Container starting method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310445491.XA CN116483514A (en) 2023-04-23 2023-04-23 Container starting method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN116483514A true CN116483514A (en) 2023-07-25

Family

ID=87215092

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310445491.XA Pending CN116483514A (en) 2023-04-23 2023-04-23 Container starting method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116483514A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117931096A (en) * 2024-03-21 2024-04-26 北京火山引擎科技有限公司 Information providing method and device applied to servers of edge computing cluster
CN117931097A (en) * 2024-03-21 2024-04-26 北京火山引擎科技有限公司 Information providing method and device applied to servers of edge computing cluster

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117931096A (en) * 2024-03-21 2024-04-26 北京火山引擎科技有限公司 Information providing method and device applied to servers of edge computing cluster
CN117931097A (en) * 2024-03-21 2024-04-26 北京火山引擎科技有限公司 Information providing method and device applied to servers of edge computing cluster
CN117931097B (en) * 2024-03-21 2024-06-21 北京火山引擎科技有限公司 Information providing method and device applied to servers of edge computing cluster

Similar Documents

Publication Publication Date Title
CN116483514A (en) Container starting method and device, electronic equipment and storage medium
US9465625B2 (en) Provisioning of operating environments on a server in a networked environment
US10242023B2 (en) Programming model for synchronizing browser caches across devices and web services
CN111782339B (en) Container creation method and device, electronic equipment and storage medium
US8898167B2 (en) Method of accessing files in electronic devices
US9733919B2 (en) Updating web resources
US20030195951A1 (en) Method and system to dynamically detect, download and install drivers from an online service
US20230393840A1 (en) File update method and apparatus, device and storage medium
US8745610B2 (en) Maintenance system, maintenance method and program for maintenance
US20170052854A1 (en) Method and system for performing automatic system recovery
CN109684282B (en) Method and device for constructing metadata cache
JP5821393B2 (en) Information processing apparatus, activation method, program
US11140291B2 (en) Information processing apparatus, control method thereof, and storage medium
JP4759941B2 (en) Boot image providing system and method, boot node device, boot server device, and program
CN116339756A (en) Application program mounting method, device, equipment and storage medium
JP2011248658A (en) Virtual server deployment management apparatus and method, and program for the same
CN111459619A (en) Method and device for realizing service based on cloud platform
CN115878195A (en) Operating system batch deployment method and device, computer equipment and storage medium
CN114020340A (en) Server system and data processing method thereof
US9971607B1 (en) Method of accessing files in electronic devices
CN111880818A (en) Installation method, system and device of virtual machine operating system
CN114866517A (en) Installation file execution method and device and storage medium
US9940334B2 (en) Image forming apparatus and control method thereof
JP2006164095A (en) Disk system
CN115993979A (en) Configuration conversion method, smooth upgrading method, device, equipment and storage medium

Legal Events

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