CN117032739B - Mirror image generation method, system, storage medium and electronic equipment - Google Patents

Mirror image generation method, system, storage medium and electronic equipment Download PDF

Info

Publication number
CN117032739B
CN117032739B CN202311285993.7A CN202311285993A CN117032739B CN 117032739 B CN117032739 B CN 117032739B CN 202311285993 A CN202311285993 A CN 202311285993A CN 117032739 B CN117032739 B CN 117032739B
Authority
CN
China
Prior art keywords
file
image
resource
information
instruction
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.)
Active
Application number
CN202311285993.7A
Other languages
Chinese (zh)
Other versions
CN117032739A (en
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.)
Zhejiang Lab
Original Assignee
Zhejiang Lab
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 Zhejiang Lab filed Critical Zhejiang Lab
Priority to CN202311285993.7A priority Critical patent/CN117032739B/en
Publication of CN117032739A publication Critical patent/CN117032739A/en
Application granted granted Critical
Publication of CN117032739B publication Critical patent/CN117032739B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/61Installation
    • G06F8/63Image based installation; Cloning; Build to order
    • 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/445Program loading or initiating
    • G06F9/44505Configuring for program initiating, e.g. using registry, configuration files
    • G06F9/4451User profiles; Roaming
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The specification discloses a method, a system, a storage medium and an electronic device for generating an image, comprising: and determining the environment information of the basic image required by the generation of the target image file selected by the user, and displaying the environment information to the user. And determining resource information of other resources required by generating the target image file based on the basic image, and determining the material file required by generating the target image file from a resource library according to the resource information. And generating an instruction file corresponding to the target mirror image file by adopting a specified rule according to the environment information and the resource information. And according to the material file and the basic mirror image and the instruction in the instruction file, automatically completing the construction of the target mirror image. The system and the method enable a user not to grasp complex image construction grammar, reduce the technical threshold of target image construction, quickly generate the target image meeting the requirements, and improve the efficiency of image construction.

Description

