The content of the invention
In view of this, the disclosure provides a kind of container creation method and device, to cause use of the container to equipment to realize
More flexibly and conveniently, and influence of the renewal of the equipment to container business is reduced.
Specifically, the disclosure is achieved by the following technical solution:
First aspect is there is provided a kind of container creation method, and methods described is applied to carry the establishment of the container of target device,
Methods described includes:
Receive the plug-in unit trigger request that the container engine for creating container is sent;
According to the trigger request, facility information and the driving of the target device are obtained;
The facility information and driving are returned into the container engine, carry described to cause the container engine to create
The container of target device.
Second aspect is there is provided a kind of container creation method, and methods described is applied to carry the establishment of the container of target device,
Methods described includes:
Plug-in unit trigger request is sent to container insert, the plug-in unit trigger request is used to trigger the container insert acquisition institute
State facility information and the driving of target device;
Receive the facility information and driving that the container insert is returned;
Using the facility information and driving, the container for carrying the target device is created.
The third aspect is there is provided a kind of container creating device, and described device is applied to carry the establishment of the container of target device,
Described device includes:
Receiving module is triggered, for receiving the plug-in unit trigger request that the container engine for being used for creating container is sent;
Data obtaining module, for according to the trigger request, obtaining facility information and the driving of target device;
Information feedback module, for the facility information and driving to be returned into the container engine, to cause the appearance
Device engine creates the container for carrying the target device.
Fourth aspect is there is provided a kind of container creating device, and described device is applied to carry the establishment of the container of target device,
Described device includes:
Request sending module, for sending plug-in unit trigger request to container insert, the plug-in unit trigger request is used to trigger
The container insert obtains facility information and the driving of the target device;
Information receiving module, for receiving the facility information and the driving that the container insert is returned;
Container creation module, for using the facility information and driving, creates the container for carrying target device.
5th aspect is there is provided a kind of computer-readable recording medium, and be stored with computer instruction on the medium, the instruction
Following steps are realized when being executed by processor:
Receive the plug-in unit trigger request that the container engine for creating container is sent;
According to the trigger request, facility information and the driving of the target device are obtained;
The facility information and driving are returned into the container engine, carry described to cause the container engine to create
The container of target device.
6th aspect is provided with target device, the processing equipment bag there is provided a kind of processing equipment in the processing equipment
Memory, processor are included, and stores the computer instruction that can be run on a memory and on a processor, the computer refers to
Order includes:For realizing that the plug-in unit of container insert is instructed and for realizing the engine instructions of container engine;
The processor is instructed by performing the plug-in unit, for realizing following steps:Receive the appearance for creating container
The plug-in unit trigger request that device engine is sent;According to the trigger request, facility information and the driving of the target device are obtained;Will
The facility information and driving return to the container engine;
The processor is by performing the engine instructions, for realizing following steps:Plug-in unit is sent to container insert to touch
Hair request, the plug-in unit trigger request is used to trigger facility information and driving that the container insert obtains the target device;
Receive facility information and driving that the container insert is returned;Using the facility information and driving, create and carry the target
The container of equipment.
The container creation method and device of the disclosure, when container engine creates container, the disclosure can be triggered automatically
Container insert is on behalf of the facility information and driving for collecting target device, so that the acquisition of information needed when being created for container
More quickly and conveniently, also, the mode of plug-in unit will not produce influence to the business in container.
Embodiment
An independent sandbox running environment can be createed for application program using container (container) technology, and
It is not the operating system that complete set is provided as virtual machine, for example, conventional virtual machine mode runs ten different applications
Ten virtual machines will be played, and container technique only needs to start the application of ten isolation, this ten applications are located at not respectively
In same container.The startup of container and operational efficiency are higher, and very high to the utilization rate of system resource, and container is except running it
In application program outside, many containers of quantity can be run simultaneously on extra system resource, a main frame by not consuming substantially.
Just because of above-mentioned advantage, container technique is progressively applied to the work of various aspects.
Fig. 1 illustrates the application scenarios of a container, as shown in figure 1, processing equipment 11 for example can be a computer, clothes
It is engaged in the physical machine such as device, or can also is with physical machine in a virtual machine operated on physical machine, description below
Exemplified by device.At least one hardware device can be installed in processing equipment 11, in one example, these hardware devices can be with
It is infiniband equipment, infiniband is a kind of computer network communication standard suitable for high-performance computing sector, tool
Have it is high handle up, the transmission characteristic of low latency, infiniband equipment can include infiniband interchangers and the network interconnection be set
It is standby etc..Need to carry the driving of the equipment using infiniband equipment, as shown in figure 1, processing equipment 11 includes physical machine
(the infiniband i.e. in the processing equipment of physical machine form, to distinguish subsequent descriptions of infiniband equipment 12
The container infiniband of middle appearance) and (the container drive similarly, subsequently occurred to distinguish of physical machine infiniband drivings 13
It is dynamic).In this example, above-mentioned infiniband equipment can be referred to as target device, in addition, in described below with
Exemplified by infiniband equipment, but can also be other hardware devices in other application scenarios.
Continuing with referring to Fig. 1, it is assumed that manage in this place and created in equipment and run a container 14, the application in the container 14
Program needs to use infiniband equipment, to improve network throughput and network communication efficiency, then container 14 can be one
Individual " container (Fig. 1 is illustrated as infiniband containers) for carrying infiniband equipment ", that is, need infiniband equipment
Carry is in container 14, and container 14 also needs to include the driving of the infiniband equipment, so can normally use
Infiniband equipment.As shown in figure 1, container 14 includes container infiniband equipment and driving, with shared by these
Actual physical equipment.
The container creation method of the disclosure, i.e., for describing how to create above-mentioned container 14, and cause the container 14
The middle infiniband equipment carried in processing equipment 11 and its driving.As shown in figure 1, establishment can be responsible for by container engine 15
Container, in one example, for example, the container engine 15 can be Docker, Docker is that an application container increased income is drawn
Hold up, allow developer can pack they application and rely on bag into a transplantable container, be then published to any stream
On capable Linux machines, build once, run everywhere, i.e. " Build once, Run anywhere ", Docker to realize
Working automation of the application deployment under software container can be caused to carry out.Certainly, in other example application, also may be used
Using other container engines, to be not restricted to be described by taking Docker as an example in Docker, the follow-up example of the disclosure.
By taking Docker as an example, Docker can provide a kind of extension mechanism i.e. Docker plug-in units, for example, Docker can be propped up
Hold volume plug-in units.Plug-in unit is an independent process, and Docker plug-in units can be operated in Docker on same main frame, by
Docker processes carry out plug-in unit triggering.Present disclose provides a kind of plug-in unit, container insert 16 as shown in Figure 1 is inserted by the container
Part 16 is responsible for infiniband facility informations and driving needed for the establishment collection of container, and returns to container engine 15, with
Container is created for container engine 15.
Fig. 2 illustrates the container visioning procedure of the disclosure, can include:
In step 201, container engine receives container request to create, and the container request to create is used to ask to create to carry
The container of target device.
For example, as shown in figure 1, user's scheduler program can send container request to create to Docker, scheduling Docker enters
Journey creates the container of a carrying infiniband equipment.
In step 202., container engine sends plug-in unit trigger request to container insert.
For example, Docker processes are received after container request to create, the flow for creating container is initially entered.In this step,
The container insert that can be triggered by the Volume Driver of Docker processes in the disclosure is started working, equivalent to container
Plug-in unit sends plug-in unit trigger request.
In step 203, container insert obtains facility information and the drive of the target device according to the trigger request
It is dynamic.
For example, the container insert 16 in Fig. 1 can be sentenced after the triggering of Docker process creation Volume events is listened to
Whether disconnected trigger parameter is correct, such as can be, whether the parameter format carried in trigger request is correct.If undesirable
It can be returned to Docker and create the failure of Volume events, otherwise, can continue to obtain the facility information of infiniband equipment
And driving, can be the facility information and physical machine for obtaining the physical machine infiniband equipment in Fig. 1 in this example
Infiniband drives.
In step 204, facility information and driving are returned to container engine by container insert.
In this step, the container insert 16 in Fig. 1 can be by the facility information of the infiniband equipment got and drive
It is dynamic to return to Docker.
In step 205, container engine uses the facility information and driving, creates the appearance for carrying the target device
Device.For example, Docker according to facility information and driving, can carry out the equipment carry and catalogue carry of infiniband equipment.
The container creation method of this example is a kind of method that acquisition by facility information and driving is designed as plug-in unit, is inserted
Part is a kind of mode of operation of flexible light weight, and with plug characteristic, usual swapping process does not constitute influence on main flow.This example
In son, when container engine creates container, equipment of the container insert of the disclosure on behalf of target device is collected can be triggered automatically
Information and driving, so that when being created for container the acquisition of information needed more quickly and conveniently, also, the side of plug-in unit
Formula will not produce influence to the business in container.
Moreover, it is assumed that when Docker creates multiple containers, driving can be directly installed on to each container in the prior art
In, cause each container and mirror image to update therewith when driving version updating, and in the method for this example, inserted by container
Part will drive and return to the Docker engines for creating container, a driving shared equivalent to multiple containers, and Docker is in wound
The automatic redaction driving use for obtaining plug-in unit return, very convenient when building new container.Moreover, container insert will can be set
Standby newest driving and facility information are back to Docker, Docker compatibilities can be caused to be adapted to each device version, by container
Plug-in unit is responsible for collecting driving and the facility information of target device, enormously simplify the visioning procedure of the container of Portable device so that
Use of the container to equipment is realized more flexibly and conveniently.
In one example, the structure and the course of work of the container insert in Fig. 1 will be further described.
As shown in figure 3, for example, the container insert of the disclosure can include three modules, respectively:Plug-in extension trigger mode
Block 31, driving and equipment selecting module 32 and driving and equipment collection module 33.For example, plug-in extension trigger module 31 can
To be Docker Volume plug-in extension trigger modules.The course of work of container insert can be with three above-mentioned modules
Perform, including following three phases:
First stage:The flow of plug-in extension trigger module.
Such as Fig. 4 example, in step 401, plug-in extension trigger module receives plug-in unit triggering.
In this step, whether plug-in extension trigger module can be intercepted will create Volume events.When Docker is received
During container request to create, plug-in extension trigger module can be triggered and create Volume events.In this example, plug-in extension trigger mode
Block can continue executing with 402 after the plug-in unit trigger request of establishment Volume events of Docker transmissions is received, otherwise, can
To continue to intercept.
In step 402, plug-in extension trigger module judges whether trigger parameter is correct.
If trigger parameter is correct, driving can be triggered in step 403 and equipment selecting module performs next stage
Flow;Otherwise, it can be returned in step 404 to Docker and create the failure of Volume events.
It can see by Fig. 4 flow, the plug-in extension trigger module in the container insert of this example can be mainly responsible for
Judge whether that the plug-in unit for receiving Docker is triggered, if to create Volume events, that is, be responsible for whether determining this container insert
Start the flow for obtaining facility information and driving.
Second stage:Driving and the flow of equipment selecting module.
Such as Fig. 5 example, in step 501, driving and equipment selecting module receive trigger request.
In this step, driving and equipment selecting module receive the triggering of plug-in extension trigger module.
In step 502, driving and equipment selecting module judge the whether incoming driving version specified of user.
For example, user can just specify driving version when dispatching Docker establishment containers in container request to create, that
Docker also can be when sending plug-in unit trigger request to plug-in extension trigger module, the driving version specified in carrying,
Equally, plug-in extension trigger module is in triggering driving and equipment selecting module, and the driving version that can specify user is transmitted to
Driving and equipment selecting module.
In this step, if judged result is no, i.e., user does not have incoming driving version, then can directly perform step 505,
Triggering driving and equipment collection module 33 are driven collection, and certainly, the driving and equipment collection module 33 also can collecting devices
Information.If it is judged that being yes, the i.e. incoming driving version specified of user, then step 503 can be performed.
In step 503, driving and equipment selecting module call driving and equipment collection module query driven.
In step 504, judge that the driving of indicated release whether there is.
Can whether there is the driving version specified to driving and the inquiry of equipment collection module, such as in this step
It is not present, step 506 can be performed, otherwise, step 505 can be performed.
In step 505, driving and equipment selecting module triggering driving and equipment collection module, to enter next stage
Flow, carries out the collection of facility information and driving.
In step 506, driving and equipment selecting module return to establishment failure, i.e. driving and equipment selecting module to plug-in unit
Extend trigger module and return to failure, then plug-in extension trigger module is returned to Docker and failed.
It can see by Fig. 5 flow, driving and equipment selecting module in the container insert of this example can mainly be born
Duty determines whether to continue to trigger facility information and the collection of driving is obtained, if the driving of indicated release and be not present, no
With continuing to collect, directly return and fail to Docker, if specifying driving to exist or not specified driving, can trigger
Facility information and the collection of driving.
Phase III:Driving and the flow of equipment collection module.
Such as Fig. 6 example, in step 601, driving and equipment collection module receive trigger request.
In this step, driving and equipment collection module receive driving and the triggering of equipment selecting module.
In step 602, driving and equipment collection module judge whether with the driving version specified.
If it is judged that being no, i.e., without driving version, user is not specified, then can perform step 604;Otherwise, if
Judged result is yes, then can perform step 603.
In step 603, driving and equipment collection module judge that the driving of indicated release whether there is in the buffer.If depositing
Then performing step 604;Otherwise, step 605 can be performed.
In step 604, driving and equipment collection module obtain the newest facility information and driving in caching.This
In step, obtain after facility information and driving, facility information and driving can be returned to driving by driving and equipment collection module
With equipment selecting module, facility information and driving are returned to plug-in extension trigger module by driving and equipment selecting module, finally
The establishment that Docker carry the container of infiniband equipment is returned to by plug-in extension trigger module.
In step 605, driving and equipment collection module judge whether to collect the version drive first.
If not collecting first, then illustrate that the driving is not present, can directly perform step 608;If collecting first, then may be used
To perform step 606.
In step 606, driving and equipment collection module call driving equipment requestor collecting device information and driving.Should
The structure and operation principle of driving equipment requestor, follow-up example description.
In step 607, driving and equipment collection module receive driving equipment requestor return facility information and
After driving, the driving in caching and facility information are updated.
Updated in this step after caching, driving and equipment collection module can judge indicated release again with return to step 603
In the buffer whether driving, if being still not present, according to the description of above-mentioned flow, fail returning, can also be certainly successively
Via above-mentioned driving and equipment selecting module, plug-in extension trigger module, finally return that failure to Docker;If judging again
When existed, then according to above-mentioned flow describe, then facility information and driving are returned into Docker.
In step 608, driving and equipment collection module, which are returned, creates failure.
It can see by Fig. 6 flow, driving and equipment collection module in the container insert of this example can mainly be born
The collection for blaming specific facility information and driving is obtained, and can be it is preferential obtained in caching, can be with when not having in caching
Driving equipment requestor is called to obtain.
In one example, driving equipment requestor mentioned above, can be used as driving and the one of equipment collection module
Part, the facility information of the target device in processing equipment where main responsible acquisition container insert and driving.Fig. 7 is illustrated
The structure of the driving equipment requestor, as shown in fig. 7, can include:Release maintenance device 71, activation bit manager 72, equipment
Information manager 73 and physical equipment call device 74.
For example, facility information and the drive of the infiniband equipment of different editions can be safeguarded in release maintenance device 71
It is dynamic.Also, the corresponding activation bit mapping of infiniband equipment of different editions can also be safeguarded in the release maintenance device 71
Key and facility information Map Key, can be with query driven information manager 72, equipment information management device 73, in driving by Map Key
Be stored with information manager 72 driving description and acquisition modes, equipment information management device 73 is stored with the description of facility information
And acquisition modes.
After driving equipment requestor receives call request, can the driving that obtains of first inquiry request and facility information be
It is no to be stored in release maintenance device 71.If it is present driving and equipment collection module can be directly returned to;If do not deposited
Facility information can obtained by the Map Key of the version, query driven information manager 72 and equipment information management device 73
With the acquisition modes of driving.Then, device 74 (for example, infiniband physical equipments call device) can be called by physical equipment
According to described acquisition modes, specific facility information and driving are obtained.Also, can also be by the facility information got and drive
Dynamic to store into the release maintenance device 71, next time can just obtain directly in release maintenance device 71.
In this example, driving equipment can regularly be called with one timer of automatic running in driving and equipment collection module
Requestor is come the regular check and renewal that are driven, to ensure that physical drives can be synchronized in container insert after updating.This
Sample user can drive version and equipment when creating container without being concerned about, most suitable driving file neatly can be injected in container
Portion, corresponding equipment can be in automatic carry to containers.Meanwhile, inquire about what currently processed equipment was used by driving equipment requestor
The version of target device, can accomplish infiniband equipment that is compatible and being adapted to various versions.
In order to realize the container creation method of the disclosure, the disclosure additionally provides a kind of container creating device, and the device can
With the establishment applied to the container for carrying target device, the device can apply to container insert.As shown in figure 8, the device can
With including:Trigger receiving unit 81, information acquisition unit 82 and information feedback unit 83., wherein it is desired to which explanation, above-mentioned
Three units can be division of the container creating device in logic function, and actual apparatus structure design includes these three lists
The corresponding logic function of member, is not necessarily designed in strict accordance with the division of these three units.For example, Fig. 3 container insert
In, plug-in extension trigger module can be equivalent to above-mentioned triggering receiving unit 81, it is possible to achieve the triggering correspondence of receiving unit 81
Logic function;And the logic function of information acquisition unit 82 can be by Fig. 3 driving and equipment selecting module, driving and equipment
Collection module function is realized.
Receiving unit 81 is triggered, for receiving the plug-in unit trigger request that the container engine for being used for creating container is sent;
Information acquisition unit 82, for according to trigger request, obtaining facility information and the driving of target device;
Information feedback unit 83, it is described to cause for the facility information and driving to be returned into the container engine
Container engine creates the container for carrying the target device.
In one example, as shown in figure 9, described information acquiring unit 82, including:
Version judgment sub-unit 821, for the driving version for judging whether to include specifying in plug-in unit trigger request;
Information subelement 822, for being no when judged result, or judged result is is and determines the driving version
In the presence of this driving, the facility information and driving are collected.
In one example, information subelement 822, specifically for:When judged result is no, then obtained in caching
Take the newest facility information and driving;When judged result is yes, and determine the driving of the driving version in the caching
In in the presence of, then obtain the facility information in the caching and driving;When judged result is yes, and determine the driving version
Driving is not present and is when collecting first, then to call driving equipment requestor to collect the facility information and drive in the buffer
It is dynamic, and the facility information being collected into and driving are put into the caching.
In one example, information subelement 822, for calling driving equipment requestor to collect the equipment letter
Breath and driving, and when the facility information being collected into and driving are put into the caching, including:Inquire about the driving equipment requestor
Release maintenance device in whether store the facility information and driving;If being not present, obtained in the information manager safeguarded
The facility information and the acquisition modes of driving, and call device to obtain the equipment letter according to the acquisition modes by physical equipment
Breath and driving;The facility information and driving are stored to the release maintenance device.
In order to realize the container creation method of the disclosure, the disclosure additionally provides a kind of container creating device, and the device can
With the establishment applied to the container for carrying target device, the device can apply to container engine.As shown in Figure 10, the device can
With including:Request sending module 1001, information receiving module 1002 and container creation module 1003.
Request sending module 1001, for sending plug-in unit trigger request to container insert, the plug-in unit trigger request is used for
Trigger facility information and driving that the container insert obtains the target device;
Information receiving module 1002, for receiving the facility information and the driving that the container insert is returned;
Container creation module 1003, for using facility information and driving, creates the container for carrying target device.
Device or module that above-described embodiment is illustrated, can specifically be realized by computer chip or entity, or by with
The product of certain function is realized.A kind of typically to realize that equipment is computer, the concrete form of computer can be personal meter
Calculation machine, laptop computer, cell phone, camera phone, smart phone, personal digital assistant, media player, navigation are set
It is any several in standby, E-mail receiver/send equipment, game console, tablet PC, wearable device or these equipment
The combination of equipment.
For convenience of description, it is divided into various modules during description apparatus above with function to describe respectively.Certainly, this is being implemented
The function of each module can be realized in same or multiple softwares and/or hardware when open.
It should be understood by those skilled in the art that, embodiment of the disclosure can be provided as method, system or computer program
Product.Therefore, the disclosure can be using the reality in terms of complete hardware embodiment, complete software embodiment or combination software and hardware
Apply the form of example.Moreover, the disclosure can be used in one or more computer-readable storages for wherein including computer instruction
The form for the computer program product that medium is implemented on (including but is not limited to magnetic disk storage, CD-ROM, optical memory etc.).
These computer program instructions can be also loaded into computer or other programmable data processing devices so that in meter
Series of operation steps is performed on calculation machine or other programmable devices to produce computer implemented processing, thus in computer or
The instruction performed on other programmable devices is provided for realizing in one flow of flow chart or multiple flows and/or block diagram one
The step of function of being specified in individual square frame or multiple square frames.For example, the computer instruction stored on the medium is held by processor
Following steps can be realized during row:Receive the plug-in unit trigger request that the container engine for creating container is sent;Touched according to described
Hair request, obtains facility information and the driving of the target device;The facility information and driving are returned into the container to draw
Hold up, the container of the target device is carried to cause the container engine to create.
In a typical configuration, the processing equipment in the disclosure can also include one or more processors (CPU),
Memory, and the computer instruction that can be run on a memory and on a processor is stored, the computer instruction includes:With
Instructed in the plug-in unit for realizing container insert and for realizing the engine instructions of container engine.
The processor is instructed by performing the plug-in unit, for realizing following steps:Receive the appearance for creating container
The plug-in unit trigger request that device engine is sent;According to the trigger request, facility information and the driving of the target device are obtained;Will
The facility information and driving return to the container engine;
The processor is by performing the engine instructions, for realizing following steps:Plug-in unit is sent to container insert to touch
Hair request, the plug-in unit trigger request is used to trigger facility information and driving that the container insert obtains the target device;
Receive facility information and driving that the container insert is returned;Using the facility information and driving, create and carry the target
The container of equipment.
The preferred embodiment of the disclosure is the foregoing is only, not to limit the disclosure, all essences in the disclosure
God is with principle, and any modification, equivalent substitution and improvements done etc. should be included within the scope of disclosure protection.