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

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

Info

Publication number
CN118276960A
CN118276960A CN202211723950.8A CN202211723950A CN118276960A CN 118276960 A CN118276960 A CN 118276960A CN 202211723950 A CN202211723950 A CN 202211723950A CN 118276960 A CN118276960 A CN 118276960A
Authority
CN
China
Prior art keywords
content
executor
container
request
starting
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
CN202211723950.8A
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 Gridsum Technology Co Ltd
Original Assignee
Beijing Gridsum Technology Co Ltd
Filing date
Publication date
Application filed by Beijing Gridsum Technology Co Ltd filed Critical Beijing Gridsum Technology Co Ltd
Publication of CN118276960A publication Critical patent/CN118276960A/en
Pending legal-status Critical Current

Links

Abstract

The embodiment of the invention provides a method and a device for starting a Container, a storage medium and electronic equipment, and belongs to the technical field of resource scheduling. Acquiring a start Container request; generating a content attribute file according to the start content request; and finally, calling a content executor to perform environment preparation according to the content attribute file, and starting the content through the content executor after the environment preparation is completed. When the Yarn starts the user program, the Yarn does not need to be executed through a temporary script file, and is prevented from being limited by a secret environment, so that the Yarn can normally operate in the secret environment.

Description

Container starting method and device, storage medium and electronic equipment
Technical Field
The present invention relates to the field of resource scheduling technologies, and in particular, to a content startup method, a content startup device, a computer readable storage medium, and an electronic apparatus.
Background
YARN is referred to as Apache Hadoop YARN herein, is a Hadoop resource manager, is a universal resource management system, can provide unified resource management and scheduling for upper-layer applications, and has great benefits in aspects of utilization rate, unified resource management, data sharing and the like for clusters.
The basic idea of YARN is to split the functions of resource management and job scheduling/monitoring into separate daemons. The idea is to have a global ResourceManager (RM) and ApplicationMaster (AM) for each application. The application may be a single task or a Directed Acyclic Graph (DAG) made up of multiple tasks.
ResourceManager and NodeManager form a data computing framework. ResourceMana ger is the ultimate authority to arbitrate resources among all applications in the system. NodeManager is a framework agent for each machine, responsible for containers, monitoring their resource usage, such as: cpu, memory, disk, network, and report it to ResourceManager/Scheduler. ApplicationMaster of each application is effectively a framework-specific library whose tasks are negotiating resources from ResourceM anager and performing and monitoring tasks with NodeManager(s).
Essentially, content is a resource allocation that grants an application the right to use a certain amount of resources (memory, cpu, etc.) on a particular host. When attempting to run an application on YARN, nodeManger receives a request to start the content, which the NodeManager will start based on the information in the request.
In the prior art, when the node manager starts the Container, the information in the request is written into a temporary script file named as a launch_container. Executing the script file may complete the setup of the preparation job (including setting environment variables, preparing resources, etc.) and initiate the Container. In addition, to achieve the limitation of system resources used by the Container, node Manger does not directly execute the launch_container. Sh, but completes Contianer the startup by calling a separate program Co ntainer executor. The content executor sets the resource limit by CGroup technique based on the available system resources to the content given by NodeManger. The context executor then executes the launch_container.sh startup Contia ner in a manner that creates a sub-process, and feeds back the startup result to the NodeManager.
By adopting the prior art starting Contianer, the device can normally operate in a standard Linux environment. However, in the confidential environment, all the script files generated temporarily cannot be given execution authority, that is, the content cannot be started up finally through the launch_container.
Disclosure of Invention
The invention aims to provide a content starting method, a content starting device, a machine-readable storage medium and electronic equipment, wherein the content starting method can enable Yarn to start a user program without being executed through a temporary script file, and avoid being limited by a secret-related environment, so that the Yarn can normally operate in the secret-related environment.
In order to achieve the above object, a first aspect of the present application provides a content starting method, including:
Acquiring a start Container request;
generating a content attribute file according to the start content request;
And calling a content executor to perform environment preparation according to the content attribute file, so that the content executor starts the content after the environment preparation is completed.
In an embodiment of the present application, the method includes:
After the content attribute file is generated, a start-up content notification is generated, and the start-up content notification is sent to a content executor, so that the content executor performs environment preparation according to the content attribute file after receiving the start-up content notification.
In the embodiment of the present application, after receiving the start content notification, the content executor performs environmental preparation according to the content attribute file, including:
after receiving the start-up content notification, the content executor reads and parses the content attribute file to obtain relevant information of the start-up content;
Acquiring Contianer credential files;
Creating a child process and terminating a parent process; the parent process is a process for notifying a content executor, and the child process is a process for starting the content;
Setting a resource limit by adopting CGroup technology according to the start content request;
Creating a content operation catalog according to the related information of the start content, contianer credential files and a start content request, and preparing files in the content operation;
Setting the user identity as a starting content user;
setting an environment variable according to the related information of the starting Container;
And performing parameter splicing according to the related information of the start-up Container, contianer credential files and the start-up Container request to obtain start-up parameters so as to finish environmental preparation.
In the embodiment of the present application, the context executor starts the context after the context preparation is completed, including:
And the content executor executes exec function to start the content according to the starting parameter after the environment preparation is completed.
In the embodiment of the application, the content executor switches the valid user to set the authority by calling seteuid a method in the process of preparing the file in the content operation.
The second aspect of the present application provides a method for starting a content, including:
Acquiring a start Container request;
Generating a content attribute file according to a start content request, wherein the content attribute file is a temporary script file;
And reading the temporary script file through a content executor and executing commands in the temporary script file row by row to start the content.
A third aspect of the present application provides a Container starting apparatus, including:
the first acquisition module is used for acquiring a start content request;
The first generation module is used for generating a content attribute file according to the start content request;
And the first starting module is used for calling the content executor to perform environment preparation according to the content attribute file so that the content executor starts the content after the environment preparation is completed.
A fourth aspect of the present application provides a Container starting apparatus, including:
the second acquisition module is used for acquiring a start content request;
The second generation module is used for generating a content attribute file according to the starting content request, wherein the content attribute file is a temporary script file;
And the second starting module is used for reading the temporary script file through a content executor and executing the temporary script file row by row so as to start the content.
A fifth aspect of the present application provides an electronic device comprising at least one processor, and at least one memory, bus, coupled to the processor; the processor and the memory complete communication with each other through a bus; the processor is configured to invoke program instructions in the memory to perform any of the above-described Container startup methods of the present application.
A sixth aspect of the present application provides a machine-readable storage medium having stored thereon instructions for causing a machine to perform any of the above-described Container start-up methods of the present application.
Through the technical scheme, the starting content request is obtained; generating a content attribute file according to the start content request; and finally, invoking Con tainer an executor according to the content attribute file to prepare the environment, and starting the content through the content executor after the environment preparation is completed. Compared with the original scheme, in the process that the NodeManager receives the notification and prepares to start Co ntainer, the method does not generate a laboratory_container.sh script, outputs information related to the start of the Container to the Container attribute file, starts the modified Container executor again, reads the file to obtain the information related to the Container, and starts the Container after the preparation work is completed. Therefore, part of responsibilities in NodeManager and all of the work in the launch_container are transferred to the content executor, so that when the user program is started, the Yarn does not need to be executed through a temporary script file, and the Yarn is prevented from being limited by a secret environment, and can normally operate in the secret environment.
According to the technical scheme, the starting content request is obtained, the content attribute file is generated according to the starting content request, the content attribute file is a temporary script file, and the temporary script file is read by a content executor and executed row by row so as to start the content. The link of executing the countdown_container.sh by the subprocess in the original scheme is replaced, the complete countdown_container.sh content is read instead, and then the subprocess progressive execution content is created, so that the user program is prevented from being started by executing the dynamically generated script, and the Yarn is ensured to normally run in the secret-related environment. In comparison, the scheme in the embodiment furthest reserves the responsibilities of the NodeManger and Contai ner executors, and has good compatibility and easy transformation.
Additional features and advantages of embodiments of the invention will be set forth in the detailed description which follows.
Drawings
The accompanying drawings are included to provide a further understanding of embodiments of the invention and are incorporated in and constitute a part of this specification, illustrate embodiments of the invention and together with the description serve to explain, without limitation, the embodiments of the invention. In the drawings:
FIG. 1 schematically illustrates a flowchart of a method for starting a content according to an embodiment of the present application;
FIG. 2 schematically illustrates a main flow diagram of a content start-up according to an embodiment of the present application;
FIG. 3 schematically illustrates another flowchart of a Container startup method according to an embodiment of the present application;
FIG. 4 schematically illustrates a block diagram of a content start device according to an embodiment of the present application;
FIG. 5 schematically illustrates a block diagram of another Container starting apparatus according to an embodiment of the present application;
Fig. 6 schematically shows an internal structural view of an apparatus according to an embodiment of the present application.
Description of the reference numerals
410-A first acquisition module; 420-a first generation module; 430-a first start-up module; 510-a second acquisition module; 520-a second generation module; 530-a second start-up module; 60-equipment; 601-a processor; 602-a memory; 603-bus.
Detailed Description
The following describes the detailed implementation of the embodiments of the present invention with reference to the drawings. It should be understood that the detailed description and specific examples, while indicating and illustrating the invention, are not intended to limit the invention.
Referring to fig. 1, fig. 1 schematically illustrates a flow chart of a content startup method according to an embodiment of the application. The content starting method can be applied to various secret-related environments, such as a secret-related environment, so as to ensure that yarn can normally execute programs in the secret-related environment.
The method for starting the Container provided by the embodiment comprises the following steps:
Step 210: acquiring a start Container request; in this embodiment, the acquiring refers to that when an application program is attempted to run on the YARN, nodeManger receives a request to start Containe r, so as to acquire a start content request. The start-up Container request may be issued by ResourceManager, and the NodeManager will start Contain er based on the start-up Container request.
In this embodiment, the start content request includes the following pieces of information: 1. a program start command running in con tainer; 2. an environmental variable; 3. local resources necessary on the machine before the application is started, such as jar packages, shared objects, auxiliary data files, etc.; 4. safety-related tokens.
Step 220: generating a content attribute file according to the start content request; in this embodiment, the content attribute file is a JSON file, and the information related to the content in the start content request is written into the JSON file to obtain the content attribute file. For example, the information related to the content in the start content request is written into the JSON file, and the JSON file is named as container_properties.
Step 230: and calling a content executor to perform environment preparation according to the content attribute file, so that the content executor starts the content after the environment preparation is completed. In this embodiment, the content executor is a content executor that modifies an execution flow, reads and parses a content attribute file by starting the modified content executor to obtain content related information, completes an environment preparation job, and starts the content. The Cont ainer executor is a separate program that completes Contianer's startup by invoking the Container executor.
After the context attribute file is generated, the node manager notifies the context executor to start the context, and calls the context executor to perform environment preparation according to the context attribute file, and after the environment preparation is completed, the node manager starts Contain er through the context executor, including the following steps:
Firstly, after a content attribute file is generated, generating a start content notification, and sending the start content notification to a content executor; in this embodiment, the start-up content notification is used to notify the content executor of the start-up content.
Then, the content executor performs environment preparation according to the content attribute file after receiving the start content notification;
When NodeManger notifies the content executor to start the content, the content executor performs environment preparation through the following steps:
The first step, the content executor reads the content attribute file and analyzes the content attribute file after receiving the start content notification to obtain relevant information of the start content; in this embodiment, the content attribute file is a JSON file, and the relevant information for starting the content may be obtained by reading and parsing the file. The related information of the startup Container includes an environment variable to be set, a path of a resource file, a startup program path, and the like.
Step two, contianer credential files are obtained; contianer credential files may be obtained by methods known in the art and will not be described in detail herein. The Contianer credential file is used for checking the authority, and may be a file containing a user name and a password.
Thirdly, creating a child process and terminating a parent process; in this embodiment, the parent process refers to a process of notifying the content executor, and the child process refers to a process of starting the content. The Container is started in a manner that implements Contai ner the executor to create a sub-process.
Fourthly, setting resource limitation by adopting CGroup technology according to the starting content request; in this embodiment, the content executor sets the resource limitation by CGroup technology according to the system resources available to the content given by NodeManger, including limiting CPU and memory resource usage by CGroup.
Fifthly, creating a content operation catalog according to the related information of the start content, contianer credential files and the start content request, and preparing files in the content operation; in this embodiment, the content running directory is used to store files generated during the process of executing the program by the content, so as to ensure correct storage of the files. The files required by the preparation Container in operation include resource files, credential files, log files and the like, and the preparation process includes copying copies, creating connections, setting rights and the like.
The process of preparing the file in the content operation includes switching the valid user by calling set euid to set the authority. Because the file preparation operation is performed in the content executor, the effective user can be switched by calling the method seteuid, so that the limit of the secret related system to the shell script switching user is avoided. Such as: the user is a root user, the user does not have permission to start the content, the user can be enabled to obtain permission to start the content through a seteuid method, namely the root user is changed into an effective user, starting Co ntainer by the identity of the root user is achieved, and therefore limitation of the secret-related system to shell script switching users is avoided.
Sixthly, setting the user identity as a starting content user;
Seventh, setting an environment variable according to the related information of the starting Container; in this embodiment, the setting of the environment variable may be directly set as the environment variable in the related information of the startup Container.
And eighth step, performing parameter splicing according to the related information of the start-up Container, contianer credential files and the start-up Container request to obtain start-up parameters so as to complete environmental preparation. The parameter splicing refers to that parameters required by starting the Container are ready and can be spliced in the form of an array to obtain starting parameters.
Finally, after the environment preparation is completed, the content executor starts the content.
After the environment preparation is completed, the content executor executes exec function according to the starting parameter to start the content. The exec function enables another executable program to replace the current process, in the process of executing one process, the data segment, the code segment and the stack segment of the other executable program A replace the data segment, the code segment and the stack segment of the current process B, so that the current process starts to execute the content in the process A, a new process is not created in the process, and the PID is not changed.
After the Container is started, the Container executor obtains a final execution result, namely whether the Container is started successfully or not, and the Container executor feeds the execution result back to the NodeManager.
For example: referring to fig. 2, fig. 2 schematically illustrates a main flow chart of the content start according to an embodiment of the present application. The content executor may be denoted Container Executor, first ResourceManager to notify the NodeManager to start the content, where the NodeManager is notified to begin preparing to start the content. And then the NodeManager writes Co ntainer related information into the file according to the received notification to obtain a content attribute file, wherein the file is in JSON format and can be named as container_properties. Then, the NodeManager notifies Container Exe cutor to start the content, when NodeManger notifies Container Executor to start the content, container Executor reads content related information from the content_properties. Json file, prepares for the environment, and starts the content after the environment preparation is completed, thereby completing the start of Co ntainer.
In the implementation process, a start content request is acquired; generating a content attribute file according to the start content request; and finally, invoking Contai ner an executor according to the content attribute file to prepare the environment, and starting the content through the content executor after the environment preparation is completed. Compared with the original scheme, in the process that the NodeManager receives the notification and prepares to start Cont ainer, the method does not generate a laboratory_container.sh script, outputs information related to the start of the Container to the Container attribute file, starts the modified Container executor again, reads the file to obtain the information related to the Container, and starts the Container after the preparation work is completed. Therefore, part of responsibilities in NodeManager and all of the work in the launch_container are transferred to the content executor, so that when the user program is started, the Yarn does not need to be executed through a temporary script file, and the Yarn is prevented from being limited by a secret environment, and can normally operate in the secret environment. Meanwhile, in the environment preparation process, as the operation is performed in the content executor, the effective user can be switched by calling the method seteuid, so that the limit of the secret related system to the shell script switching user is avoided, and the normal starting of the content is ensured.
In another embodiment, the present embodiment further provides a content startup method, please refer to fig. 3, fig. 3 schematically illustrates a flow chart of another content startup method according to an embodiment of the present application. The content starting method comprises the following steps:
step 310: acquiring a start Container request; as with the step 210 get initiate Container request, nodeManger receives a request to initiate Container when an application is attempted to run on YARN, thereby getting the initiate Container request. The start-up Container request may be issued by ResourceManager, and the NodeManager will start-up the Container according to the start-up Container request.
Step 320: generating a content attribute file according to the start content request, wherein the Co ntainer attribute file is a temporary script file; in this embodiment, the content attribute file is in the form of a flash script, and the information related to the content in the start content request is written into the flash script file to obtain the content attribute file. Such as: and writing the information related to the content in the start content request into a temporary script file named as a launch_container.sh in the form of a flash script to obtain a content attribute file.
Step 330: and reading the temporary script file through a content executor and executing commands in the temporary script file row by row to start the content. In this embodiment, the content executor reads the content in the complete temporary script file first, and then executes the content of the temporary script line by creating a sub-process. Such as: in the above example, the content executor reads the complete launch_container.
In the implementation process, a content attribute file is generated according to the start content request by acquiring the start content request, the content attribute file is a temporary script file, and the temporary script file is read and executed row by a content executor to start the content. The link of executing the countdown_container.sh by the subprocess in the original scheme is replaced, the complete countdown_container.sh content is read instead, and then the subprocess progressive execution content is created, so that the user program is prevented from being started by executing the dynamically generated script, and the Yarn is ensured to normally run in the secret-related environment. In comparison, the scheme in the embodiment furthest reserves the responsibilities of the NodeManger and Contai ner executors, and has good compatibility and easy transformation.
Fig. 1 is a schematic flow chart of a method for starting a content in one embodiment, and fig. 3 is a schematic flow chart of a method for starting a content in another embodiment. It should be understood that, although the steps in the flowcharts of fig. 1 and 3 are shown in order as indicated by the arrows, these steps are not necessarily performed in order as indicated by the arrows. The steps are not strictly limited to the order of execution unless explicitly recited herein, and the steps may be executed in other orders. Moreover, at least some of the steps in fig. 1 and 3 may include multiple sub-steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, which are not necessarily performed sequentially, but may be performed alternately or alternately with at least a portion of the other steps or sub-steps of other steps.
Based on the same inventive concept, this embodiment provides a content starting device, please refer to fig. 4, and fig. 4 schematically shows a block diagram of a content starting device according to an embodiment of the present application. The content starting device includes a first acquisition module 410, a first generation module 420, and a first starting module 430, where:
A first obtaining module 410, configured to obtain a start Container request;
A first generating module 420, configured to generate a Container attribute file according to the start Container request;
The first startup module 420 is configured to call a context executor to perform context preparation according to the context attribute file, so that the context executor starts Co ntainer after context preparation is completed.
The content starting device comprises a processor and a memory, wherein the access request acquisition module, the access request generation module, the verification module, the access module and the like are all stored in the memory as program units, and the processor executes the program units stored in the memory to realize corresponding functions.
The processor includes a kernel, and the kernel fetches the corresponding program unit from the memory. The kernel can be provided with one or more than one, and the risk of data leakage is avoided by adjusting kernel parameters.
Based on the same inventive concept, this embodiment provides a content starting device, please refer to fig. 5, and fig. 5 schematically shows a block diagram of another content starting device according to an embodiment of the present application. The content starting device includes a second obtaining module 510, a second generating module 520, and a second starting module 530, where:
a second obtaining module 510, configured to obtain a start Container request;
A second generating module 520, configured to generate a Container attribute file according to the start Container request, where the Container attribute file is a temporary script file;
A second startup module 530, configured to read the temporary script file by a content executor and execute the temporary script file row by row, so as to startup the content.
The embodiment of the invention provides a storage medium, on which a program is stored, which when executed by a processor, implements the content starting method.
The embodiment of the invention provides electronic equipment, which comprises at least one processor, and at least one memory and a bus which are connected with the processor; the processor and the memory complete communication with each other through a bus; the processor is used for calling program instructions in the memory to execute and realize the content starting method.
Referring to fig. 6, fig. 6 schematically shows an internal structural view of an apparatus according to an embodiment of the present application. The embodiment of the application provides a device 60, wherein the device 60 comprises at least one processor 601, at least one memory 602 connected with the processor 601, and a bus 603; wherein, the processor 601 and the memory 602 complete communication with each other through the bus 603; the processor 601 is configured to call the program instructions in the memory 602 to perform the above-mentioned content start method. The device 60 herein may be a server, PC, PAD, cell phone, etc.
The application also provides a computer program product adapted to perform, when executed on a data processing device, a program initialized with the method steps of:
Acquiring a start Container request;
generating a content attribute file according to the start content request;
And calling a content executor to perform environment preparation according to the content attribute file, so that the content executor starts the content after the environment preparation is completed.
In one embodiment, the method further comprises:
After the content attribute file is generated, a start-up content notification is generated, and the start-up content notification is sent to a content executor, so that the content executor performs environment preparation according to the content attribute file after receiving the start-up content notification.
In one embodiment, the context executor performs context preparation according to the context attribute file after receiving the start context notification, including:
after receiving the start-up content notification, the content executor reads and parses the content attribute file to obtain relevant information of the start-up content;
Acquiring Contianer credential files;
Creating a child process and terminating a parent process; the parent process is a process for notifying a content executor, and the child process is a process for starting the content;
Setting a resource limit by adopting CGroup technology according to the start content request;
Creating a content operation catalog according to the related information of the start content, contianer credential files and a start content request, and preparing files in the content operation;
Setting the user identity as a starting content user;
setting an environment variable according to the related information of the starting Container;
And performing parameter splicing according to the related information of the start-up Container, contianer credential files and the start-up Container request to obtain start-up parameters so as to finish environmental preparation.
In one embodiment, the content executor starts Cont ainer after the environment preparation is completed, including:
And the content executor executes exec function to start the content according to the starting parameter after the environment preparation is completed.
In one embodiment, the content executor switches active users to set permissions by invoking seteuid methods in preparing files for the content runtime.
In one embodiment, the method comprises:
Acquiring a start Container request;
Generating a content attribute file according to a start content request, wherein the content attribute file is a temporary script file;
And reading the temporary script file through a content executor and executing commands in the temporary script file row by row to start the content.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In one typical configuration, the device includes one or more processors (CPUs), memory, and a bus. The device may also include input/output interfaces, network interfaces, and the like.
The memory may include volatile memory, random Access Memory (RAM), and/or nonvolatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM), among other forms in computer readable media, the memory including at least one memory chip. Memory is an example of a computer-readable medium.
Computer readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of storage media for a computer include, but are not limited to, phase change memory (PRAM), static Random Access Memory (SRAM), dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), read Only Memory (ROM), electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium, which can be used to store information that can be accessed by a computing device. Computer-readable media, as defined herein, does not include transitory computer-readable media (transmission media), such as modulated data signals and carrier waves.
It should also be noted that 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.
It will be appreciated by those skilled in the art that embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may 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, and the like) having computer-usable program code embodied therein.
The foregoing is merely exemplary of the present application and is not intended to limit the present application. Various modifications and variations of the present application will be apparent to those skilled in the art. Any modification, equivalent replacement, improvement, etc. which come within the spirit and principles of the application are to be included in the scope of the claims of the present application.