Mirror image generation method, system, storage medium and electronic equipment
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a method, a system, a storage medium, and an electronic device for generating a mirror image.
Background
With the continuous development of technology, cloud technology is becoming mature. The cloud native technology has more application scenes, and can be rapidly and simply deployed on different devices by using the mirroring technology and the container technology.
In the prior art, due to the difference of hardware devices, the difference of user demands and the difference of application scenes, users are required to manufacture corresponding image files so as to meet the requirements of the differentiation on the image files. For example, when the same application is installed on several hosts, for each host, the user needs to configure the running environment of the application on the host. To avoid having to configure the application's operating environment once every time an application is installed on a host, the application's operating environment may be mirrored in advance. Therefore, when the application program is installed each time, the image file of the configured running environment can be directly migrated to the host computer needing to be configured.
Therefore, how to generate the mirror image to meet the needs of the user is an important issue. Based on this, the present specification provides a method of mirror image generation.
Disclosure of Invention
The present disclosure provides a method, an apparatus, a storage medium, and an electronic device for generating an image, so as to partially solve the foregoing problems in the prior art.
The technical scheme adopted in the specification is as follows:
the specification provides a method for generating an image, which comprises the following steps:
responding to the selection operation of a user, and determining a basic image required for generating a target image file from a pre-configured resource library;
determining the environment information of the basic mirror image and displaying the environment information to the user;
determining resource information of other resources required for generating the target image file based on the base image in response to input operation of the user, wherein the resource information at least comprises one of an installer identifier, an installer configuration source identifier and information of a software framework;
determining files required for generating the target image file from the resource library according to the resource information, taking the files as material files, and copying the material files to a designated directory;
according to the environment information and the resource information, adopting a specified rule to generate an instruction file corresponding to the target image file under the specified directory;
and calling a mirror image construction technology according to the material file and the basic mirror image and the instruction in the instruction file to generate the target mirror image file.
Optionally, before determining the base image required for generating the target image file from the pre-configured repository in response to the user's selection operation, the method further comprises:
displaying a pre-configured resource library to a user, wherein the resource library comprises mirror image resources, installer configuration source resources and software framework resources;
and responding to the uploading operation of the user, determining a resource file uploaded by the user, and storing the resource file into the resource library.
Optionally, determining the environment information of the base image specifically includes:
performing image detection on the basic image to obtain an image detection result of the basic image, wherein the basic image at least comprises an environment kernel and an operating system;
and determining the environment information of the basic mirror image according to the mirror image detection result, wherein the environment information at least comprises the information of the environment kernel and the information of the operating system.
Optionally, according to the resource information, determining a file required for generating the target image file from the resource library, wherein the file is used as a material file and specifically comprises:
judging whether a file of a resource corresponding to the resource information exists in the resource library;
If yes, determining an executable file of an installer corresponding to the installer identifier, a configuration source file corresponding to the installer configuration source identifier and an installation file corresponding to the information of the software framework from the resource library according to the installer identifier, the installer configuration source identifier and the software framework information; taking the executable file, the configuration source file and the installation file as material files required for generating the target image file;
if not, sending a resource acquisition request to an external remote file warehouse according to the resource information, so that the external remote file warehouse inquires a file of a resource corresponding to the resource information according to the resource information and returns the file; and receiving the file returned by the external remote file warehouse, and taking the file as a material file required for generating the target image file.
Optionally, according to the environment information and the resource information, a specified rule is adopted, and an instruction file corresponding to the target image file is generated under the specified directory, which specifically includes:
determining an installation rule of an installer corresponding to the installer identifier according to the installer identifier;
According to the environment information and the resource information, adopting a specified rule to generate a basic mirror image instruction, a resource configuration instruction and a file instruction; generating an installer installation instruction corresponding to the installer identifier and an installation instruction of the software framework by adopting the specified rule according to the installation rule and the software framework information; the file instruction is an instruction for copying the material file from the appointed directory;
and generating an instruction file corresponding to the target image file under the appointed directory according to the basic image instruction, the resource configuration instruction, the file instruction, the installer installation instruction corresponding to the installer identifier and the software framework installation instruction.
The specification provides a system for generating an image, which comprises a resource management module, an image management module and an image construction module, wherein:
the resource management module is used for storing a pre-configured resource library;
the mirror image management module is used for storing mirror image resources;
the image construction module is used for responding to input operation of a user, acquiring a basic image required by generating a target image file from image resources stored in the image management module, determining environment information of the basic image, displaying the environment information to the user, responding to the input operation of the user, determining resource information of other resources required by generating the target image file based on the basic image, acquiring a file required by generating the target image file from a resource library in the resource management module according to the resource information, taking the file as a material file, copying the material file to a designated directory, adopting a designated rule according to the environment information and the resource information, generating an instruction file corresponding to the target image file under the designated directory, and calling an image construction technology according to instructions in the instruction file and the material file and the basic image, wherein the resource information at least comprises one of an installer identifier, an installer configuration source identifier and information of a software framework.
Optionally, the resource management module is further configured to display the resource library to a user, determine a resource file uploaded by the user in response to an upload operation of the user, and store the resource file in the resource library, where the resource library includes an installer resource, an installer configuration source resource, and a software framework resource.
Optionally, the image management module is further configured to perform image detection on an image to obtain an image detection result, determine environment information of the image according to the image detection result, and store the environment information, where the image at least includes an environment kernel and an operating system, and the environment information at least includes information of the environment kernel and information of the operating system.
The image construction module is specifically configured to determine, from the environment information of the image stored by the image management module, environment information corresponding to the base image.
Optionally, the image construction module is specifically configured to determine whether a resource file corresponding to the resource information exists in the resource library, if yes, determine, from the resource library in the resource management module, an executable file of an installer corresponding to the installer identifier, a configuration source file corresponding to the installer configuration source identifier, and an installation file corresponding to information of the software framework according to the installer identifier, the installer configuration source identifier, and the software framework, and use the executable file, the configuration source file, and the installation file as a material file required for generating the target image file, if no, send a resource acquisition request to an external remote file repository according to the resource information, so that the external remote file repository queries, according to the resource information, a resource file corresponding to the resource information, returns, receives a file returned by the external remote file repository, and uses the file as a material file required for generating the target image file.
Optionally, the image construction module is specifically configured to determine, according to the installer identifier, an installation rule of an installer corresponding to the installer identifier, and according to the environment information and the resource information, apply a specified rule to generate a base image instruction, a resource configuration instruction, and a file instruction, and according to the installation rule and the software frame information, apply the specified rule to generate an installation instruction of the installer corresponding to the installer identifier and an installation instruction of the software frame, and according to the base image instruction, the resource configuration instruction, the file instruction, an installation instruction of the installer corresponding to the installer identifier, and an installation instruction of the software frame, generate, under the specified directory, an instruction file corresponding to the target image file, where the file instruction is an instruction for copying the material file from the specified directory.
The present specification provides a computer readable storage medium storing a computer program which when executed by a processor implements the above-described method of image generation.
The present specification provides an electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the method of image generation described above when executing the program.
The above-mentioned at least one technical scheme that this specification adopted can reach following beneficial effect:
according to the image generation method provided by the specification, firstly, a basic image required for generating the target image file is determined from a pre-configured resource library in response to the selection operation of a user, and then the environment information of the basic image is determined and displayed to the user. Then, in response to an input operation by the user, resource information of other resources required to generate the target image file based on the base image is determined. And determining files required for generating the target image file from the resource library according to the resource information, taking the files as material files, and copying the material files to a specified directory. And then, generating an instruction file corresponding to the target mirror image file under the specified directory by adopting a specified rule according to the environment information and the resource information. And calling a mirror image construction technology according to the material file and the basic mirror image and the instructions in the instruction file to generate a target mirror image file.
According to the method, when the image is generated, environment information of the basic image required by the generation of the target image file is determined and displayed to the user through responding to the selection operation of the user, resource information of other resources required by the generation of the target image file based on the basic image is determined and material files required by the generation of the target image file are determined from a resource library according to the resource information. And then according to the environment information and the resource information, adopting a specified rule to generate an instruction file corresponding to the target mirror image file, and according to the material file and the basic mirror image and the instruction in the instruction file, invoking a mirror image construction technology to generate the target mirror image file, so that a user does not need to grasp a complex mirror image construction grammar and manually configure the target mirror image, the technical threshold of the construction of the target mirror image is reduced, the target mirror image meeting the requirements can be quickly generated, and the efficiency of constructing the mirror image is improved.
Drawings
The accompanying drawings, which are included to provide a further understanding of the specification, illustrate and explain the exemplary embodiments of the present specification and their description, are not intended to limit the specification unduly. In the drawings:
FIG. 1 is a flow chart of a method of mirror image generation provided in the present specification;
FIG. 2 is a schematic diagram of a mirror image generation system of one of the types provided in this specification;
FIG. 3 is a schematic diagram of another mirror image generation system provided herein;
FIG. 4 is a schematic diagram of a resource management module provided herein;
FIG. 5 is a schematic diagram of a mirror management module provided in the present specification;
FIG. 6 is a schematic diagram of a mirror image build module provided in this specification;
FIG. 7 is a schematic diagram of a data storage module provided herein;
FIG. 8 is a schematic diagram of an overall mirror image generation system provided herein;
fig. 9 is a schematic structural diagram of an electronic device corresponding to fig. 1 provided in the present specification.
Detailed Description
For the purposes of making the objects, technical solutions and advantages of the present specification more apparent, the technical solutions of the present specification will be clearly and completely described below with reference to specific embodiments of the present specification and corresponding drawings. It will be apparent that the described embodiments are only some, but not all, of the embodiments of the present specification. All other embodiments, which can be made by one of ordinary skill in the art without undue burden from the present disclosure, are intended to be within the scope of the present disclosure.
The following describes in detail the technical solutions provided by the embodiments of the present specification with reference to the accompanying drawings.
Fig. 1 is a flow chart of a method for generating an image provided in the present specification, which includes the following steps:
s100: and determining a basic image required for generating the target image file from a pre-configured resource library in response to a selection operation of a user.
In this specification, the apparatus for generating an image may determine a base image required to generate a target image file from a pre-configured repository in response to a selection operation by a user. The device for generating the image may be a server, or may be an electronic device such as a desktop computer or a notebook computer. For convenience of description, a method of generating an image provided in the present specification will be described below with only a server as an execution subject. The preconfigured resource library is a preconfigured resource required for generating the mirror image, and may at least include a mirror image resource, and of course, may also include an installer resource, an installer configuration source resource, a software framework resource, and the specific type of the resource is not specifically limited in this specification. The mirror image resources can be directly stored in the resource library or can be stored in a mirror image warehouse in the resource library, and the specification is not particularly limited. The installer resource is a pre-downloaded or configured installer, the installer configuration source resource is a pre-downloaded or configured installer configuration source resource, the software framework resource is a pre-downloaded or configured software related resource, and the software framework resource can comprise executable files of the software, files of a software dependent installation environment, configured files required by installing the software and the like. The software-dependent installation environment is an environment required for installing software or an environment required for running software, such as a Python environment. The configuration required to install the software includes a version number of the software, an installer identification for installing the software, and the like. The installer is a management tool depending on software in an operating system, and common installers include an installer such as YUM (full scale Yellow dog Updater Modified), APT (full scale Advanced Packaging Tool) and PIP (full scale package installer for python), and the installer can be used for installing software. The installer configuration source is an installer configuration file.
The base image is a preconfigured image of the server, a user can select the preconfigured base image first and then generate a target image based on the base image, so that the server responds to the selection operation of the user, and determines the image selected by the user from a preconfigured resource library as the base image, namely, determines the base image required by generating the target image file. The base image at least comprises an environment kernel and an operating system, and can also comprise an installer, an installer source, a software framework and the like.
S102: and determining the environment information of the basic mirror image and displaying the environment information to the user.
The server determines the environment information of the base image and displays the environment information to the user. Specifically, the server may perform image detection on the base image selected by the user to obtain an image detection result of the base image, and then determine environmental information of the base image according to the image detection result. The environment information at least comprises information of an environment kernel and information of an operating system. The environment information may also include installer information, installer configuration source information, and information of the software framework. The installer information may include an installer identification, the installer configuration source information may include an installer configuration source identification, and the information of the software framework may include software information, a software-dependent installation environment, an installer used by the software, and interactive software information, etc. The image detection result represents information contained in the image and is obtained by carrying out image detection on the image. Different images contain different information, so the image detection results of the different images are different. When the mirror image is detected, any existing means may be used to detect the mirror image, for example, by querying metadata of the mirror image, which is not specifically limited in this specification. In addition, the image detection is used for detecting information contained in the images, and specifically, the image detection is used for detecting information contained in each image. For the information contained in each mirror image, the server can detect the information by adopting a detection mode corresponding to the information. If the information is not detected in the mirror image, the fact that the information is not contained in the mirror image is indicated, so that the detection result of the information in the mirror image detection result of the mirror image is empty, and the environment information determined according to the mirror image detection result does not contain the information. If the information is detected in the mirror image, the information is included in the mirror image, so that the information exists in the mirror image detection result of the mirror image, and the environment information determined according to the mirror image detection result subsequently includes the information. For example, assume that the mirror image 1 includes at most three types of information, and the detection is performed according to the detection mode corresponding to the three types of information, and assume that the server detects only two types of information in the mirror image 1, so that the mirror image detection result of the mirror image 1 is two types of detected information, and the other type of information which is not detected is null.
Of course, the mirror image detection result of the mirror image may be obtained by performing mirror image detection on the mirror image in advance by the server. Therefore, the server can determine the mirror image detection result of the basic mirror image from the mirror image detection results of the mirror images obtained in advance according to the basic mirror image selected by the user, and determine the environment information of the basic mirror image according to the mirror image detection result, and display the environment information to the user.
In addition, since the mirror image detection result of the mirror image can be obtained by carrying out mirror image detection on the mirror image in advance, the environment information of the basic mirror image can also be obtained in advance according to the mirror image detection result, so that the server can directly determine the environment information of the basic mirror image from the environment information of each mirror image obtained in advance according to the basic mirror image selected by the user.
In this specification, when the target image is generated based on the base image, since the base image does not include all the resources that the user expects to include in the target image, that is, the resources that the user expects to include in the target image or images, the base image does not include the resource or resources. For example, the base image only includes the environment kernel and the operating system, and the target image needs to include the resource of the installer in addition to the environment kernel and the operating system in the base image. Therefore, in order to enable the user to acquire the resources contained in the base image, determine the difference between the base image and the target image, the environment information of the base image selected by the user can be displayed to the user, so that the user can acquire the information of the resources contained in the base image selected by the user, and determine the difference between the base image and the target image expected to be generated by the user according to the acquired information of the resources contained in the base image (namely, the environment information), namely, the information of the resources contained in the base image and the information of the resources required to be generated by the target image, when the target image is generated based on the base image, the information of the resources required to be contained in the target image but the information of the resources not contained in the base image can be displayed to the user, and the subsequent user can add the resources to the base image by inputting the information of the resources according to the determined information of the resources not contained in the base image and the resources required to be generated by the target image, so as to generate the target image file.
S104: and determining resource information of other resources required for generating the target image file based on the basic image in response to the input operation of the user, wherein the resource information at least comprises one of an installer identifier, an installer configuration source identifier and information of a software framework.
The server responds to input operation of a user, and determines resource information of other resources required for generating the target image file based on the basic image, wherein the resource information at least comprises one of an installer identifier, an installer configuration source identifier and information of a software framework. The installer identifier may be the name of the installer or may be a number or letter representing the installer, which is not specifically limited in this specification.
Because the base image is a pre-configured image of the server and has a difference with the target image expected by the user, after the environmental information of the base image is determined in the step S102 and displayed to the user, the user can determine the information of the resources which are not included in the base image in the resources which are needed to be included in the target image according to the environmental information of the base image, and then add the resources to the base image by inputting the information of the resources according to the information of the resources so as to generate the target image file. Accordingly, the server determines resource information of other resources required to generate the target image file in addition to the base image in response to an input operation of the user. The environment information of the base image at least includes environment kernel information and operating system information, so that other resources at least include one of an installer resource, an installer configuration source resource and a software framework resource, so that the resource information at least includes one of an installer identifier, an installer configuration source identifier and information of the software framework, and the resource information may also include a target image name, which is not specifically limited in this specification. For example, the environment information of the base image selected by the user includes environment kernel information of "Linux: 4.15.0-197-genericx86_ 64 x86_64 x86_64 GNU/Linux", the operating system information is "Ubuntu:18.04.6 LTS (Bionic loader)", and the user desires an installer including a PIP and a software torch installed depending on the installer PIP in the target image file, so the resource information input by the user may include an identifier of the installer PIP, an installer PIP configuration source identifier and information of the software torch installed depending on the installer PIP (i.e., information of a software framework).
S106: and determining files required for generating the target image file from the resource library according to the resource information, taking the files as material files, and copying the material files to a specified directory.
The server may determine files required for generating the target image file from the repository according to the resource information, as material files, and copy the material files to the specified directory. The specified directory may be any preset file directory. Specifically, the server may determine, from the resource library, an image file of the base image and a resource file corresponding to the resource information according to the resource information and the base image, use the image file and the resource file as material files required for generating the target image file, and copy the material files to the specified directory.
In this specification, when the resource information includes information of an installer identifier, an installer configuration source identifier, and a software framework, the server may determine, from the resource library, an executable file of an installer corresponding to the installer identifier, a configuration source file corresponding to the installer configuration source identifier, and an installation file corresponding to the information of the software framework according to the installer identifier, the installer configuration source identifier, and the software framework information. And taking the executable file, the configuration source file and the installation file as material files required for generating the target image file.
The above-mentioned processes of determining the executable file of the installer, determining the configuration source file, and determining the installation file may be performed in no order, or may be performed simultaneously.
S108: and generating an instruction file corresponding to the target image file under the specified directory by adopting a specified rule according to the environment information and the resource information.
The server can adopt a specified rule according to the environment information and the resource information, and generate an instruction file corresponding to the target mirror image file under the specified directory. The specified rule is a preset grammar rule for generating instructions. Specifically, the server may determine the base mirror instruction according to the environmental information and the specified rule. And determining a parameter instruction of the target image file according to the resource information and the specified rule. And generating an instruction file corresponding to the target image file under the specified directory according to the basic image instruction and the parameter instruction. The base image instruction may be an instruction for designating a base image, for example, the file name of the base image is nvidia-cuda:11.8.0, and then the instruction for designating the base image may be "FROM nvidia-cuda:11.8.0". The parameter instruction may be an instruction generated according to an installation rule and a specified rule of the resource corresponding to the resource information. The above process of determining the base image instruction and the process of determining the parameter instruction are performed in no-separate order, and the process of determining the base image instruction and the process of determining the parameter instruction may be performed simultaneously.
In this specification, when the resource information includes the installer identifier, the installer configuration source identifier, and the information of the software framework, the server may determine, according to the installer identifier, the installation rule of the installer corresponding to the installer identifier, when the instruction file corresponding to the target image file is generated under the specified directory by adopting the specified rule according to the environment information and the resource information. Then, according to the environment information and the resource information, a specified rule is adopted to generate a basic mirror image instruction, a resource configuration instruction and a file instruction. And generating an installer installation instruction corresponding to the installer identifier and an installation instruction of the software framework by adopting the specified rule according to the installation rule and the software framework information. And then, generating an instruction file corresponding to the target image file under the appointed directory according to the basic image instruction, the resource configuration instruction, the file instruction, the installer installation instruction corresponding to the installer identifier and the software framework installation instruction.
The installation rule may be an installer grammar rule, and the installer installation instruction may include an installer dependent environment installation instruction, an installer own installation instruction, and the like. The resource configuration instruction comprises environment information, environment variable configuration instructions, port number configuration instructions, portal program configuration instructions and the like of resources corresponding to the resource information respectively. The file instruction is an instruction to copy the material file from the specified directory, and the file instruction is an instruction to copy the material file from the specified directory into the target image in the process of constructing the target image. The installation instructions of the software framework may include a pre-installation configuration instruction, a software dependent environment installation instruction, a software installation instruction, a post-installation configuration instruction, a startup instruction, and the like.
In addition, since the installer configuration source of the existing installer in the base image may not be consistent with the installer configuration source of the installer required by the target image, for example, the installer configuration source of the PIP installer in the base image is an alien source, but the installer configuration source of the PIP installer required in the target image is a bloom source, the installer configuration source of the installer needs to be replaced, and thus the installer configuration instruction of the installer may further include an installer configuration source replacement instruction for replacing the installer configuration source of the installer.
In the present specification, the above-mentioned basic mirroring instruction, resource allocation instruction, file instruction, installer instruction corresponding to the installer identifier, and the process of generating the installer instruction of the software framework may be executed simultaneously, regardless of the order of execution. In addition, the process of determining the material file and copying the material file to the specified directory in step S106 and the determining the instruction file may be performed in no order or simultaneously.
S110: and calling a mirror image construction technology according to the material file and the basic mirror image and the instruction in the instruction file to generate the target mirror image file.
The server can call the mirror image construction technology according to the material file and the basic mirror image and the instruction in the instruction file to generate the target mirror image file. Specifically, the server may call the mirror image construction technology to generate the target mirror image file by adopting the material file and the base mirror image under the specified target according to the instruction in the instruction file. The mirror image construction technology is based on a Docker architecture. From the environment point of view of image construction, it can be divided into two image construction environments, namely, image construction by using a local service and image construction by calling a remote service. From the view of image construction, the method can be divided into the steps of directly constructing the image by using the Docker native API and constructing the image by using CICD software with a third-party integrated class Docker function, such as Jenkins and the like.
According to the method, when the image is generated, the server can determine the environment information of the basic image required by generating the target image file by responding to the selection operation of the user and display the environment information to the user, so that the user can clearly know the environment information contained in the basic image, can determine the difference from the expected target image according to the environment information, and can perform the input operation according to the determined difference, thereby avoiding the user from inputting the information identical to the environment information of the basic image, and further reducing the generation time of the target image file. Then, in response to an input operation by the user, resource information of other resources required for generating the target image file based on the base image is determined, and a material file required for generating the target image file is determined from a resource library according to the resource information. The material files required for generating the target image files are directly determined from the resource library according to the resource information, so that a user does not need to manually configure and download the material files, the situation that the configuration and the material file downloading are wrong is avoided, and the accuracy of the generated image is improved.
Then, according to the environment information and the resource information, adopting a specified rule to generate an instruction file corresponding to the target image file, and according to the material file and the basic image, calling an image construction technology according to an instruction in the instruction file to generate the target image file. The user does not need to master complex image construction grammar, the technical threshold of target image construction is reduced, the target image is not required to be manually configured, and the target image file can be generated only by selecting the basic image and inputting the resource information required by generating the target image, so that the image generation process is unified and standardized, the user can generate image files in batches, and the image generation efficiency is improved.
In this specification, since the repository is preset for the server, the repository may not include the base image selected by the user or the resources required for generating the target image, so before determining the base image required for generating the target image file from the preconfigured repository (i.e., before generating the target image file in step S100 described above) in response to the selection operation of the user, the server may display the preconfigured repository to the user, so that the user may view the information of various types of resources stored in the repository. And if the user considers that the requirement cannot be fully met, determining a resource file uploaded by the user in response to the uploading operation of the user, and storing the resource file into a resource library.
In this specification, since some resources are directly available on the network, such as common installation packages of some software, these resources may not be stored in a resource library, and may be directly available from the network when they are needed later, without the need for the user to upload these resources to the resource library. Therefore, in the step S106, when the resource information includes the installer identifier, the installer configuration source identifier, and the information of the software framework, the server may determine whether the resource file corresponding to the resource information exists in the resource library, and if so, the process of determining the material file in the step S106 is performed. If not, the server can send a resource acquisition request to the external remote file warehouse according to the resource information, so that the external remote file warehouse inquires the file of the resource corresponding to the resource information according to the resource information, and returns. The server receives the file returned by the external remote file warehouse and takes the file as a material file required for generating the target image file. The external remote file warehouse is a file warehouse verified by the server, and the external remote file warehouse is trusted with the server.
In addition, in order to save storage space, the server may determine, according to the resource information, an acquisition instruction for acquiring a file of a resource, which may be directly acquired in the external remote file repository, instead of using the resources as a material file in step S106 and copying the material file to a specified directory, or may directly generate an instruction file corresponding to the target image file in step S108. The acquiring instruction is an instruction for acquiring a file of a resource corresponding to the resource information from a second external remote file repository. And then generating an instruction file corresponding to the target mirror image file under the appointed directory according to the acquisition instruction. The instruction file in step S108 further includes a fetch instruction.
In the present specification, the server may not find the resource file corresponding to the resource information in the resource library according to the resource information input by the user due to the erroneous input of the user, so in the above step S106, it is determined whether the resource library contains the file of the resource corresponding to the resource information, if so, the file required for generating the target image file is determined from the resource library according to the resource information as the material file. If not, sending error prompt information to the user to prompt the user to input again.
Further, in order to generate the target image file based on the base image, the server needs to determine whether the resource corresponding to the resource information is compatible with the environment information of the base image, so in step S106, the server may determine whether the resource corresponding to the resource information is compatible with the environment corresponding to the environment information according to the environment information. If so, determining files required for generating the target image file from the resource library according to the resource information, and taking the files as material files. If not, sending prompt information to the user to prompt the user to input the resource information again.
In order to avoid the user selecting the images not included in the repository and to enable the user to learn the base information of the images to better select the base images required by the user before selecting the images, the server may display the base information of the images in the pre-configured repository to the user in response to the user' S start operation in step S100 described above. Then, in response to a selection operation by the user, a base image required for generating the target image file is determined from the repository. The starting operation characterizes that a user starts to select the mirror image as a basic mirror image, and the server needs to display basic information of the mirror image in a pre-configured resource library to the user so that the user can select the mirror image required as the basic mirror image according to the basic information. The selection operation characterizes the user selected base image. The basic information at least comprises the name of the mirror image, the size of the mirror image, the information such as the author creating the mirror image and the environment information of the mirror image, the environment information of the mirror image contained in the current basic information is simple basic information, the environment information obtained by carrying out mirror image detection on the mirror image is detailed information, for example, for the type of information of the operating system in the mirror image, the basic information may only contain the name of the operating system in the mirror image, and the environment information obtained by carrying out mirror image detection on the mirror image contains the version of the operating system besides the name of the operating system.
In the present specification, the user may pre-write a file of resource information of other resources required for generating the target image file based on the base image, that is, pre-write a configuration file for generating the target image file based on the base image. Therefore, in the step S104, the user may upload the pre-written configuration file to the server (i.e. input the pre-written configuration file to the server), so that the server determines the configuration file of the target image file generated based on the base image in response to the input operation of the user, parses the configuration file, and determines resource information of other resources required for generating the target image file based on the base image.
In addition, in order to ensure the accuracy of the resource information determined after the configuration file uploaded by the user is analyzed, the server can display the resource information to the user so that the user can determine whether the analyzed resource information is accurate. If the resource information analyzed by the server has errors, the user can modify the resource information. The server may modify the resource information in response to a user's modification information operation.
In order to ensure that the generated target image file is consistent with the target image expected to be generated by the user, after the instruction file corresponding to the target image file is generated, the instruction file may be displayed to the user, so that the user determines whether an error exists in the instruction file. Therefore, after generating the instruction file corresponding to the target image file in step S108, the server may display the instruction file to the user, so that the user may determine whether there is an error in the instruction file. If there is an error in the instruction file, the user may modify the instruction file. The server can respond to the user modifying instruction operation, determine the instruction information required to be modified by the user, regenerate the instruction file according to the instruction information and display the instruction file to the user.
In this specification, the servers may be servers in a cluster, and storage spaces of the servers in the cluster may be shared, so that other servers belonging to the same cluster as the servers may generate the target image file according to the material file and the base image and according to the instruction in the instruction file. Therefore, in the step S110, the server may send the image generation instruction to the other server, and after receiving the image generation instruction, the other server generates the target image file according to the material file and the base image and the instruction in the instruction file. Wherein other servers and servers belong to a cluster.
After generating the target image file in step S110, the server may upload the target image file to a cloud image repository, such as a Harbor server, for direct call by a user or a computing cluster, etc.
In the specification, a user may select a plurality of base images, and according to the steps S100 to S110, a target image file generated based on the base images may be obtained for each base image selected by the user, so that image files may be generated in batches, and the time for generating image files may be reduced.
The foregoing is a method of one or more implementations of the present specification, and based on the same considerations, the present specification further provides a corresponding mirror image generation system, as shown in fig. 2.
Fig. 2 is a schematic diagram of a system for generating an image provided in the present specification, where the system shown in fig. 2 includes a resource management module 200, an image management module 201, and an image construction module 202, where:
the resource management module 200 is used to store a preconfigured resource library. The preconfigured resource library is a preconfigured resource required for generating the mirror image, and includes an installer resource, an installer source resource, a software framework resource and other resources, which are not specifically limited in this specification.
The image management module 201 is configured to store image resources.
The image construction module 202 is configured to first obtain, in response to an input operation by a user, a base image required for generating a target image file from image resources stored in the image management module 201. The basic image is a preconfigured image of the system, a user can select the preconfigured basic image first and then generate a target image based on the basic image, and the basic image at least comprises an environment kernel and an operating system, and can also comprise an installer, an installer configuration source and a software framework. Specifically, the image construction module 202 may obtain, in response to a selection operation by a user, an image selected by the user from the image resources stored in the image management module 201, and use the image as a base image.
The image construction module 202 then determines the context information of the base image and presents it to the user. The environment information at least comprises information of an environment kernel and information of an operating system, and can also comprise installer information, installer configuration source information and information of a software framework. The installer information may include an installer identification, the installer configuration source information may include an installer configuration source identification, and the information of the software framework may include software information, a software-dependent installation environment, an installer used by the software, and interactive software information, etc.
Specifically, the image construction module 202 may perform image detection on the base image selected by the user to obtain an image detection result of the base image, and then determine environmental information of the base image according to the image detection result. The information of the resources contained in the mirror image represented by the mirror image detection result can be obtained by mirror image detection of the mirror image. Different images contain different information, so the image detection results of the different images are different. When the mirror image is detected, any existing means may be used to detect the mirror image, and the present specification is not limited specifically.
In addition, the image detection result may be determined by the image management module 201, so when determining the environment information of the base image, the image construction module 202 may send a detection instruction to the image management module 201, and the image management module 201 may determine the base image according to the received detection instruction, perform image detection on the base image to obtain the image detection result, determine the environment information of the base image according to the image detection result, and send the environment information of the base image to the image construction module 202.
The image detection result may also be a historical image detection result, so the image management module 201 may also perform image detection on the stored image in advance to obtain an image detection result. And determining the environment information of the mirror image according to the mirror image detection result, and storing the environment information. Based on this, the image construction module 202 may determine the environment information corresponding to the base image directly from the environment information of the image stored in the image management module 201.
In this specification, when the target image is generated based on the base image, since the base image does not include all the resources that the user expects to include in the target image, that is, the resources that the user expects to include in the target image or images, the base image does not include the resource or resources. For example, the base image only includes the environment kernel and the operating system, and the target image needs to include the resource of the installer in addition to the environment kernel and the operating system in the base image. Therefore, in order to enable the user to obtain the resource included in the base image, determine the difference between the base image and the target image, the image construction module 202 may display the environment information of the base image selected by the user to the user, so that the user may obtain the information (i.e., environment information) of the resource included in the base image selected by the user, determine the difference between the base image and the target image expected to be generated by the user according to the obtained information of the resource included in the base image, that is, determine the information of the resource required to be included in the target image but not included in the base image according to the information of the resource included in the base image and the information of the resource required to be included in the target image, and add the resource to the base image to generate the target image file by inputting the information of the resource.
Thereafter, the image construction module 202 determines resource information of other resources required to generate the target image file based on the base image in response to an input operation of the user. Wherein the other resources include at least one of installer resources, installer configuration source resources, and software framework resources. The resource information includes at least one of installer identification, installer configuration source identification, and information of the software framework. The installer identifier may be the name of the installer or may be a number or letter representing the installer, which is not specifically limited in this specification.
Because the base image is a preconfigured image and may have a difference with the target image file expected by the user, after determining the environment information of the base image and displaying the environment information to the user, the user can determine the information of the resources (namely the difference between the base image and the target image) contained in the base image in the resources needed to be contained in the target image according to the environment information of the base image, and then add the resources to the base image by inputting the information of the resources according to the information of the resources to generate the target image file. Accordingly, the image construction module 202 determines resource information of other resources required to generate the target image file in addition to the base image in response to an input operation of the user.
Then, the image construction module 202 acquires a file required for generating the target image file from the resource library in the resource management module 200 as a material file according to the resource information, and copies the material file to the specified directory. Specifically, the image construction module 202 may determine, from the resource library in the resource management module 200, an image file of the base image and a resource file corresponding to the resource information according to the resource information and the base image, take the image file and the resource file as material files required for generating the target image file, and copy the material files to the specified directory.
In this specification, when the resource information includes the installer identifier, the installer configuration source identifier, and the information of the software framework, the image construction module 202 may determine the executable file of the installer corresponding to the installer identifier from the resource library in the resource management module 200 according to the installer identifier. According to the installer configuration source identifier, a configuration source file corresponding to the installer configuration source identifier is determined from the resource library in the resource management module 200. From the resource library in the resource management module 200, the installation file corresponding to the information of the software framework is determined according to the information of the software framework. And taking the executable file, the configuration source file and the installation file as material files required for generating the target image file. The determining the executable file of the installer, determining the configuration source file and determining the process of installing the file may be performed in no sequence or may be performed simultaneously.
Then, the image construction module 202 generates an instruction file corresponding to the target image file under the specified directory by adopting the specified rule according to the environment information and the resource information. Specifically, the image construction module 202 may determine the base image instruction according to the environmental information and the specified rule. And determining a parameter instruction of the target image file according to the resource information and the specified rule. And generating an instruction file corresponding to the target image file under the specified directory according to the basic image instruction and the parameter instruction. The base mirror image instruction may be an instruction for designating a base mirror image, and the parameter instruction may be an instruction generated according to an installation rule and a designation rule of a resource corresponding to the resource information. The process of determining the base mirror instruction and the process of determining the parameter instruction can be executed simultaneously without sequencing.
In this specification, when the resource information includes the installer identifier, the installer configuration source identifier, and the information of the software framework, the image construction module 202 may determine the installation rule of the installer corresponding to the installer identifier according to the installer identifier first when the instruction file corresponding to the target image file is generated under the specified directory by adopting the specified rule according to the environment information and the resource information. Then, according to the environment information and the resource information, a specified rule is adopted to generate a basic mirror image instruction, a resource configuration instruction and a file instruction. And generating an installer installation instruction corresponding to the installer identifier and an installer installation instruction of the software framework by adopting the specified rule according to the installation rule and the software framework information. And then, generating an instruction file corresponding to the target image file under the appointed directory according to the basic image instruction, the resource configuration instruction, the file instruction, the installer installation instruction corresponding to the installer identifier and the software framework installation instruction. The installation rule may be an installer grammar rule, and the installer installation instruction may include an installer dependent environment installation instruction, an installer own installation instruction, and the like. The resource configuration instruction comprises environment information, environment variable configuration instructions, port number configuration instructions and portal program configuration instructions of resources corresponding to the resource information respectively. The file instruction is an instruction to copy the material file from the specified directory, and the file instruction is an instruction to copy the material file from the specified directory into the target image in the process of constructing the target image. The installation instructions of the software framework may include a pre-installation configuration instruction, a software dependent environment installation instruction, a software installation instruction, a post-installation configuration instruction, a startup instruction, and the like.
In addition, since the installer configuration source of the existing installer in the base image may not be consistent with the installer configuration source of the installer required by the target image, for example, the installer configuration source of the PIP installer in the base image is an alien source, but the installer configuration source of the PIP installer required in the target image is a bloom source, the installer configuration source of the installer needs to be replaced, and thus the installer configuration instruction of the installer may further include an installer configuration source replacement instruction for replacing the installer configuration source of the installer.
The basic mirror image instruction, the resource allocation instruction, the file instruction, the installer instruction corresponding to the installer identifier and the process of generating the installer instruction of the software framework can be executed simultaneously without sequencing. In addition, the process of determining the material file and copying the material file to the specified directory and the determining the instruction file may be performed in no sequence or simultaneously.
Then, the image construction module 202 invokes an image construction technology according to the material file and the base image and the instruction in the instruction file to generate the target image file. The mirror image construction technology is based on a Docker architecture. From the environment point of view of image construction, it can be divided into two image construction environments, namely, image construction by using a local service and image construction by calling a remote service. From the view of image construction, the method can be divided into the steps of directly constructing the image by using the Docker native API and constructing the image by using CICD software with a third-party integrated class Docker function, such as Jenkins and the like.
As can be seen from the above-mentioned image generation system, when generating an image, the image construction module 202 may obtain, from the resource library stored in the resource management module 200, a base image required for generating the target image file in response to a selection operation of a user, determine environment information of the base image, and display the environment information to the user, so that the user may clearly learn the environment information (i.e., information of resources included in the base image) included in the base image, and determine, according to the environment information, resources required for generating the target image based on the base image, but information of resources not included in the base image, and input the determined information of resources, thereby avoiding that information of resources input by the user is identical to the environment information of the base image, and reducing time for generating the target image file. Then, the image construction module 202 determines resource information of other resources required to generate the target image file based on the base image in response to an input operation of the user, and determines a material file required to generate the target image file from a resource library in the resource management module 200 according to the resource information. The material files required for generating the target image file are determined directly from the resource library in the resource management module 200 according to the resource information, so that a user does not need to manually configure and download the material files, the situation of error configuration and material file downloading is avoided, and the accuracy of the generated image is improved. Then, the mirror image construction module 202 generates an instruction file corresponding to the target mirror image file according to the environment information and the resource information by adopting a specified rule, and invokes a mirror image construction technology according to the instruction in the instruction file and the material file and the basic mirror image to generate the target mirror image file. The user does not need to master complex image construction grammar, the technical threshold of target image construction is reduced, the target image file is not required to be manually configured, and the target image file can be generated only by selecting a basic image and inputting resource information required by generating the target image, so that the user can generate image files in batches, and the image generation efficiency is improved.
In the above-mentioned image generating system, since there may not exist a resource file corresponding to the resource information input by the user in the resource library in the resource management module 200 or there may not exist a base image selected by the user in the image management module 201, that is, the image construction module 202 cannot find the resource file corresponding to the resource information in the resource library according to the resource information, and cannot find the base image selected by the user in the image management module 201. The resource management module 200 may also display the pre-configured repository to the user before the image construction module 202 determines the base image required to generate the target image file from the pre-configured repository in response to the user's selection operation. And the image management module 201 displays the stored base information of the image to the user so that the user can view the information of the resource library and various types of resources stored in the image management module 201. Then, the resource management module 200 determines a resource file uploaded by the user in response to the upload operation of the user, and stores the resource file in the resource library. The resource file may be a file of installer resources, installer configuration source resources, software framework resources, and the like. The image management module 201 also determines and stores the image resource file uploaded by the user in response to the upload operation of the user.
In this specification, since some resources are directly available on the network, such as common installation packages of some software, these resources may not be stored in a resource library, and may be directly available from the network when they are needed later, without the need for the user to upload these resources to the resource library. Therefore, when the resource information includes the installer identifier, the installer configuration source identifier, and the information of the software framework, the image construction module 202 may determine whether the resource file corresponding to the resource information exists in the resource library, if so, the image construction module 202 may determine the material file from the resource library according to the resource information, and the specific process is consistent with the above-mentioned material determining process, which will not be described herein. If not, the image construction module 202 may send a resource acquisition request to the external remote file repository according to the resource information, so that the external remote file repository queries the resource file corresponding to the resource information according to the resource information, and returns. Thereafter, the image construction module 202 may receive the file returned by the external remote file repository and use the file as a material file required to generate the target image file. The external remote file warehouse is a database verified by the system, and the external remote file warehouse is trusted with the system.
In addition, in order to save storage space, for the resources that can be directly obtained in the external remote file repository, the image construction module 202 may not use the resources as material files and copy the material files to the designated directory, and may determine, according to the resource information, an obtaining instruction for obtaining the file of the resource when generating the instruction file corresponding to the target image file. The acquisition instruction is an instruction for acquiring a file of a resource corresponding to the resource information from an external remote file warehouse. And then generating an instruction file corresponding to the target mirror image file under the appointed directory according to the acquisition instruction.
In addition, the image construction module 202 may not find the resource file corresponding to the resource information in the resource library in the resource management module 200 according to the resource information input by the user due to the error input of the user, so the image construction module 202 may determine whether the resource library contains the file of the resource corresponding to the resource information, if so, determine the file required for generating the target image file from the resource library according to the resource information, as the material file. If not, sending error prompt information to the user to prompt the user to input again.
Further, in order to generate the target image file based on the base image, the image construction module 202 needs to determine whether the resource corresponding to the resource information is compatible with the environment information of the base image, so when the file required for generating the target image file is obtained from the resource library in the resource management module 200 according to the resource information and is used as the material file, the image construction module 202 may also determine whether the resource corresponding to the resource information is compatible with the environment corresponding to the environment information according to the environment information. If so, determining files required for generating the target image file from the resource library in the resource management module 200 according to the resource information as material files. If not, sending prompt information to the user to prompt the user to input the resource information again.
In the above-described image generation system, in order to avoid the user selecting an image not included in the repository and to enable the user to learn the basic information of the image to better select the necessary basic image before selecting the image, the image construction module 202 may display the basic information of the image stored in the image management module 201 configured in advance to the user in response to the user's start operation. Then, in response to a selection operation by the user, a base image required for generating the target image file is determined from the repository. Wherein, the start operation characterizes the user to start selecting the image as the base image, and the select operation characterizes the base image selected by the user. The basic information at least comprises the name of the mirror image, the size of the mirror image, the information such as the author creating the mirror image and the environment information of the mirror image, the environment information of the mirror image contained in the current basic information is simple basic information, and the environment information obtained by detecting the mirror image is detailed information.
In the system for generating the mirror image, the user can write in advance the file of the resource information of other resources required for generating the target mirror image file based on the base mirror image, that is, write in advance the configuration file for generating the target mirror image file based on the base mirror image. Accordingly, the image construction module 202 may determine a configuration file of the target image file generated based on the base image, parse the configuration file, and determine resource information of other resources required to generate the target image file based on the base image in response to an input operation of the user. The configuration file is a file of resource information of other resources required for generating the target image file based on the base image, which is written in advance by the user, and is uploaded to the image construction module 202 by the user.
In addition, in order to ensure the accuracy of the resource information determined after the configuration file uploaded by the user is parsed, the mirror image construction module 202 may display the resource information to the user, so that the user determines whether the parsed resource information is accurate. If the resource information analyzed by the mirror image construction module 202 has errors, the user can modify the resource information. The image construction module 202 may modify the resource information in response to a user's modification information operation.
In the above image generation system, in order to ensure that the generated target image file is consistent with the target image expected to be generated by the user, after the instruction file corresponding to the target image file is generated, the instruction file may be displayed to the user, so that the user determines whether an error exists in the instruction file. Therefore, after generating the instruction file corresponding to the target image file, the image construction module 202 may display the instruction file to the user, so that the user may determine whether there is an error in the instruction file. If there is an error in the instruction file, the user may modify the instruction file. The image construction module 202 may determine instruction information that the user needs to modify in response to the user modifying the instruction operation, regenerate the instruction file based on the instruction information, and display the instruction file to the user.
In the system for generating the mirror image, the server where the system is located may be a server in a cluster, and the storage space of the server in the cluster may be shared, so that the file stored in the resource management module 200 in the system may also be shared with other servers in the cluster. Therefore, when generating the target image file according to the instruction in the instruction file according to the material file and the base image, the image construction module 202 may send an image generation instruction to other servers, and after receiving the image generation instruction, the other servers generate the target image file according to the instruction in the instruction file according to the material file and the base image. Wherein, other servers and the servers where the system is located belong to a cluster.
In this specification, the system further includes a data storage module 203, as shown in fig. 3, and fig. 3 is a schematic diagram of another mirror image generating system provided in this specification, where the mirror image generating system includes the data storage module 203 in addition to the resource management module 200, the mirror image management module 201, and the mirror image construction module 202.
The data storage module 203 is configured to store mirrored environmental information. The image management module 201 may send the image environment information to the data storage module 203 for storage after determining the image environment information. Thus, the image construction module 202 can acquire the environment information of the base image from the data storage module 203. In the above-described image generation system, after generating the target image file, the image construction module 202 may send the target image file to the data storage module 203 for storage. The data storage module 203 may further upload the target image file to a cloud image repository for direct call by a user or a computing cluster.
In the above-described image generation system, the resource management module 200 may include an installer resource management sub-module 2001, an installer source resource management sub-module 2002, and a software management resource sub-module 2003, as shown in fig. 4, and fig. 4 is a schematic view of one of the resource management modules provided in the present specification.
The installer resource management sub-module 2001 is used to manage and store installer resources. Specifically, installer resource management submodule 2001 may determine and store installer resources supported by the system uploaded by the user in response to the upload material operation of the user.
The installer configuration source resource management sub-module 2002 is used to manage and store installer configuration source resources. Specifically, the installer configuration source resource management submodule 2002 may determine, in response to the upload material operation of the user, the installer configuration source resource supported by the system uploaded by the user, and store the same.
The software resource management sub-module 2003 is used to manage and store software framework resources. Specifically, the software resource management submodule 2003 may determine and store the software framework resources supported by the system uploaded by the user in response to the upload material operation of the user. The software framework resources may include executable files of the software itself, files of an installation environment on which the software depends, and files of configuration required for installing the software.
In the above-mentioned image generating system, the image management module 201 may include an image storage submodule 2011, an image detection submodule 2012, and an image space management submodule 2013, as shown in fig. 5, where fig. 5 is a schematic diagram of one image management module provided in the present specification.
The image storage submodule 2011 is configured to determine an image uploaded by a user in response to an upload image operation of the user, and store the image.
The image detection submodule 2012 is configured to perform image detection on the image stored in the image storage submodule 2011 to obtain an image detection result, and determine environmental information of the image according to the image detection result.
The mirror space management submodule 2013 is used for managing the mirror storage space. Specifically, the mirror space management submodule 2013 may manage the mirror storage space by periodically cleaning an expired mirror, cleaning a cache space, and the like.
In the above-described image generation system, the image building module 202 may include a task management submodule 2021, a material preparation submodule 2022, an instruction generation submodule 2023, an instruction file generation submodule 2024, and an image generation submodule 2025, as shown in fig. 6, where fig. 6 is a schematic diagram of one image building module provided in the present specification.
The task management sub-module 2021 is configured to manage an image construction task, where the image construction task generates a target image file, and a process of generating the target image file is a process of executing an image construction task. Each target image file corresponds to a specified directory, which may be divided by the task management submodule 2021.
The material preparation sub-module 2022 is configured to obtain, in response to a selection operation by a user, a base image required for generating the target image file from the image resource stored in the image management module 201, determine environment information of the base image, and display the environment information to the user, in response to an input operation by the user, determine resource information of other resources required for generating the target image file based on the base image, obtain, according to the resource information, a file required for generating the target image file from a resource library in the resource management module 200, as a material file, and copy the material file to a specified directory divided by the task management sub-module 2021.
The instruction generation submodule 2023 is configured to determine parameter instructions of the target image file according to the resource information and the specified rule.
The instruction file generating sub-module 2024 is configured to determine a base image instruction according to the environmental information and the specified rule, and generate an instruction file corresponding to the target image file under the specified directory according to the base image instruction and the parameter instruction obtained from the instruction generating sub-module 2023.
The image generation submodule 2025 is used for calling an image construction technology according to the instruction in the instruction file and the material file and the basic image to generate a target image file.
The image generation sub-module 2025 may store the target image file in the image storage sub-module 2011 after generating the target image file. Accordingly, the image storage sub-module 2011 is further configured to store the target image file.
In the above-described image generating system, the data storage module 203 may include a task information storage sub-module 2031 and an environment information storage sub-module 2032, as shown in fig. 7, and fig. 7 is a schematic diagram of one of the data storage modules provided in the present specification.
The task information storage sub-module 2031 is configured to store information of the image construction task, including a start time and an end time of the image construction task, and a designation directory and the like determined by the task management sub-module 2021.
The environment information storage submodule 2032 is used for storing environment information of the image determined by the image management module 201.
The present disclosure also provides a schematic diagram of a system for generating an image, as shown in fig. 8, and fig. 8 is a schematic diagram of an overall system for generating an image provided in the present disclosure. The system for generating the mirror image further comprises the resource management module 200, the mirror image management module 201, the mirror image construction module 202 and the data storage module 203. The resource management module 200 includes an installer resource management sub-module 2001, an installer configuration source resource management sub-module 2002, and a software resource management sub-module 2003, among others. The image management module 201 includes an image storage sub-module 2011, an image detection sub-module 2012, and an image space management sub-module 2013. The image construction module 202 includes a task management sub-module 2021, a material preparation sub-module 2022, an instruction generation sub-module 2023, an instruction file generation sub-module 2024, and an image generation sub-module 2025. The data storage module 203 may include a task information storage sub-module 2031 and an environment information storage sub-module 2032.
The present specification also provides a computer readable storage medium storing a computer program operable to perform a method of image generation as provided in fig. 1 above.
The present specification also provides a schematic structural diagram of an electronic device corresponding to fig. 1 shown in fig. 9. As shown in fig. 9, at the hardware level, the electronic device includes a processor, an internal bus, a network interface, a memory, and a nonvolatile storage, and may of course include hardware required by other services. The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs to implement the method of image generation described above with respect to fig. 1.
Of course, other implementations, such as logic devices or combinations of hardware and software, are not excluded from the present description, that is, the execution subject of the following processing flows is not limited to each logic unit, but may be hardware or logic devices.
In the 90 s of the 20 th century, improvements to one technology could clearly be distinguished as improvements in hardware (e.g., improvements to circuit structures such as diodes, transistors, switches, etc.) or software (improvements to the process flow). However, with the development of technology, many improvements of the current method flows can be regarded as direct improvements of hardware circuit structures. Designers almost always obtain corresponding hardware circuit structures by programming improved method flows into hardware circuits. Therefore, an improvement of a method flow cannot be said to be realized by a hardware entity module. For example, a programmable logic device (Programmable Logic Device, PLD) (e.g., field programmable gate array (Field Programmable Gate Array, FPGA)) is an integrated circuit whose logic function is determined by the programming of the device by a user. A designer programs to "integrate" a digital system onto a PLD without requiring the chip manufacturer to design and fabricate application-specific integrated circuit chips. Moreover, nowadays, instead of manually manufacturing integrated circuit chips, such programming is mostly implemented by using "logic compiler" software, which is similar to the software compiler used in program development and writing, and the original code before the compiling is also written in a specific programming language, which is called hardware description language (Hardware Description Language, HDL), but not just one of the hdds, but a plurality of kinds, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), lava, lola, myHDL, PALASM, RHDL (Ruby Hardware Description Language), etc., VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog are currently most commonly used. It will also be apparent to those skilled in the art that a hardware circuit implementing the logic method flow can be readily obtained by merely slightly programming the method flow into an integrated circuit using several of the hardware description languages described above.
The controller may be implemented in any suitable manner, for example, the controller may take the form of, for example, a microprocessor or processor and a computer readable medium storing computer readable program code (e.g., software or firmware) executable by the (micro) processor, logic gates, switches, application specific integrated circuits (Application Specific Integrated Circuit, ASIC), programmable logic controllers, and embedded microcontrollers, examples of which include, but are not limited to, the following microcontrollers: ARC 625D, atmel AT91SAM, microchip PIC18F26K20, and Silicone Labs C8051F320, the memory controller may also be implemented as part of the control logic of the memory. Those skilled in the art will also appreciate that, in addition to implementing the controller in a pure computer readable program code, it is well possible to implement the same functionality by logically programming the method steps such that the controller is in the form of logic gates, switches, application specific integrated circuits, programmable logic controllers, embedded microcontrollers, etc. Such a controller may thus be regarded as a kind of hardware component, and means for performing various functions included therein may also be regarded as structures within the hardware component. Or even means for achieving the various functions may be regarded as either software modules implementing the methods or structures within hardware components.
The system, apparatus, module or unit set forth in the above embodiments may be implemented in particular by a computer chip or entity, or by a product having a certain function. One typical implementation is a computer. In particular, the computer may be, for example, a personal computer, a laptop computer, a cellular telephone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
For convenience of description, the above devices are described as being functionally divided into various units, respectively. Of course, the functions of each element may be implemented in one or more software and/or hardware elements when implemented in the present specification.
It will be appreciated by those skilled in the art that embodiments of the present description may be provided as a method, system, or computer program product. Accordingly, the present specification may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present description can take the form of a computer program product on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.
The present description is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the specification. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In one typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include volatile memory in a computer-readable medium, random Access Memory (RAM) and/or nonvolatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of computer-readable media.
Computer readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of storage media for a computer include, but are not limited to, phase change memory (PRAM), static Random Access Memory (SRAM), dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), read Only Memory (ROM), electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium, which can be used to store information that can be accessed by a computing device. Computer-readable media, as defined herein, does not include transitory computer-readable media (transmission media), such as modulated data signals and carrier waves.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article or apparatus that comprises the element.
It will be appreciated by those skilled in the art that embodiments of the present description may be provided as a method, system, or computer program product. Accordingly, the present specification may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present description can take the form of a computer program product on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.
The description may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. The specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media including memory storage devices.
In this specification, each embodiment is described in a progressive manner, and identical and similar parts of each embodiment are all referred to each other, and each embodiment mainly describes differences from other embodiments. In particular, for system embodiments, since they are substantially similar to method embodiments, the description is relatively simple, as relevant to see a section of the description of method embodiments.
The foregoing is merely exemplary of the present disclosure and is not intended to limit the disclosure. Various modifications and alterations to this specification will become apparent to those skilled in the art. Any modifications, equivalent substitutions, improvements, or the like, which are within the spirit and principles of the present description, are intended to be included within the scope of the claims of the present description.

