CN113608819A - Method and device for creating container, electronic equipment and medium - Google Patents

Method and device for creating container, electronic equipment and medium Download PDF

Info

Publication number
CN113608819A
CN113608819A CN202110680484.9A CN202110680484A CN113608819A CN 113608819 A CN113608819 A CN 113608819A CN 202110680484 A CN202110680484 A CN 202110680484A CN 113608819 A CN113608819 A CN 113608819A
Authority
CN
China
Prior art keywords
container
information
parameter
user
creating
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
CN202110680484.9A
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 Huijun Technology Co ltd
Original Assignee
Beijing Huijun Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Huijun Technology Co ltd filed Critical Beijing Huijun Technology Co ltd
Priority to CN202110680484.9A priority Critical patent/CN113608819A/en
Publication of CN113608819A publication Critical patent/CN113608819A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45562Creating, deleting, cloning virtual machine instances
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45575Starting, stopping, suspending or resuming virtual machine instances

Abstract

The present disclosure relates to a method, an apparatus, an electronic device, and a medium for creating a container, which can be applied to the technical field of computers and cloud services, and the method includes: obtaining configuration information carried in the annotation, wherein the configuration information comprises information of user-defined starting parameters configured by a user; analyzing the configuration information to obtain analysis information of the custom starting parameter; and creating a container according to the start parameter information, wherein the start parameter information comprises the analysis information.

Description