Claims (10)

1. A Container startup method, comprising:
Acquiring a start Container request;
generating a content attribute file according to the start content request;
And calling a content executor to perform environment preparation according to the content attribute file, so that the content executor starts the content after the environment preparation is completed.
2. The Container startup method according to claim 1, characterized in that the method further comprises:
After the content attribute file is generated, a start-up content notification is generated, and the start-up content notification is sent to a content executor, so that the content executor performs environment preparation according to the content attribute file after receiving the start-up content notification.
3. The content startup method according to claim 2, wherein the content executor, after receiving the startup content notification, performs environment preparation according to the content attribute file, includes:
after receiving the start-up content notification, the content executor reads and parses the content attribute file to obtain relevant information of the start-up content;
Acquiring Contianer credential files;
Creating a child process and terminating a parent process; the parent process is a process for notifying a content executor, and the child process is a process for starting the content;
Setting a resource limit by adopting CGroup technology according to the start content request;
Creating a content operation catalog according to the related information of the start content, contianer credential files and a start content request, and preparing files in the content operation;
Setting the user identity as a starting content user;
setting an environment variable according to the related information of the starting Container;
And performing parameter splicing according to the related information of the start-up Container, contianer credential files and the start-up Container request to obtain start-up parameters so as to finish environmental preparation.
4. The content startup method according to claim 3, wherein the content executor starts the content after the environment preparation is completed, comprising:
And the content executor executes exec function to start the content according to the starting parameter after the environment preparation is completed.
5. The content startup method according to claim 3, wherein the content executor switches active users to set rights by calling seteuid a method in preparation for a file at the content run time.
6. A Container startup method, comprising:
Acquiring a start Container request;
Generating a content attribute file according to a start content request, wherein the content attribute file is a temporary script file;
And reading the temporary script file through a content executor and executing commands in the temporary script file row by row to start the content.
7. A Container starting device, comprising:
the first acquisition module is used for acquiring a start content request;
The first generation module is used for generating a content attribute file according to the start content request;
And the first starting module is used for calling the content executor to perform environment preparation according to the content attribute file so that the content executor starts the content after the environment preparation is completed.
8. A Container starting device, comprising:
the second acquisition module is used for acquiring a start content request;
The second generation module is used for generating a content attribute file according to the starting content request, wherein the content attribute file is a temporary script file;
And the second starting module is used for reading the temporary script file through a content executor and executing the temporary script file row by row so as to start the content.
9. An electronic device comprising at least one processor, and at least one memory and bus coupled to the processor; the processor and the memory complete communication with each other through a bus; the processor is configured to invoke program instructions in the memory to perform the content start method of any of claims 1-6.
10. A machine-readable storage medium having instructions stored thereon, which when executed by a processor cause the processor to be configured to perform the content start method according to any of claims 1 to 6.
CN202211723950.8A 2022-12-30 Container starting method and device, storage medium and electronic equipment Pending CN118276960A (en)