Claims (8)

1. A method of image generation, comprising:
responding to the selection operation of a user, and determining a basic image required for generating a target image file from a pre-configured resource library;
determining the environment information of the basic mirror image and displaying the environment information to the user;
determining resource information of other resources required for generating the target image file based on the base image in response to input operation of the user, wherein the resource information at least comprises one of an installer identifier, an installer configuration source identifier and information of a software framework;
determining files required for generating the target image file from the resource library according to the resource information, taking the files as material files, and copying the material files to a designated directory;
according to the environment information and the resource information, adopting a specified rule to generate an instruction file corresponding to the target image file under the specified directory;
according to the material file and the basic mirror image, calling a mirror image construction technology according to an instruction in the instruction file to generate the target mirror image file;
before determining a base image required for generating the target image file from a pre-configured repository in response to a selection operation by a user, the method further comprises:
Displaying a pre-configured resource library to a user, wherein the resource library comprises mirror image resources, installer configuration source resources and software framework resources;
responding to the uploading operation of the user, determining a resource file uploaded by the user, and storing the resource file into the resource library;
the resource information comprises the installer identification, the installer configuration source identification and the information of the software framework;
according to the environment information and the resource information, adopting a specified rule, and generating an instruction file corresponding to the target image file under the specified directory, wherein the instruction file specifically comprises:
determining an installation rule of an installer corresponding to the installer identifier according to the installer identifier;
according to the environment information and the resource information, adopting a specified rule to generate a basic mirror image instruction, a resource configuration instruction and a file instruction; generating an installer installation instruction corresponding to the installer identifier and an installation instruction of the software framework by adopting the specified rule according to the installation rule and the software framework information; the file instruction is an instruction for copying the material file from the appointed directory;
And generating an instruction file corresponding to the target image file under the appointed directory according to the basic image instruction, the resource configuration instruction, the file instruction, the installer installation instruction corresponding to the installer identifier and the software framework installation instruction.
2. The method of claim 1, wherein determining the context information of the base image specifically comprises:
performing image detection on the basic image to obtain an image detection result of the basic image, wherein the basic image at least comprises an environment kernel and an operating system;
and determining the environment information of the basic mirror image according to the mirror image detection result, wherein the environment information at least comprises the information of the environment kernel and the information of the operating system.
3. The method according to claim 1, wherein determining, as a material file, a file required for generating the target image file from the repository according to the resource information, specifically includes:
judging whether a file of a resource corresponding to the resource information exists in the resource library;
if yes, determining an executable file of an installer corresponding to the installer identifier, a configuration source file corresponding to the installer configuration source identifier and an installation file corresponding to the information of the software framework from the resource library according to the installer identifier, the installer configuration source identifier and the software framework information; taking the executable file, the configuration source file and the installation file as material files required for generating the target image file;
If not, sending a resource acquisition request to an external remote file warehouse according to the resource information, so that the external remote file warehouse inquires a file of a resource corresponding to the resource information according to the resource information and returns the file; and receiving the file returned by the external remote file warehouse, and taking the file as a material file required for generating the target image file.
4. A system for image generation, the system comprising a resource management module, an image management module, and an image construction module, wherein:
the resource management module is used for storing a pre-configured resource library;
the mirror image management module is used for storing mirror image resources;
the mirror image construction module is used for responding to the selection operation of a user, acquiring a basic mirror image required by generating a target mirror image file from mirror image resources stored in the mirror image management module, determining environment information of the basic mirror image, displaying the environment information to the user, responding to the input operation of the user, determining resource information of other resources required by generating the target mirror image file based on the basic mirror image, acquiring a file required by generating the target mirror image file from a resource library in the resource management module according to the resource information, taking the file as a material file, copying the material file to a specified directory, adopting a specified rule according to the environment information and the resource information, generating an instruction file corresponding to the target mirror image file under the specified directory, and calling a mirror image construction technology according to instructions in the instruction file according to the material file and the basic mirror image, wherein the resource information at least comprises one of an installer identifier, an installer configuration source identifier and information of a software framework;
Before the mirror image construction module responds to the selection operation of a user and determines a basic mirror image required by generating a target mirror image file from a pre-configured resource library, the resource management module is also used for displaying the resource library to the user, responding to the uploading operation of the user, determining the resource file uploaded by the user and storing the resource file into the resource library, wherein the resource library comprises an installer resource, an installer configuration source resource and a software framework resource;
the resource information comprises the installer identification, the installer configuration source identification and the information of the software framework;
the mirror image construction module is specifically configured to determine an installation rule of an installer corresponding to the installer identifier according to the installer identifier, generate a basic mirror image instruction, a resource configuration instruction and a file instruction according to the environment information and the resource information by adopting a specified rule, generate an installation instruction of the installer corresponding to the installer identifier and an installation instruction of the software frame according to the installation rule and the software frame information by adopting the specified rule, and generate an instruction file corresponding to the target mirror image file under the specified directory according to the basic mirror image instruction, the resource configuration instruction, the file instruction, the installation instruction of the installer corresponding to the installer identifier and the installation instruction of the software frame, wherein the file instruction is an instruction for copying the material file from the specified directory.
5. The system of claim 4, wherein the image management module is further configured to perform image detection on an image to obtain an image detection result, determine environment information of the image according to the image detection result, and store the environment information, where the image includes at least an environment kernel and an operating system, and the environment information includes at least information of the environment kernel and information of the operating system;
the image construction module is specifically configured to determine, from the environment information of the image stored by the image management module, environment information corresponding to the base image.
6. The system of claim 4, wherein the image construction module is specifically configured to determine whether a file of a resource corresponding to the resource information exists in the resource library, if so, determine, from the resource library in the resource management module, an executable file of the installer corresponding to the installer identifier, a configuration source file corresponding to the installer configuration source identifier, and an installation file corresponding to information of the software framework according to the installer identifier, the installer configuration source identifier, and the software framework information, and use the executable file, the configuration source file, and the installation file as a material file required for generating the target image file, if not, send a resource acquisition request to an external remote file repository according to the resource information, make the external remote file repository query a file of the resource corresponding to the resource information, and return, receive a file returned by the external remote file repository, and use the file as a material file required for generating the target image file.
7. A computer readable storage medium, characterized in that the storage medium stores a computer program which, when executed by a processor, implements the method of any of the preceding claims 1-3.
8. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the method of any of the preceding claims 1-3 when executing the program.
CN202311285993.7A 2023-10-07 2023-10-07 Mirror image generation method, system, storage medium and electronic equipment Active CN117032739B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311285993.7A CN117032739B (en) 2023-10-07 2023-10-07 Mirror image generation method, system, storage medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311285993.7A CN117032739B (en) 2023-10-07 2023-10-07 Mirror image generation method, system, storage medium and electronic equipment