Method and device for creating container, electronic equipment and medium
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a method and an apparatus for creating a container, an electronic device, and a medium.
Background
With the development of Cloud computing and Cloud storage services, more enterprises have learned the benefits of adopting Hybrid Cloud (Hybrid Cloud), which refers to the vertical use of Cloud computing in multiple different transport layers, and Multi-Cloud mode (Multi-Cloud), which essentially uses multiple Cloud services in a single transport layer, but it becomes a challenge to ensure that software can run stably when migrating between different environments. Container technology addresses the aforementioned challenges by packaging all components of an application machine into a single portable package. Application containerization is a distributed mode of application deployment in which multiple isolated environments (so-called containers) can share the same operating system kernel rather than running on a single control host. Compared with the traditional virtualization technology, containerization can realize higher efficiency of resources such as memory, CPU and storage.
In the course of implementing the disclosed concept, the inventors found that there are at least the following technical problems in the related art: when a container is created based on a container arrangement tool, parameters transmitted by the container arrangement tool to an application container engine (referred to as a container engine for short) have limitations, only some container starting parameters commonly supported by the container arrangement tool and the container engine can be transmitted and configured, and for some container starting parameters which need to be set individually by a user, configuration cannot be performed through the container arrangement tool.
Disclosure of Invention
To solve the technical problem or at least partially solve the technical problem, embodiments of the present disclosure provide a method, an apparatus, an electronic device, and a medium for creating a container.
In a first aspect, embodiments of the present disclosure provide a method of creating a container. The method comprises the following steps: obtaining configuration information carried in the annotation, wherein the configuration information comprises information of user-defined starting parameters configured by a user; analyzing the configuration information to obtain analysis information of the custom starting parameter; and creating a container according to the start parameter information, wherein the start parameter information comprises the analysis information.
According to an embodiment of the present disclosure, the obtaining of the configuration information carried in the annotation includes: receiving information of a user-defined starting parameter configured in the annotation of the container arrangement tool by a user; and transmitting the configured annotation to a container engine called by the container arrangement tool in a tag form so as to obtain the configuration information carried in the annotation in the container engine.
According to an embodiment of the present disclosure, the analyzing the configuration information to obtain the analysis information of the custom boot parameter includes: identifying a prefix in the configuration information; based on the prefix, locating a key-value pair that follows the prefix; and analyzing the key-value pairs to obtain the self-defined starting parameters and the corresponding parameter values.
According to an embodiment of the present disclosure, the method further includes: adding the analysis information of the user-defined starting parameter into a container initial configuration file, wherein the container initial configuration file contains predefined starting parameter information; wherein the creating a container according to the start parameter information includes: and creating a container according to the analysis information of the self-defined starting parameter and the predefined starting parameter information.
According to an embodiment of the present disclosure, the method further includes: receiving predefined starting parameter information set in the container engine by a user with configuration authority; and generating a container initial configuration file according to the predefined starting parameter information.
According to an embodiment of the present disclosure, the method further includes: updating the predefined starting parameter information; wherein, the generating of the container initial configuration file according to the predefined starting parameter information includes: and generating a container initial configuration file according to the updated predefined starting parameter information.
According to an embodiment of the present disclosure, the above-mentioned custom start parameter includes at least one of the following parameters: the method comprises the steps of storing the size of a shared memory of a container, reserving a monitoring port of the container, controlling a read-write speed parameter of a specific device, controlling an access right of the specific device, limiting the number of processes in the container, storing a kernel parameter in the container and storing the size of a virtual memory of the container.
In a second aspect, embodiments of the present disclosure provide an apparatus for creating a container. The above-mentioned device includes: the device comprises an information acquisition module, an analysis module and a container creation module. The information acquisition module is used for acquiring configuration information carried in the annotation, and the configuration information comprises information of user-defined starting parameters configured by a user. The analysis module is used for analyzing the configuration information to obtain analysis information of the user-defined starting parameter. The container creating module is configured to create a container according to start parameter information, where the start parameter information includes the parsing information.
In a third aspect, embodiments of the present disclosure provide an electronic device. The electronic equipment comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory are communicated with each other through the communication bus; a memory for storing a computer program; a processor for implementing the method of creating a container as described above when executing a program stored on the memory.
In a fourth aspect, embodiments of the present disclosure provide a computer-readable storage medium. The above-mentioned computer-readable storage medium has stored thereon a computer program which, when being executed by a processor, implements the method of creating a container as described above.
Compared with the prior art, the technical scheme provided by the embodiment of the disclosure at least has part or all of the following advantages:
the configuration information of the user-defined starting parameter configured by the user is carried in the annotation form, and the configuration information is analyzed to obtain the analysis information of the user-defined starting parameter, so that the container can be created according to the analysis information of the user-defined starting parameter, the technical defect that the parameter transmitted to the application container by the container arrangement tool is limited is overcome, the container arrangement tool can transmit the container starting parameter which is not supported by the container arrangement tool in the annotation form but is set individually when the user needs to create the container in the container engine, the setting range of the type of the container starting parameter is expanded, and the setting flexibility is improved.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and together with the description, serve to explain the principles of the disclosure.
In order to more clearly illustrate the embodiments of the present disclosure or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the related art will be briefly described below, and it is obvious for those skilled in the art to obtain other drawings without inventive exercise.
FIG. 1 schematically illustrates a system architecture of a method and apparatus for creating containers suitable for use with embodiments of the present disclosure;
FIG. 2 schematically illustrates a flow diagram of a method of creating a container according to an embodiment of the present disclosure;
fig. 3 schematically shows a detailed implementation flowchart of operation S201 according to an embodiment of the present disclosure;
fig. 4 schematically shows a detailed implementation flowchart of operation S202 according to an embodiment of the present disclosure;
FIG. 5 schematically illustrates a flow diagram of a method of creating a container according to another embodiment of the disclosure;
FIG. 6 schematically shows a flow chart of a method of creating a container according to yet another embodiment of the present disclosure;
FIG. 7 schematically illustrates a flow diagram of a method of creating a container according to yet another embodiment of the present disclosure;
FIG. 8 schematically illustrates a block diagram of an apparatus for creating a container according to an embodiment of the present disclosure; and
fig. 9 schematically shows a block diagram of an electronic device provided in an embodiment of the present disclosure.
Detailed Description
In the related art, when a container is created based on a container editing tool, parameters transferred by the container editing tool to an application container have limitations, and only some container starting parameters commonly supported by the container editing tool and a container engine can be transferred and configured, for example, when the container editing tool is kubernets (abbreviated as k8s) and the container engine is docker, and a container is created through a k8s yaml file, most of parameters supported by k8s are parameters for controlling resources, such as memory parameters, cpu parameters, mount parameters, and the like, and the transferred container starting parameters are limited. For some container start parameters that a user needs to set individually, it is not possible to configure the start parameters through a container orchestration tool, for example, it is not possible to configure many other start parameters of a container through a k8s yaml file, such as start parameters of a shared memory (shmsize) of the container, a process number limit (pidslimit) in the container, a size of a virtual memory (memorysswappins) of the container, a kernel parameter (syscll) in the container, and the like.
In view of this, embodiments of the present disclosure provide a method, an apparatus, an electronic device, and a medium for creating a container, where the method includes: obtaining configuration information carried in the annotation, wherein the configuration information comprises information of user-defined starting parameters configured by a user; analyzing the configuration information to obtain analysis information of the user-defined starting parameter; and creating a container according to start-up parameter information, the start-up parameter information including the parsing information.
To make the objects, technical solutions and advantages of the embodiments of the present disclosure more clear, the technical solutions of the embodiments of the present disclosure will be described clearly and completely with reference to the drawings in the embodiments of the present disclosure, and it is obvious that the described embodiments are some embodiments of the present disclosure, but not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments disclosed herein without making any creative effort, shall fall within the protection scope of the present disclosure.
Fig. 1 schematically shows a system architecture of a method and apparatus for creating a container suitable for use in embodiments of the present disclosure.
Referring to fig. 1, a system architecture 100 suitable for use in the method and apparatus for creating a container according to the embodiments of the present disclosure includes: terminal devices 101, 102, 103, a network 104 and a server 105. The network 104 serves as a medium for providing communication links between the terminal devices 101, 102, 103 and the server 105. Network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few.
The user may use the terminal devices 101, 102, 103 to interact with the server 105 via the network 104 to receive or send messages or the like. Various types of messaging client applications may be installed on the terminal devices 101, 102, 103, such as shopping-like applications, web browser applications, search-like applications, instant messaging tools, mailbox clients, social platform software, etc. (by way of example only).
The terminal devices 101, 102, 103 may be various electronic devices having a display screen and supporting web browsing, such as electronic devices including but not limited to smartphones, tablets, laptops, desktop computers, smartwatches, and the like.
The server 105 may be a server providing various services, such as a background management server (for example only) providing support for websites browsed by users using the terminal devices 101, 102, 103. The background management server may analyze and perform other processing on the received data such as the user request, and feed back a processing result (e.g., a webpage, information, or data obtained or generated according to the user request) to the terminal device.
It should be noted that the method for creating a container provided by the embodiments of the present disclosure may be generally performed by the terminal device 101, 102, 103 or the server 105. Accordingly, the apparatus for creating a container provided by the embodiments of the present disclosure may be generally disposed in the terminal device 101, 102, 103 or in the server 105. The method for creating a container provided by the embodiments of the present disclosure may also be performed by a server or a server cluster different from the server 105 and capable of communicating with the terminal devices 101, 102, 103 and/or the server 105. Accordingly, the apparatus for creating a container provided by the embodiments of the present disclosure may also be disposed in a server or a server cluster different from the server 105 and capable of communicating with the terminal devices 101, 102, 103 and/or the server 105.
It should be understood that the number of terminal devices, networks, and servers in fig. 1 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
A first exemplary embodiment of the present disclosure provides a method of creating a container.
Fig. 2 schematically shows a flow chart of a method of creating a container according to an embodiment of the present disclosure.
Referring to fig. 2, a method for creating a container according to an embodiment of the present disclosure includes the following operations: s201, S202 and S203. For example, the operations S201 to S203 may be performed by a terminal device or a server.
In operation S201, configuration information carried in the annotation is obtained, where the configuration information includes information of a user-defined start parameter configured by a user.
The annotation (annotation) is "additional" information that can be arbitrarily defined by the user, and may include characters that the tag (label) does not allow to use, and it should be understood that the annotation may also include characters that the tag allows to use. The information of the user-configured custom starting parameter can be the user-configured custom starting parameter and a corresponding parameter value. The operation S201 is only to obtain the configuration information, and the specific content in the configuration information is obtained by analyzing in the subsequent operation S202.
In operation S202, the configuration information is parsed to obtain parsing information of the custom boot parameter.
After the configuration information is analyzed, the analysis information of the user-defined starting parameter and the corresponding parameter value carried in the configuration information can be obtained.
In operation S203, a container is created according to the startup parameter information, which includes the parsing information.
In the above operation S203, a container may be created according to the parsing information of the custom initiation parameter.
In the case of known startup parameters, the container may be created based on the startup parameters, for example, the container engine may create the container according to the parsed information of the custom startup parameters (corresponding to the custom startup parameters and corresponding parameter values) that has been parsed.
Based on the operations S201 to S203, the configuration information of the custom start parameter configured by the user is carried in the annotation form, and the analysis information of the custom start parameter is obtained after the configuration information is analyzed, so that the container can be created according to the analysis information of the custom start parameter, the technical defect that the parameter transmitted to the application container by the container arrangement tool has limitation is overcome, the container arrangement tool can transmit the container start parameter which is not supported by the container arrangement tool in the annotation form but is set individually when the user needs to create the container in the container engine, the setting range of the container start parameter types is expanded, and the setting flexibility is improved.
According to an embodiment of the present disclosure, the above-mentioned custom start-up parameter includes, but is not limited to, at least one of the following parameters: the method includes the steps of storing a container shared memory (shm), reserving a monitoring port of the container, controlling read-write speed parameters (such as device-read-bps, device-read-iops, device-write-bps, device-write-iops and the like) of a specific device, controlling access rights (device-group-rule) of the specific device, limiting the number of processes (pids-limit) in the container, kernel parameters (syscll) in the container, and the size of a virtual memory of the container.
Fig. 3 schematically shows a detailed implementation flowchart of operation S201 according to an embodiment of the present disclosure.
According to an embodiment of the present disclosure, referring to fig. 3, the operation S201 of acquiring the configuration information carried in the annotation includes the following sub-operations: s2011 and S2012.
At sub-operation S2011, information is received about custom initiation parameters configured by the user in the annotation of the container arrangement tool.
In sub-operation S2012, the configured annotation is transmitted to the container engine called by the container arrangement tool in the form of a tag, so as to obtain the configuration information carried in the annotation in the container engine.
For example, when the sub operations S2011 to S2012 are executed by a terminal device, the terminal device is installed with a container arrangement tool, where the container arrangement tool may be, for example, k8S, and the container arrangement tool may manage a cluster of container engines, and for example, k8S may create a container by calling one or more containers in the cluster of containers.
In the implementation scenario of sub-operation S2011, the way for the user to configure the information of the custom initiation parameter in the annotation may be: and the user inputs the information of the custom starting parameter to be configured in the annotation field of the container arrangement tool so as to realize the information configuration of the custom starting parameter. The information of the user-defined starting parameter configured by the user is received by the container arrangement tool of the terminal device, and since the container engine has the tag and does not have the annotation, the annotation configured by the container arrangement tool needs to be transmitted to the container engine called by the container arrangement tool in the form of the tag, so that the configuration information carried in the annotation is obtained in the container engine, and here, for the terminal device, only the configuration information is obtained, and the specific content of the configuration information needs to be obtained by parsing in the subsequent operation S202.
For example, in a specific embodiment, the user-defined start parameters that the user wants to configure are: the size of the shared memory (shmsize) of the container and the monitoring port of the reserved container enable a user to input a custom start parameter to be configured in the annotation of the container scheduling tool, so that information configuration of the custom start parameter is achieved.
Illustratively, the input form of the user configuring the size of the shared memory (shmsize) of the container and the listening port of the reserved container in the annotation is (full-angle and half-angle representation in the actual code is not shown here, and the actual code needs to conform to the corresponding half-angle form):
annotations:
jdcloud.com.shmsize:“1048576”
jdcloud.com.reservedport:“8818”
the information on the terminal device corresponding to the receipt of the custom initiation parameter configured by the user in the annotation of the container orchestration tool also takes the form described above.
In the above example form, annotation represents annotation, annotation is key-value pair form of key-value, special key form is required, jdclosed.com is prefix recognizable by container engine (e.g. docker), this prefix can be arbitrarily defined, shmsize represents shared memory, reservdport represents listening port of reserved container, and both shmsize and reservdport are user-configured custom start parameters; the value "1024576" after shmsize is the corresponding parameter value of this parameter of shared memory; the value "8818" after reservedport is the port name corresponding to the reserved listening port.
Since there is no concept of annotation in the container engine (e.g., docker), annotation in k8s will be passed as a label of docker, corresponding to the following expression in the container arrangement tool:
Figure BDA0003122626830000071
before configuring the annotations (annotations) carrying the size of the shared memory (shmsize) of the container and the information of the custom start parameters of the monitoring port of the reserved container, tags (labels) corresponding to the annotations to be configured subsequently are further defined in the open-source container scheduling tool, so that the configured annotations can be transmitted to the container engine called by the container scheduling tool in a tag form, so as to obtain the configuration information carried in the annotations in the container engine.
Fig. 4 schematically shows a detailed implementation flowchart of operation S202 according to an embodiment of the present disclosure.
According to an embodiment of the present disclosure, as shown in fig. 4, the operation S202 of parsing the configuration information to obtain the parsed information of the custom boot parameter includes the following sub-operations: s2021, S2022 and S2023.
In sub-operation S2021, a prefix in the above configuration information is identified.
In sub-operation S2022, based on the prefix, the key-value pair following the prefix is located.
In sub-operation S2023, the key-value pairs are parsed to obtain custom startup parameters and corresponding parameter values. The obtained analysis information of the custom starting parameter is as follows: and self-defining the starting parameters and the corresponding parameter values.
The sub-operations S2021 to S2023 may be executed by the terminal device, and may be specifically implemented by a container engine (e.g., docker) called by a container arrangement tool in the terminal device.
In the embodiment corresponding to the annotation carrying the information about the size of the shared memory (shmsize) of the container and the custom start parameter of the listening port of the reserved container, a prefix in the configuration information may be identified by a container engine (e.g., docker): com. Then, based on the prefix jdclosed.com, locating the key-value pair after the prefix jdclosed.com, and locating the key-value pair respectively: shmsize: "1048576" and key-value pairs reservedport: "8818". By resolving key-value pairs: shmsize: "1048576", the parsing information of a custom startup parameter that can be obtained from the user configuration is: the shared memory is 1048576 k; by parsing the key-value pairs reservedport: "8818", the parsing information of another custom startup parameter configured by the user can be obtained as follows: the listening port 8818 of the container is reserved.
Fig. 5 schematically shows a flow chart of a method of creating a container according to another embodiment of the present disclosure.
Referring to fig. 5, the method for creating a container according to the embodiment of the present disclosure includes, in addition to the operations S201 and S202, an operation S203' and an operation S501 for creating a container according to the start parameter information: and adding the analysis information of the user-defined starting parameter into a container initial configuration file, wherein the container initial configuration file contains the predefined starting parameter information.
The original operation S203 is denoted as operation S203', and in this embodiment, the startup parameter information further includes predefined startup parameter information in addition to the parsing information of the custom startup parameters. The above operation S203' of creating a container according to the start parameter information includes: and creating a container according to the analysis information of the self-defined starting parameter and the predefined starting parameter information.
The above operation S501 may be performed after the operation S202 and before the operation S203'.
The analytic information of the user-defined starting parameters obtained through analysis is added to the container initial configuration file, so that a container configuration file containing the analytic information of the user-defined starting parameters and the predefined starting parameter information is formed, when the terminal equipment creates a container based on a container engine, the container can be created based on the parameters in the container configuration file, and a container with user-customized setting parameters (the analytic information corresponding to the user-defined starting parameters) and default preset parameters (the predefined starting parameter information) is formed.
In an application scenario of the cloud service, the user in the sub-operation S2011 may be a user of the cloud service, for example, an enterprise or an individual using the cloud service, and the enterprise or the individual may configure information of the custom start parameter in an annotation form according to a requirement of the enterprise or the individual, so as to create a container close to the requirement of the enterprise.
Fig. 6 schematically shows a flow chart of a method of creating a container according to yet another embodiment of the present disclosure.
On the basis of the foregoing embodiment including operations S201, S202, S203' and S501, referring to fig. 6, the method for creating a container provided by the embodiment of the present disclosure further includes the following operations S601 and S602, and in fig. 6, for the sake of simplicity, only operation S501 and operations S601 to S602 are illustrated.
In operation S601, predefined start parameter information set in the container engine by a user having a configuration right is received.
In operation S602, a container initial profile is generated according to the predefined start parameter information.
The operations S601 to S602 may be executed by the terminal device, for example, may be specifically implemented by a container engine (e.g., docker) called by a container arrangement tool in the terminal device.
In an application scenario of the cloud service, the user having the configuration right in operation S601 may be a provider of the cloud service, for example, a provider of the cloud service, and the provider has a right to set predefined startup parameter information in the container engine. The predefined starting parameter information can be general parameter settings for most cloud service users, and can also comprise parameter settings for optimizing the operation performance of the container.
For example, the predefined startup parameters referred to by the predefined startup parameter information may be a memory-swap parameter (which may correspond to the size of the virtual memory of the container described above, and the technical term may be described as a container kernel anonymous page swap ratio), syscltl, and the like. In a practical application scenario, for most cloud service users who are not interested in this parameter, the provider of the cloud service may default to configure the value of this predefined start-up parameter memory-swappines to be 0 to turn off the above function, so as to avoid performance loss of the container exchange agent.
It should be understood that, in some scenarios with special requirements, if there is a need for setting a memory-swap parameter, a user of the cloud service may configure the memory-swap parameter as information of a configured custom start parameter in an annotation form, and then in a process of creating a container according to the parsing information of the custom start parameter and the predefined start parameter information, if the same parameter is included in the parsing information of the custom start parameter and the predefined start parameter information, the priority of the parsing information of the custom start parameter is higher than the priority of the predefined start parameter information, and the setting is performed according to the parameter value of the custom start parameter.
The predefined startup parameter may also be, for example, a kernel parameter sysctl in a container, which contains a series of kernel parameters. In a general scenario, the user of the cloud service is not very interested in this parameter, and the provider of the cloud service can preset the parameter as a predefined parameter. The sysctl parameter includes, for example, a parameter controlling tcp connection: the size of a net, core, somaxconn tcp connection listening queue is 128 as default in the system, and the parameter value is set to be larger in the embodiment, so that the service which often processes new requests is prevented from rejecting new requests due to the fact that the listening queue is full; the upper limit of the net, ipv4, tcp _ max _ syn _ backlog semi-connected queue and the default 128 of the system are larger in parameter value setting in the embodiment, so that the problem that the client cannot be connected when a large number of network connections are processed is prevented, the default 128 is smaller in the two default 128, the current server performance is considered to be good, the parameter value can be enlarged to process more requests when the predefined parameter is configured, and parameter setting for optimizing the operation performance of the container is realized.
FIG. 7 schematically illustrates a flow diagram of a method of creating a container according to yet another embodiment of the disclosure.
On the basis of the foregoing embodiment including operations S201, S202, S203', S501, S601 and S602, referring to fig. 7, the method for creating a container according to the embodiment of the present disclosure further includes the following operation S701 of updating the predefined starting parameter information. In fig. 7, only operation S701 and operations S601 to S602 are illustrated for the sake of simplicity of illustration.
The operation S602 of generating the container initial configuration file according to the predefined starting parameter information includes: and generating a container initial configuration file according to the updated predefined starting parameter information.
The provider of the cloud service may update the predefined startup parameter information, where the updating includes: adding predefined starting parameter information, deleting the predefined starting parameter information and modifying the predefined starting parameter information. After receiving the update information of the predefined startup parameter information, the container engine generates a container initial configuration file according to the updated predefined startup parameter information, so that a container configuration file containing the analysis information of the custom startup parameter and the updated predefined startup parameter information is formed, and in the process of creating a container according to the analysis information of the custom startup parameter and the predefined startup parameter information, the container is created based on the updated container configuration file, so that the update and personalized setting of the container startup parameter are realized.
A second exemplary embodiment of the present disclosure provides an apparatus for creating a container.
Fig. 8 schematically shows a block diagram of an apparatus for creating a container according to an embodiment of the present disclosure.
Referring to fig. 8, an apparatus 800 for creating a container according to an embodiment of the present disclosure includes: an information acquisition module 801, a parsing module 802, and a container creation module 803.
The information obtaining module 801 is configured to obtain configuration information carried in the annotation, where the configuration information includes information of a user-defined start parameter configured by a user.
The information obtaining module 801 may be a functional module or a sub-module, which is arranged in the container arrangement tool and the container engine and is used for obtaining information, and is configured to receive information of a custom start parameter configured in a comment of the container arrangement tool by a user; and transmitting the configured annotation to a container engine called by the container arrangement tool in a tag form so as to obtain the configuration information carried in the annotation in the container engine.
The parsing module 802 is configured to parse the configuration information to obtain parsing information of the custom startup parameter. The parsing module 802 may be a functional module or a sub-module provided in the container engine to implement sub-operations S2021 to S2023.
The container creating module 803 is configured to create a container according to the startup parameter information, where the startup parameter information includes the parsing information. The container creation module 803 may be a functional module or a sub-module provided in the container engine for implementing container creation.
According to an embodiment of the present disclosure, the apparatus 800 includes, in addition to the information obtaining module 801, the parsing module 802, and the container creating module 803: and a parameter adding module. The parameter adding module is used for adding the analysis information of the user-defined starting parameter into a container initial configuration file, and the container initial configuration file contains predefined starting parameter information.
According to an embodiment of the present disclosure, the apparatus 800 may further include: the device comprises a predefined starting parameter information receiving module and an initial configuration file generating module.
The predefined starting parameter information receiving module is used for receiving predefined starting parameter information set in the container engine by a user with configuration authority.
The initial configuration file generating module is used for generating a container initial configuration file according to the predefined starting parameter information.
According to an embodiment of the present disclosure, the apparatus 800 may further include: and the predefined starting parameter information updating module is used for updating the predefined starting parameter information.
The initial configuration file generation module is further configured to generate a container initial configuration file according to the updated predefined startup parameter information.
Any number of the information acquisition module 801, the parsing module 802, and the container creation module 803 may be combined and implemented in one module, or any one of the modules may be split into multiple modules. Alternatively, at least part of the functionality of one or more of these modules may be combined with at least part of the functionality of the other modules and implemented in one module. At least one of the information obtaining module 801, the parsing module 802 and the container creating module 803 may be implemented at least partially as a hardware circuit, such as a Field Programmable Gate Array (FPGA), a Programmable Logic Array (PLA), a system on a chip, a system on a substrate, a system on a package, an Application Specific Integrated Circuit (ASIC), or may be implemented in hardware or firmware in any other reasonable manner of integrating or packaging a circuit, or in any one of three implementations of software, hardware and firmware, or in any suitable combination of any of them. Alternatively, at least one of the information obtaining module 801, the parsing module 802 and the container creation module 803 may be at least partially implemented as a computer program module, which when executed, may perform corresponding functions.
A third exemplary embodiment of the present disclosure provides an electronic apparatus.
Fig. 9 schematically shows a block diagram of an electronic device provided in an embodiment of the present disclosure.
Referring to fig. 9, an electronic device 900 provided in the embodiment of the present disclosure includes a processor 901, a communication interface 902, a memory 903, and a communication bus 904, where the processor 901, the communication interface 902, and the memory 903 complete communication with each other through the communication bus 904; a memory 903 for storing computer programs; the processor 901 is configured to implement the method for creating a container as described above when executing the program stored in the memory.
A fourth exemplary embodiment of the present disclosure also provides a computer-readable storage medium. The above-mentioned computer-readable storage medium has stored thereon a computer program which, when being executed by a processor, implements the method of creating a container as described above.
The computer-readable storage medium may be contained in the apparatus/device described in the above embodiments; or may be present alone without being assembled into the device/apparatus. The computer-readable storage medium carries one or more programs which, when executed, implement the method according to an embodiment of the disclosure.
According to embodiments of the present disclosure, the computer-readable storage medium may be a non-volatile computer-readable storage medium, which may include, for example but is not limited to: a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
It is noted that, in this document, relational terms such as "first" and "second," and the like, may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, 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 an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
The foregoing are merely exemplary embodiments of the present disclosure, which enable those skilled in the art to understand or practice the present disclosure. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the disclosure. Thus, the present disclosure is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (10)

