Specific implementation mode
The exemplary embodiment of the disclosure is more fully described below with reference to accompanying drawings.Although showing the disclosure in attached drawing
Exemplary embodiment, it being understood, however, that may be realized in various forms the disclosure without should be by embodiments set forth here
It is limited.On the contrary, these embodiments are provided to facilitate a more thoroughly understanding of the present invention, and can be by the scope of the present disclosure
Completely it is communicated to those skilled in the art.
The embodiment of the present invention provides a kind of construction method of container process control, as shown in Figure 1, this method includes:
101, the function services in the first container are obtained.
Based on different Linux release versions, there is also differences for the container based on the exploitation of Linux release versions, are developing
When the corresponding function services of container, often use different programming languages so that the use environment of function services exist it is poor
It is different, the function services in a kind of container may be caused to can be not applied directly in other containers, i.e., function services are in different appearances
Compatibility between device is poor.In the specific implementation, the type of container includes but is not limited to content below, for example, Wu Bantu
Ubuntu types, community's Enterprise Operation System (Community Enterprise Operating System, CentOS) class
Type;Alternatively, DebianGNU/Linux types, Fedora types etc..The embodiment of the present invention to the concrete type of container without
It limits.
In order to achieve the purpose that in a container while start multiple subprocess, first, the work(in the first container is obtained
It can service, which can be by calling a process realize the calling of multiple subprocess.
102, the startup function service in second container.
Function services after acquisition are started in second container, if the function services can open in second container
It is dynamic, then it is not necessarily to execute step 103, it directly will be in the function services of acquisition " transplanting " to second container.But in practical behaviour
During work, since function services compatibility is poor, the function services in a container tend not in another container into
Row directly initiates;If the function services can not start in second container, 103 are thened follow the steps.
103, the use environment of function services is adapted to, generates the container process control suitable for second container.
Wherein, the use environment of function services is the container environment of the first container, and the container environment of the first container is to calculate
Machine procedural programming languages, since different containers supports different computer program programming languages, lead to different containers
Middle container environment has differences.Computer program programming language provided in an embodiment of the present invention includes but are not limited in following
Hold, for example, Python, C language, JAVA, ASP, ASP.NET, Visual Basic, Visual Basic.NET;Alternatively, C++,
C#, Perl, PHP, SQL, FoRTRAN, Visual Foxpro etc..The embodiment of the present invention is to computer program programming language
Without limiting, whether computer program programming language will determine concrete type according to being supported in container where it.
After the use environment process adaptation of the function services obtained in step 101, generate suitable for second container
Container process control, in itself the function services in the container process control of second container and the first container have identical work(
Can, i.e., it can realize the calling for calling a process to realize multiple subprocess.When container process control is started, container
The process that process control calls can call multiple subprocess, can receive the solicited message of subprocess transmission, can also be to son
Process sends control information etc., to realize by a process call multiple sons into.
Different computer program programming languages, a tool provided below are supported in order to be better understood from different containers
The scene of body illustrates.Illustratively, it is assumed that when developing the function services 1 in the first container, compiled using computer program
Cheng Yuyan JAVA are write, and the computer program programming language in second container only supports Python, in order to make function take
Business 1 can be started in second container, be adapted to the use environment JAVA of function services, being adapted to Python can
The format of operation.Wherein, the change of name variable is may relate in adaptation procedure, the replacement of source code, changes the letter called
Number, init state etc..
The construction method of container process control provided in an embodiment of the present invention obtains the function clothes in the first container first
Business, the function services can be by calling a process realize the calling of multiple subprocess, by the function services after acquisition the
Started in one container, when the function services can not start in second container, to the use environments of the function services into
Journey is adapted to, and is generated the container process control suitable for second container, will be built one in the function services " transplanting " to second container
A container process control can make container when calling a process, realize the calling of multiple subprocess.
Further, as the refinement and extension to above-described embodiment, ring is used to function services in above-mentioned steps 103
When border is adapted to, mode below may be employed without limitation of to realize, for example, the use environment of the function services is transformed
For the container environment of second container.In an implementation of the embodiment of the present invention, first to the function services after acquisition into
Row parsing, obtains the corresponding command statement of the function services, which is converted to can be in the container ring of second container
The command statement executed in border, wherein the corresponding command statement of function services is the corresponding source code of the function services.It is obtaining
When the corresponding command statement of the function services, in an implementation of the embodiment of the present invention, according to the execution of function services
Sequence is parsed one by one, obtains the corresponding source code of the function services;In another realization method of the embodiment of the present invention,
Any type that those skilled in the art can be used usual obtains the tool of source code automatically, to the source code of the function services
It is obtained.The embodiment of the present invention is to obtaining the corresponding imperatival specific implementation of the function services without limiting.
In embodiments of the present invention, the premise based on function services poor compatibility between different vessels is held obtaining first
After the corresponding source code of function services in device, needing to be converted to the source code can be in the container environment of second container
The source code of execution.When being converted to the source code, the embodiment of the present invention may be employed without limitation of mode below
It realizes, is replaced the corresponding source code of function services in the first container according to the container environment of second container, be substituted for the
The source code that two containers can be compatible with.It can hold second it should be noted that the corresponding source code of function services is converted to
The source code executed in the container environment of device, change be different vessels environment can identify, the programming of the computer program that is compatible with
Language, without changing the corresponding functional character of function services in the first container, i.e. the corresponding source code of function services is converted to
The source code that can be executed in the container environment of second container, will not change function services can be by calling a process reality
The functional character of the calling of existing multiple subprocess.Illustratively, the command statement of reason is assured in the first container using apt-get,
And the command statement of reason is assured in second container using yum, apt-get assures the order that the command statement of reason assures reason with yum
Sentence mainly provide lookup, installation, delete some, the command statements of one group of even whole software package, because of container environment
Otherness so that second container cannot identify that apt-get assures the command statement of reason, it is therefore desirable to which apt-get is assured reason
Command statement be substituted for the command statement that yum assures reason, be converted into that order can be executed in the container environment of second container
Sentence.It these are only that illustrative citing, imperatival conversion will be programmed according to the computer program specifically supported in container
Subject to language, the embodiment of the present invention is to this without limiting.
Further, command statement is converted to can be executed in the container environment of second container it is imperatival
In the process, not all command statement is unable to be executed in second container, in order to improve conversion command
The speed of sentence fails the command statement executed in the container environment of second container in sense command sentence, and will fail to hold
Capable command statement is converted.Due in computer program programming language there are it is close or it is similar using rule,
So that between different computer program programming languages, it also can have the mutually general professional word in part or call identical
Function etc..Illustratively, if it is C language that the function services of the first container, which correspond to container environment, and the container of second container
Environment is C Plus Plus, after obtaining the corresponding command statement of function services, first according to the container environment C++ of second container
Which command statement energy language, the command statement obtained traversal through parsing using the function services that C language is developed, determine
Enough to be executed in the container environment of second container, which command statement can not execute in the container environment of second container, and
The command statement that will not be able to execute in the container environment of second container is converted, to improve the speed of conversion command sentence
Degree.Wherein, the detailed process in relation to conversion command sentence please refers to the above-mentioned detailed description in relation to conversion command sentence, this hair
Bright embodiment is no longer repeated here.
Further, it is adapted in the use environment to function services, generates the container process suitable for second container
After control, in the construction method of container process control provided in an embodiment of the present invention, additionally it is possible to send start-up operation instruction fortune
The row container process control, and the called process into container process control sends control instruction, realizes same in a container
When can run multiple processes.In the specific implementation, when container process control is run, the operating personnel of computer are to the container
The process that is called in process control sends the control instruction for starting or stopping, for example, being called into the container process control
Process sends the control instruction for starting subprocess 3;Alternatively, the process that is called into the container process control sends and stops subprocess
5 control instruction.In addition, container process control can also receive the process signals that the subprocess under its control is sent, for example, holding
Device process control receives the process signals that the process that subprocess 2 is sent terminates;It is sent out alternatively, container process control receives subprocess 3
Process signals of process interrupt sent etc..Specifically, control that the embodiment of the present invention receives container process control, sending
The particular content of instruction is without limiting.
When sending start-up operation instruction operation container process control, mode below may be employed without limitation of to realize
Container process control is run, for example, sending start-up operation instruction operation container process control by keyboard;Alternatively, passing through mouse
Operate start-up operation instruction operation container process control.The embodiment of the present invention instructs operation container process control to start-up operation
Specific implementation is without limiting.
Further, as the realization to method shown in above-mentioned Fig. 1, the embodiment of the present invention additionally provides a kind of container process
The construction device of control, to realize method shown in the different realization methods of above-described embodiment offer.As shown in Fig. 2, the dress
Set including:
Acquiring unit 21, for obtaining the function services in the first container, function services can be by calling a process
The calling for realizing multiple subprocess, based on different Linux release versions, the container based on the exploitation of Linux release versions is also deposited
Different programming languages is often used, so that function services make in the corresponding function services of exploitation container in difference
It is had differences with environment, the function services in a kind of container may be caused to can be not applied directly in other containers, i.e. function
Compatibility of the service between different vessels is poor;
Start unit 22 starts the function services that acquiring unit 21 obtains in second container, in actual mechanical process,
Since function services compatibility is poor, the function services in a container tend not to directly be opened in another container
It is dynamic;
Adaptation unit 23, when function services can not start in the second container of start unit 22, to function services
Use environment is adapted to, and the container process control suitable for second container is generated;Wherein, the use environment of function services is the
The container environment of the container environment of one container, the first container is computer program programming language, since different containers is supported not
Therefore same computer program programming language causes container environment in different containers to have differences.
Further, adaptation unit 23 are additionally operable to for the use environment of function services to transform the container ring of second container as
Border generates the container process control suitable for second container, in itself the container process control and the first container of second container
In function services have identical function, i.e., can realize and a process is called to realize the calling of multiple subprocess.Work as appearance
When device process control is started, the process that container process control calls can call multiple subprocess, can receive subprocess
The solicited message of transmission can also send control information etc. to subprocess, to realize by a process call multiple sons into.
Further, as shown in figure 3, adaptation unit 23, including:
Parsing module 231 obtains the corresponding command statement of function services for parsing function services;
Conversion module 232, the command statement for obtaining parsing module 231 is converted to can be in the container of second container
The command statement executed in environment, it should be noted that being converted to the corresponding source code of function services can be in second container
Container environment in the source code that executes, change is computer program programming language that different vessels environment can be identified, is compatible with
Speech, without changing the corresponding functional character of function services in the first container, i.e. the corresponding source code of function services is converted to energy
Enough source codes executed in the container environment of second container, will not change function services can be by calling a process to realize
The functional character of the calling of multiple subprocess.
Further, as shown in figure 4, conversion module 232, including:
Detection sub-module 2321, the order for failing to execute in the container environment of second container in sense command sentence
Sentence, wherein due in computer program programming language there are it is close or it is similar using rule, so that it is different
Between computer program programming language, also can have the mutually general professional word in part or call identical function etc.
Deng.First, determine which command statement can execute in the container environment of second container, which command statement can not be
It is executed in the container environment of second container, and the command statement that will not be able to execute in the container environment of second container is turned
It changes, in order to improve the speed of conversion command sentence;
Transform subblock 2322, the command statement for failing to execute for detecting detection sub-module 2321 are converted.
Further, the command statement that parsing module 231 parses is the corresponding source code of function services.
Further, container environment is computer program programming language, and computer program programming language includes:Python、C
Language, JAVA, ASP, ASP.NET, Visual Basic, Visual Basic.NET can also include:C++、C#、Perl、
PHP, SQL, FoRTRAN, Visual Foxpro etc., specifically, the embodiment of the present invention to computer program programming language not into
Row limits.
Further, as shown in figure 5, method further includes:
Transmission unit 24 is generated and is suitable for for being adapted to the use environment of function services in adaptation unit 23
After the container process control of two containers, start-up operation instruction fortune container process control is sent;
Transmission unit 24 is additionally operable to the called process into container process control and sends control instruction, and control instruction is used
In controlling multiple subprocess, when container process control is run, the operating personnel of computer are adjusted into the container process control
The control instruction for starting or stopping is sent with process.
The construction device of container process control provided in an embodiment of the present invention obtains the function clothes in the first container first
Business, the function services can be by calling a process realize the calling of multiple subprocess, by the function services after acquisition the
Started in one container, when the function services can not start in second container, to the use environments of the function services into
Journey is adapted to, and is generated the container process control suitable for second container, will be built one in the function services " transplanting " to second container
A container process control can make container when calling a process, realize the calling of multiple subprocess.
The embodiment of the invention discloses A 1, a kind of construction methods of container process control, including:
Obtain the function services in the first container, the function services can by call process realize multiple sons into
The calling of journey;
Start the function services in second container;
If the function services can not start in the second container, the use environment of the function services is carried out
Adaptation generates the container process control suitable for the second container;Wherein, the use environment of the function services is described the
The container environment of one container.
A2, the method according to A1, the use environment to the function services are adapted to, including:
The use environment of the function services is transform as to the container environment of the second container.
A3, the method according to A2, the use environment to the function services are adapted to, including:
The function services are parsed, the corresponding command statement of the function services is obtained;
The command statement is converted to the command statement that can be executed in the container environment of the second container.
A4, the method according to A3, described be converted to the command statement can be in the container of the second container
The command statement executed in environment, including:
Detect the command statement for failing to be executed in the container environment of second container in the command statement;
The command statement for failing to execute is converted.
A5, the method according to A3 or A4, the command statement are the corresponding source code of the function services.
A6, the method according to any one of A1-A4, the container environment is computer program programming language, described
Computer program programming language includes:Python, C language, JAVA, ASP, ASP.NET, Visual Basic, Visual
Basic.NET。
A7, the method according to A1 are adapted in the use environment to the function services, are generated described in being suitable for
After the container process control of second container, the method further includes:
It sends start-up operation instruction and runs the container process control;
Called process into the container process control sends control instruction, and the control instruction is described for controlling
Multiple subprocess.
B8, a kind of construction device of container process control, including:
Acquiring unit, for obtaining the function services in the first container, the function services can by call one into
The calling of the multiple subprocess of Cheng Shixian;
Start unit, the function services obtained for starting the acquiring unit in second container;
Adaptation unit, for when the function services can not start in the second container, to the function services
Use environment be adapted to, generate suitable for the second container container process control;Wherein, the function services make
With the container environment that environment is the first container.
B9, the device according to B8, the adaptation unit are additionally operable to the use environment of the function services transforming as
The container environment of the second container.
B10, the device according to B9, the adaptation unit, including:
Parsing module obtains the corresponding command statement of the function services for parsing the function services;
Conversion module, the command statement for obtaining the parsing module is converted to can be in the second container
Container environment in the command statement that executes.
B11, the device according to B10, the conversion module, including:
Detection sub-module, for detecting the order for failing to be executed in the container environment of second container in the command statement
Sentence;
Transform subblock, the command statement for failing to execute for detecting the detection sub-module are converted.
The command statement of B12, the device according to any one of B10 or B11, the parsing module parsing is institute
State the corresponding source code of function services.
B13, the device according to any one of B8-B11, the container environment are computer program programming language, institute
Stating computer program programming language includes:Python, C language, JAVA, ASP, ASP.NET, Visual Basic, Visual
Basic.NET。
B14, the device according to B8, described device further include:
Transmission unit is generated and is applicable in for being adapted to the use environment of the function services in the adaptation unit
After the container process control of the second container, sends start-up operation instruction and run the container process control;
The transmission unit is additionally operable to the called process into the container process control and sends control instruction, described
Control instruction is for controlling the multiple subprocess.
Further, since there are close or similar use rules in computer program programming language, therefore so that different
Computer program programming language between, also can have part mutually general professional word or call identical function etc.
Deng.Therefore, in order to improve the speed of conversion command sentence, fail the container environment in second container in sense command sentence
The command statement of middle execution, and the command statement for failing to execute is converted.
In the above-described embodiments, it all emphasizes particularly on different fields to the description of each embodiment, there is no the portion being described in detail in some embodiment
Point, it may refer to the associated description of other embodiment.
It is understood that the correlated characteristic in the above method and device can be referred to mutually.In addition, in above-described embodiment
" first ", " second " etc. be and not represent the quality of each embodiment for distinguishing each embodiment.
It is apparent to those skilled in the art that for convenience and simplicity of description, the system of foregoing description,
The specific work process of device and unit, can refer to corresponding processes in the foregoing method embodiment, and details are not described herein.
Algorithm and display be not inherently related to any certain computer, virtual system or miscellaneous equipment provided herein.
Various general-purpose systems can also be used together with teaching based on this.As described above, it constructs required by this kind of system
Structure be obvious.In addition, the present invention is not also directed to any certain programmed language.It should be understood that can utilize various
Programming language realizes the content of invention described herein, and the description done above to language-specific is to disclose this hair
Bright preferred forms.
In the instructions provided here, numerous specific details are set forth.It is to be appreciated, however, that the implementation of the present invention
Example can be put into practice without these specific details.In some instances, well known method, structure is not been shown in detail
And technology, so as not to obscure the understanding of this description.
Similarly, it should be understood that in order to simplify the disclosure and help to understand one or more of each inventive aspect,
Above in the description of exemplary embodiment of the present invention, each feature of the invention is grouped together into single implementation sometimes
In example, figure or descriptions thereof.However, the method for the disclosure should be construed to reflect following intention:It is i.e. required to protect
Shield the present invention claims the more features of feature than being expressly recited in each claim.More precisely, as following
Claims reflect as, inventive aspect is all features less than single embodiment disclosed above.Therefore,
Thus the claims for following specific implementation mode are expressly incorporated in the specific implementation mode, wherein each claim itself
All as a separate embodiment of the present invention.
Those skilled in the art, which are appreciated that, to carry out adaptively the module in the equipment in embodiment
Change and they are arranged in the one or more equipment different from the embodiment.It can be the module or list in embodiment
Member or component be combined into a module or unit or component, and can be divided into addition multiple submodule or subelement or
Sub-component.Other than such feature and/or at least some of process or unit exclude each other, it may be used any
Combination is disclosed to all features disclosed in this specification (including adjoint claim, abstract and attached drawing) and so to appoint
Where all processes or unit of method or equipment are combined.Unless expressly stated otherwise, this specification (including adjoint power
Profit requires, abstract and attached drawing) disclosed in each feature can be by providing the alternative features of identical, equivalent or similar purpose come generation
It replaces.
In addition, it will be appreciated by those of skill in the art that although some embodiments described herein include other embodiments
In included certain features rather than other feature, but the combination of the feature of different embodiments means in of the invention
Within the scope of and form different embodiments.For example, in the following claims, embodiment claimed is appointed
One of meaning mode can use in any combination.
The all parts embodiment of the present invention can be with hardware realization, or to run on one or more processors
Software module realize, or realized with combination thereof.It will be understood by those of skill in the art that can use in practice
Microprocessor or digital signal processor (DSP) realize the denomination of invention according to the ... of the embodiment of the present invention (as determined in website
The device of Hyperlink rank) in some or all components some or all functions.The present invention is also implemented as being used for
Some or all equipment or program of device of method as described herein are executed (for example, computer program and calculating
Machine program product).It is such to realize that the program of the present invention may be stored on the computer-readable medium, or there are one can having
Or the form of multiple signals.Such signal can be downloaded from internet website and be obtained, or be provided on carrier signal,
Or it provides in any other forms.
It should be noted that the present invention will be described rather than limits the invention for above-described embodiment, and ability
Field technique personnel can design alternative embodiment without departing from the scope of the appended claims.In the claims,
Any reference mark between bracket should not be configured to limitations on claims.Word "comprising" does not exclude the presence of not
Element or step listed in the claims.Word "a" or "an" before element does not exclude the presence of multiple such
Element.The present invention can be by means of including the hardware of several different elements and being come by means of properly programmed computer real
It is existing.In the unit claims listing several devices, several in these devices can be by the same hardware branch
To embody.The use of word first, second, and third does not indicate that any sequence.These words can be explained and be run after fame
Claim.