Publications (2)

Publication Number Publication Date
CN117032739A CN117032739A (en) 2023-11-10
CN117032739B true CN117032739B (en) 2024-01-09

Family

ID=88624812

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311285993.7A Active CN117032739B (en) 2023-10-07 2023-10-07 Mirror image generation method, system, storage medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN117032739B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106528224A (en) * 2016-11-03 2017-03-22 腾讯科技(深圳)有限公司 Content updating method and system for Docker container, and server
WO2017049828A1 (en) * 2015-09-25 2017-03-30 中兴通讯股份有限公司 Method, device and system for data processing based on linux
CN108984268A (en) * 2018-07-13 2018-12-11 郑州云海信息技术有限公司 The method and apparatus of Container Management in Docker system
CN110659076A (en) * 2019-09-26 2020-01-07 无锡睿勤科技有限公司 Installation deployment method and device of operating system
CN113867778A (en) * 2021-09-18 2021-12-31 苏州浪潮智能科技有限公司 Method and device for generating mirror image file, electronic equipment and storage medium
CN114443076A (en) * 2022-01-30 2022-05-06 北京百度网讯科技有限公司 Mirror image construction method, device, equipment and storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2017049828A1 (en) * 2015-09-25 2017-03-30 中兴通讯股份有限公司 Method, device and system for data processing based on linux
CN106528224A (en) * 2016-11-03 2017-03-22 腾讯科技(深圳)有限公司 Content updating method and system for Docker container, and server
CN108984268A (en) * 2018-07-13 2018-12-11 郑州云海信息技术有限公司 The method and apparatus of Container Management in Docker system
CN110659076A (en) * 2019-09-26 2020-01-07 无锡睿勤科技有限公司 Installation deployment method and device of operating system
CN113867778A (en) * 2021-09-18 2021-12-31 苏州浪潮智能科技有限公司 Method and device for generating mirror image file, electronic equipment and storage medium
CN114443076A (en) * 2022-01-30 2022-05-06 北京百度网讯科技有限公司 Mirror image construction method, device, equipment and storage medium