1. A method of creating a container, comprising:
obtaining configuration information carried in the annotation, wherein the configuration information comprises information of user-defined starting parameters configured by a user;
analyzing the configuration information to obtain the analysis information of the user-defined starting parameter; and
creating a container according to startup parameter information, the startup parameter information including the parsing information.
2. The method according to claim 1, wherein the obtaining configuration information carried in the annotation comprises:
receiving information of a user-defined starting parameter configured in the annotation of the container arrangement tool by a user; and
and transmitting the configured annotation into a container engine called by the container arrangement tool in a tag form so as to obtain the configuration information carried in the annotation in the container engine.
3. The method of claim 1, wherein the parsing the configuration information to obtain parsed information of the custom boot parameter comprises:
identifying a prefix in the configuration information;
based on the prefix, locating a key-value pair that follows the prefix; and
and analyzing the key-value pair to obtain a self-defined starting parameter and a corresponding parameter value.
4. The method of claim 1, further comprising:
adding the analysis information of the user-defined starting parameter into a container initial configuration file, wherein the container initial configuration file contains predefined starting parameter information;
wherein the creating a container according to the initiation parameter information comprises:
and creating a container according to the analysis information of the custom starting parameter and the predefined starting parameter information.
5. The method of claim 4, further comprising:
receiving predefined starting parameter information set in the container engine by a user with configuration authority; and
generating a container initial configuration file according to the predefined starting parameter information.
6. The method of claim 5, further comprising:
updating the predefined startup parameter information;
wherein the generating a container initial configuration file according to the predefined start-up parameter information comprises:
and generating a container initial configuration file according to the updated predefined starting parameter information.
7. The method of any of claims 1-6, wherein the custom initiation parameters comprise at least one of: the method comprises the steps of storing the size of a shared memory of a container, reserving a monitoring port of the container, controlling a read-write speed parameter of a specific device, controlling an access right of the specific device, limiting the number of processes in the container, storing a kernel parameter in the container and storing the size of a virtual memory of the container.
8. An apparatus for creating a container, comprising:
the information acquisition module is used for acquiring configuration information carried in the annotation, wherein the configuration information comprises information of user-defined starting parameters configured by a user;
the analysis module is used for analyzing the configuration information to obtain analysis information of the user-defined starting parameter; and
a container creation module to create a container according to a startup parameter, the startup parameter including the parsing information.
9. An electronic device is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory are communicated with each other through the communication bus;
a memory for storing a computer program;
a processor for implementing the method of any one of claims 1 to 7 when executing a program stored on a memory.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the method of any one of claims 1-7.
CN202110680484.9A 2021-06-18 2021-06-18 Method and device for creating container, electronic equipment and medium Pending CN113608819A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110680484.9A CN113608819A (en) 2021-06-18 2021-06-18 Method and device for creating container, electronic equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110680484.9A CN113608819A (en) 2021-06-18 2021-06-18 Method and device for creating container, electronic equipment and medium