Publications (1)

Publication Number Publication Date
CN118276960A true CN118276960A (en) 2024-07-02

Family

ID=

Similar Documents

Publication Publication Date Title
US8490120B2 (en) System and method for the service configuration of application server environments
WO2022016848A1 (en) Method and apparatus for performing application deployment according to service role
CN108021400B (en) Data processing method and device, computer storage medium and equipment
CN108268609B (en) File path establishing and accessing method and device
CN111258742B (en) Data synchronization method, system, computing device and storage medium
CN113297566A (en) Sandbox implementation method, sandbox implementation device, sandbox implementation equipment and storage medium
CN112242920B (en) Cloud platform deployment method, device and node
US20230401058A1 (en) Semantic functional wrappers of services
CN113157428B (en) Container-based resource scheduling method and device and container cluster management device
CN107179982B (en) Cross-process debugging method and device
CN108289080B (en) Method, device and system for accessing file system
CN110837446A (en) Equipment management method and device applied to embedded system, medium and embedded equipment
CN113918336A (en) FreeRTOS task running method and device based on multi-core CPU
CN112612460A (en) Interface packaging and calling method, electronic device and storage medium
CN118276960A (en) Container starting method and device, storage medium and electronic equipment
CN106775608B (en) Method and device for realizing independent system process
CN111459573A (en) Method and device for starting intelligent contract execution environment
CN112738181B (en) Method, device and server for cluster external IP access
CN113938527B (en) Extension processing method of API gateway, computing device and storage medium
CN110968406A (en) Method, device, storage medium and processor for processing task
CN114791884A (en) Test environment construction method and device, storage medium and electronic equipment
KR101950484B1 (en) Task Management Device for Providing Real-time Performance to Android
CN106844056B (en) Hadoop big data platform multi-tenant job management method and system
CN117573616A (en) File processing method, device, electronic equipment and computer readable medium
CN112463246A (en) Service interaction method and system of OpenStack cloud platform and related components

Legal Events

Date Code Title Description
PB01 Publication