Also Published As

Publication number Publication date
CN117032739A (en) 2023-11-10

Similar Documents

Publication Publication Date Title
US9928038B2 (en) Dynamically building locale objects or subsections of locale objects based on historical data
CN108616599B (en) Method and device for registering and updating application service
CN111881019B (en) User interface testing method and device
WO2000010078A2 (en) Multilingual user interface for an operating system
CN116126365B (en) Model deployment method, system, storage medium and electronic equipment
CN111475142B (en) Method, device and equipment for generating applet file package
CN110032409B (en) Client screen adapting method and device and electronic equipment
US20120159515A1 (en) Sharing object representations
CN117075930B (en) Computing framework management system
US9141353B2 (en) Dynamically building locale objects at run-time
CN111273965B (en) Container application starting method, system and device and electronic equipment
CN117032739B (en) Mirror image generation method, system, storage medium and electronic equipment
CN116436936B (en) Data storage system, method, storage medium and electronic equipment
CN111338655B (en) Installation package distribution method and system
CN115269562B (en) Database management method and device, storage medium and electronic equipment
CN117519912B (en) Mirror image warehouse deployment method, device, storage medium and equipment
CN117041980B (en) Network element management method and device, storage medium and electronic equipment
CN117311856A (en) Method and device for generating interface calling code
US9778917B2 (en) Dynamically building subsections of locale objects at run-time
CN112711539A (en) Data processing method and device and data detection system
CN117785225A (en) Application publishing system and method based on Git warehouse
CN117519733A (en) Project deployment method and device, storage medium and electronic equipment
CN117592517A (en) Model training method and device
CN117421208A (en) Method, device, storage medium and equipment for determining unique page identifier
CN117667309A (en) Snapshot mirror image loading method and device, storage medium and electronic equipment

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
GR01 Patent grant
GR01 Patent grant