Publications (1)

Publication Number Publication Date
CN113608819A true CN113608819A (en) 2021-11-05

Family

ID=78336605

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110680484.9A Pending CN113608819A (en) 2021-06-18 2021-06-18 Method and device for creating container, electronic equipment and medium

Country Status (1)

Country Link
CN (1) CN113608819A (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20180373551A1 (en) * 2017-03-21 2018-12-27 Aaron Christensen Systems and methods for using dynamic templates to create application containers
CN110221901A (en) * 2019-06-06 2019-09-10 深圳前海微众银行股份有限公司 Container asset creation method, apparatus, equipment and computer readable storage medium
CN110795135A (en) * 2018-08-01 2020-02-14 北京京东尚科信息技术有限公司 Method and device for realizing injection-resolution configuration
CN111917586A (en) * 2020-08-07 2020-11-10 北京凌云雀科技有限公司 Container bandwidth adjusting method, server and storage medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20180373551A1 (en) * 2017-03-21 2018-12-27 Aaron Christensen Systems and methods for using dynamic templates to create application containers
CN110795135A (en) * 2018-08-01 2020-02-14 北京京东尚科信息技术有限公司 Method and device for realizing injection-resolution configuration
CN110221901A (en) * 2019-06-06 2019-09-10 深圳前海微众银行股份有限公司 Container asset creation method, apparatus, equipment and computer readable storage medium
CN111917586A (en) * 2020-08-07 2020-11-10 北京凌云雀科技有限公司 Container bandwidth adjusting method, server and storage medium

Similar Documents

Publication Publication Date Title
US9621592B2 (en) System and method for software defined deployment of security appliances using policy templates
US9548897B2 (en) Network entity registry for network entity handles included in network traffic policies enforced for a provider network
US11108871B2 (en) Dynamic generation of network routing configuration with service requirements
US20180198839A1 (en) Automatic Discovery of Management Nodes and Generation of CLI Using HA Module
US10135763B2 (en) System and method for secure and efficient communication within an organization
CN109815384B (en) Crawler implementation method, system, equipment and storage medium
US11531526B1 (en) Creating portable serverless applications
US11627169B2 (en) Network-based Media Processing (NBMP) workflow management through 5G Framework for Live Uplink Streaming (FLUS) control
WO2021041043A1 (en) Systems and methods for in-application dynamic content loading
US20180239516A1 (en) Methods for generating and publishing microsites and devices thereof
US11494184B1 (en) Creation of transportability container files for serverless applications
US10691764B2 (en) Search engine optimization techniques
CN113923023A (en) Authority configuration and data processing method, device, electronic equipment and medium
JP7474273B2 (en) Using a client computer for document processing
US9537931B2 (en) Dynamic object oriented remote instantiation
CN113726855B (en) Service aggregation method, device, electronic equipment and computer-readable storage medium
CN113608819A (en) Method and device for creating container, electronic equipment and medium
US11513833B1 (en) Event listener interface for container-based execution of serverless functions
US10462237B1 (en) Browser-based workflows
CN113839821A (en) Method, device, system, equipment and medium for deploying cluster and constructing infrastructure
US20210203545A1 (en) Automated configuration and deployment of contact center software suite
US11513782B1 (en) Unrestricted to restricted computing framework
US20210281629A1 (en) Processing of web-based applications
JP7418223B2 (en) System and method for blocking advertisements on computing devices
US11178215B1 (en) Transparent support and translation for client-provided identifiers in service requests

Legal Events

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