IP Library › Granted Patent US 9,183,008
Granted Patent B2
US 9,183,008 · App. 14/258,168 · Granted Nov 10, 2015

Method and system for starting application program in Linux container

Inventor: Honghui Zhang (Hangzhou, CN)
Assignee: Huawei Technologies Co., Ltd.
G06F9/445G06F9/54G06F9/4401G06F9/455
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 9,183,008
App. No.
14/258,168
Granted
Nov 10, 2015
Kind
B2
Abstract

A method for starting an application program in a Linux container and a corresponding Linux system are provided, where the method includes: creating, by a container start process, a container according to a command entered by a user, creating a first application start process, and putting the first application start process into the container for execution; obtaining, by the first application start process, according to the command entered by the user, the number N of application programs to be started, and creating N−1 second application start processes, where N is a positive integer not less than 2; and starting, in the container, by the first application start process and the N−1 second application start processes, the N application programs to be started. By using technical solutions of the present invention, when the container is created, a plurality of application programs can be started simultaneously.

Claims (42)

1. A method for starting an application program in a Linux container, comprising:

creating, by a container start process, a container according to a command entered by a user, wherein the container start process subsequently exists as a container daemon of the container;

creating, by the container start process, a first application start process, and putting the first application start process into the container for execution;

obtaining, by the first application start process, according to the command entered by the user, a number N of application programs to be started, and creating N−1 second application start processes, wherein N is a positive integer not less than two; and

starting, in the container, by the first application start process and the N−1 second application start processes, the N application programs to be started,

wherein starting, in the container, by the first application start process and the N−1 second application start processes, the N application programs to be started comprises starting, by the first or second application start process, according to a set mapping relationship, a corresponding application program to be started, wherein the mapping relationship is a mapping relationship between, the first application start process and the N−1 second application start processes, and the N application programs to be started.

2. The method according to claim 1 , wherein creating, by the container start process, the container according to the command entered by the user further comprises:

obtaining, by the container start process, the command entered by the user; and

creating the container according to a name of the container and a path name of a configuration file, wherein the name of the container is specified in the command, and the path name of the configuration file is specified in the command or is set by default.

3. The method according to claim 2 , wherein after starting, in the container, by the first application start process and the N−1 second application start processes, the N application programs to be started, the method further comprises:

terminating, by the container daemon, all processes in the container after obtaining a container destroying command; and

destroying, by the container daemon, the container after detecting termination of an initial process in the container.

4. The method according to claim 1 , wherein after starting, in the container, by the first application start process and the N−1 second application start processes, the N application programs to be started, the method further comprises:

terminating, by the container daemon, all processes in the container after obtaining a container destroying command; and

destroying, by the container daemon, the container after detecting termination of an initial process in the container.

5. The method according to claim 4 , wherein terminating all processes in the container comprises terminating all the processes in the container by sending a SIGKILL signal to a process group in the container, or by separately sending a SIGKILL signal to all the processes in the container.

6. The method according to claim 1 , wherein after starting, in the container, by the first application start process and the N−1 second application start processes, the N application programs to be started, the method further comprises:

terminating, by the container daemon, all processes in the container after obtaining a container destroying command; and

destroying, by the container daemon, the container after detecting termination of an initial process in the container.

7. A Linux system, comprising a central processing unit (CPU), wherein the CPU is configured to:

enable a container start process to create a container according to a command entered by a user, wherein the container start process subsequently exists as a container daemon of the container;

enable the container start process to create a first application start process, and to put the first application start process into the container for execution;

enable the first application start process to obtain, according to the command entered by the user, the number N of application programs to be started, and to create N−1 second application start processes, wherein N is a positive integer not less than two; and

enable the first application start process and the N−1 second application start processes to start, in the container, the N application programs to be started,

wherein in the enabling the first application start process and the N−1 second application start processes to start, in the container, the N application programs to be started, the CPU is further configured to enable the first or second application start process to start, according to a set mapping relationship, a corresponding application program to be started, wherein the mapping relationship is a mapping relationship between, the first application start process and the N−1 second application start processes, and the N application programs to be started.

8. The system according to claim 7 , wherein in the enabling the container start process to create the container according to the command entered by the user, the CPU is further configured to enable the container start process to obtain the command entered by the user, and to create the container according to a name of the container and a path name of a configuration file, wherein the name of the container is specified in the command, and the path name of the configuration file is specified in the command or is set by default.

9. The system according to claim 8 , wherein the CPU is further configured to:

enable the container daemon to terminate all processes in the container after obtaining a container destroying command; and

enable the container daemon to destroy the container after detecting termination of an initial process in the container.

10. The system according to claim 7 , wherein the CPU is further configured to:

enable the container daemon to terminate all processes in the container after obtaining a container destroying command; and

enable the container daemon to destroy the container after detecting termination of an initial process in the container.

11. The system according to claim 10 , wherein in the enabling the container daemon to terminate all processes in the container, the CPU is further configured to enable the container daemon to terminate all the processes in the container by sending a SIGKILL signal to a process group in the container, or by separately sending a SIGKILL signal to all the processes in the container.

12. The system according to claim 7 , wherein the CPU is further configured to:

enable the container daemon to terminate all processes in the container after obtaining a container destroying command; and

enable the container daemon to destroy the container after detecting termination of an initial process in the container.

13. A non-transitory computer-readable storage medium having computer executable instructions for performing a method comprising:

enabling a container start process to create a container according to a command entered by a user, wherein the container start process subsequently exists as a container daemon of the container;

enabling the container start process to create a first application start process, and to put the first application start process into the container for execution;

enabling the first application start process to obtain, according to the command entered by the user, the number N of application programs to be started, and to create N−1 second application start processes, wherein N is a positive integer not less than two; and

enabling the first application start process and the N−1 second application start processes to start, in the container, the N application programs to be started.

wherein in the enabling the first application start process and the N−1 second application start processes to start, in the container, the N application programs to be started, the CPU is further configured to enable the first or second application start process to start, according to a set mapping relationship, a corresponding application program to be started, wherein the mapping relationship is a mapping relationship between, the first application start process and the N−1 second application start processes, and the N application programs to be started.

Assignments (1)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Apr 22, 2014
From: ZHANG, HONGHUI
To: HUAWEI TECHNOLOGIES CO., LTD.
Reel/Frame 032725/0811 →
Continuity (2)
Continuation PCTCN2011081168 · Oct 24, 2011
Related Publication 20140229951A1 · Aug 14, 2014