CN117632495A - Container mirror image management method, system and storage medium - Google Patents

Container mirror image management method, system and storage medium Download PDF

Info

Publication number
CN117632495A
CN117632495A CN202311614191.6A CN202311614191A CN117632495A CN 117632495 A CN117632495 A CN 117632495A CN 202311614191 A CN202311614191 A CN 202311614191A CN 117632495 A CN117632495 A CN 117632495A
Authority
CN
China
Prior art keywords
container
mirror image
platform
cross
image
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202311614191.6A
Other languages
Chinese (zh)
Inventor
李勉才
刘凯
龙喜洋
丁铁梁
鄢伟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Merchants Finance Technology Co Ltd
Original Assignee
China Merchants Finance Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by China Merchants Finance Technology Co Ltd filed Critical China Merchants Finance Technology Co Ltd
Priority to CN202311614191.6A priority Critical patent/CN117632495A/en
Publication of CN117632495A publication Critical patent/CN117632495A/en
Pending legal-status Critical Current

Links

Classifications

    • 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 application discloses a container mirror image management method, a system and a storage medium, wherein the container mirror image management method comprises the following steps: acquiring an original container image file from an image warehouse, and determining the instruction type of the original container image file; under the condition that the instruction type of the original container mirror image file is a cross-platform container mirror image construction instruction, sending the cross-platform container mirror image construction instruction to a remote host for the remote host to receive and construct the cross-platform container mirror image file according to the cross-platform container mirror image construction instruction, and uploading the cross-platform container mirror image file to a mirror image warehouse to replace the original container mirror image file in the mirror image warehouse. Based on the scheme, the condition limit on the container cluster immutable operating system and the virtualization tool is eliminated, and the construction of the cross-platform container image file is efficiently realized through the mutual cooperation of the container image management device, the remote host and the image warehouse.

Description

Container mirror image management method, system and storage medium
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a method, a system, and a storage medium for managing container images.
Background
A container cluster is a cluster used to manage and orchestrate containerized applications, such as Kubernetes clusters. In such container clusters, the importance of cross-platform container mirroring is increasingly prominent, enabling seamless operation across different operating systems and architectures, providing greater flexibility and portability.
However, the container cluster generally adopts an immutable operating system such as CoreOS, and does not deploy a virtualization tool such as QEMU (Quick EMUlator) by default. Limited by these conditions, it is currently difficult to build a viable cross-platform container image among a cluster of containers.
Disclosure of Invention
The main purpose of the present application is to provide a container mirror image management method, system and storage medium, which aims to solve the problem that it is difficult to construct available cross-platform container mirror image files in a container cluster at present.
In order to achieve the above object, the present application provides a container image management method, including:
acquiring an original container image file from an image warehouse, and determining the instruction type of the original container image file;
and under the condition that the instruction type of the original container mirror image file is a cross-platform container mirror image construction instruction, sending the cross-platform container mirror image construction instruction to a remote host, so that the remote host can receive and construct a cross-platform container mirror image file according to the cross-platform container mirror image construction instruction, and uploading the cross-platform container mirror image file to the mirror image warehouse to replace the original container mirror image file in the mirror image warehouse.
Optionally, the container mirror management method further includes:
creating an initial cross-platform container mirror layer based on the container manager tool;
acquiring the cross-platform container image file from the image warehouse;
adding the cross-platform base container mirror image in the cross-platform container mirror image file into the initial cross-platform container mirror image layer to obtain a target cross-platform container mirror image layer;
pushing the target cross-platform container mirror layer to the mirror warehouse; the cross-platform base container mirror image in the target cross-platform container mirror image layer can be used for the container mirror image management device to operate.
Optionally, the container mirror management method further includes:
and responding to the mirror image operation instruction, and performing view operation or deletion operation on the cross-platform basic container mirror image in the target cross-platform container mirror image layer.
Optionally, the container mirror management method further includes:
responding to a service container image construction instruction, and acquiring the cross-platform basic container image from the target cross-platform container image layer;
and generating a custom service container mirror image based on the service corresponding to the cross-platform basic container mirror image and the service container mirror image construction instruction.
The embodiment of the application also provides a container mirror image management method, which is applied to a remote host, and comprises the following steps:
receiving a cross-platform container mirror image construction instruction; the container mirror image construction instruction is sent to the remote host by the container mirror image management device under the condition that the instruction type of the original container mirror image file is the container mirror image construction instruction; the original container mirror image file is obtained from a mirror image warehouse by the container mirror image management device; the instruction type of the original container mirror image file is determined by the container mirror image management device;
constructing a cross-platform container mirror image file according to the cross-platform container mirror image construction instruction;
and uploading the cross-platform container image file to the image warehouse to replace the original container image file in the image warehouse.
Optionally, the step of building the cross-platform container mirror image file according to the cross-platform container mirror image building instruction includes:
generating a temporary container mirror image file according to the cross-platform container mirror image construction instruction;
constructing single-platform basic container images corresponding to a plurality of CPU architectures based on the temporary container image file;
based on a preset container group list instruction, integrating single-platform basic container images corresponding to the CPU architectures respectively to obtain cross-platform basic container images;
and generating the cross-platform container mirror image file according to the cross-platform container mirror image construction instruction and the cross-platform base container mirror image.
Optionally, the step of constructing single-platform base container images corresponding to the CPU architectures of the plurality of central processing units based on the temporary container image file includes:
based on the temporary container mirror image file, a single-platform base container mirror image corresponding to each of a plurality of CPU architectures in an X86 architecture, an AMD64 architecture, an ARM64 architecture and a RISC-V architecture is constructed.
The embodiment of the application also provides a container mirror image management system, which comprises a container mirror image management device and a remote host, wherein the container mirror image management system and a mirror image warehouse belong to a container cluster;
the container mirror image management device is used for acquiring an original container mirror image file from the mirror image warehouse and determining the instruction type of the original container mirror image file; transmitting the cross-platform container mirror image construction instruction to the remote host under the condition that the instruction type of the original container mirror image file is the cross-platform container mirror image construction instruction;
the remote host is used for receiving the cross-platform container mirror image construction instruction; constructing the cross-platform container mirror image file according to the cross-platform container mirror image construction instruction; and uploading the cross-platform container image file to the image warehouse to replace the original container image file in the image warehouse.
Optionally, the mirror repository is a distributed version control system Git repository.
The embodiments of the present application also provide a computer readable storage medium having stored thereon a container image management program which, when executed by a processor, implements the steps of the container image management method described above.
According to the container mirror image management method, the system and the storage medium, an original container mirror image file is obtained from a mirror image warehouse, and the instruction type of the original container mirror image file is determined; and under the condition that the instruction type of the original container mirror image file is a cross-platform container mirror image construction instruction, sending the cross-platform container mirror image construction instruction to a remote host, so that the remote host can receive and construct a cross-platform container mirror image file according to the cross-platform container mirror image construction instruction, and uploading the cross-platform container mirror image file to the mirror image warehouse to replace the original container mirror image file in the mirror image warehouse. Based on the scheme of the application, the container mirror image management device obtains the original container mirror image file from the mirror image warehouse and determines the instruction type of the original container mirror image file. If the instruction type meets the requirement, the container mirror management device sends an instruction to the remote host. Accordingly, the remote host computer can receive and execute the instructions, build a cross-platform container image file, and upload it to the image repository. The process gets rid of the condition limitation of the invariable operating system of the container cluster and the virtualization tool, and the construction of the cross-platform container mirror image file is efficiently realized through the mutual cooperation of the container mirror image management device, the remote host and the mirror image warehouse.
Drawings
FIG. 1 is a flow chart of a first exemplary embodiment of a container image management method of the present application;
FIG. 2 is a schematic diagram of a container cluster involved in the container image management method of the present application;
FIG. 3 is a flow chart of a second exemplary embodiment of a container image management method of the present application;
FIG. 4 is a flow chart of a third exemplary embodiment of a container image management method according to the present application;
FIG. 5 is a flow chart of a fourth exemplary embodiment of a container image management method of the present application;
FIG. 6 is a flowchart illustrating a fifth exemplary embodiment of a container image management method according to the present application;
FIG. 7 is a flowchart of a sixth exemplary embodiment of a container image management method according to the present application;
fig. 8 is a flowchart of a seventh exemplary embodiment of a container image management method according to the present application.
The realization, functional characteristics and advantages of the present application will be further described with reference to the embodiments, referring to the attached drawings.
Detailed Description
It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the present application.
The main solutions of the embodiments of the present application are: acquiring an original container image file from an image warehouse, and determining the instruction type of the original container image file; and under the condition that the instruction type of the original container mirror image file is a cross-platform container mirror image construction instruction, sending the cross-platform container mirror image construction instruction to a remote host, so that the remote host can receive and construct a cross-platform container mirror image file according to the cross-platform container mirror image construction instruction, and uploading the cross-platform container mirror image file to the mirror image warehouse to replace the original container mirror image file in the mirror image warehouse. Based on the scheme of the application, the container mirror image management device obtains the original container mirror image file from the mirror image warehouse and determines the instruction type of the original container mirror image file. If the instruction type meets the requirement, the container mirror management device sends an instruction to the remote host. Accordingly, the remote host computer can receive and execute the instructions, build a cross-platform container image file, and upload it to the image repository. The process gets rid of the condition limitation of the invariable operating system of the container cluster and the virtualization tool, and the construction of the cross-platform container mirror image file is efficiently realized through the mutual cooperation of the container mirror image management device, the remote host and the mirror image warehouse.
Referring to fig. 1, a first embodiment of a container image management method of the present application provides a flowchart, where the container image management method includes:
and step A10, acquiring an original container image file from an image warehouse, and determining the instruction type of the original container image file.
Specifically, a container cluster is a cluster used to manage and orchestrate containerized applications. The Kubernetes cluster is one of common container clusters, and is composed of a plurality of Kubernetes nodes, and the Kubernetes platform coordinates and automates the deployment, expansion and management of containers, so that a high-availability, elastic and convenient container arrangement service is provided, and the running of distributed application programs is effectively supported.
In such container clusters, the importance of cross-platform container mirroring is increasingly prominent. Cross-platform container mirroring is a containerized application package that can run seamlessly across multiple operating systems and architectures. By considering the compatibility of different platforms, cross-platform container mirroring provides flexibility and portability, enabling applications to maintain consistency across a variety of computing environments and to be easily deployed and extended.
However, the container cluster generally adopts an immutable operating system such as CoreOS, and does not deploy a virtualization tool such as QEMU (Quick EMUlator) by default. Cross-platform container image files in a container cluster are generally built based on a Continuous Integration (CI) process, and due to the limitations of these conditions, it is currently difficult to build available cross-platform container image files in a container cluster. The container mirror image management device, the remote host and the mirror image warehouse belong to the same container cluster.
For this purpose, the present embodiment proposes a container image management method, whose execution subject may be hardware or software. For example, the container mirror management device in the container cluster is used as an execution subject of the method, and the container mirror management device is used for retrieving, constructing, storing, distributing and operating the container mirror. As shown in fig. 2, fig. 2 is a schematic diagram of a container cluster related to a container mirror image management method of the present application, where the container cluster includes a remote host and a mirror image repository in addition to a container mirror image management device. The remote host is a computer node, and receives and executes tasks related to the container mirror image, such as constructing a cross-platform container mirror image, and is generally connected with the container mirror image management device through a network protocol; the image repository is a data or code repository for storing and managing container images.
First, the container image management apparatus acquires an original container image file from an image repository. The original container image file (Dockerfile) contains not only the actual container image but also the relevant instructions needed to build the container image. The original container image file is essentially a script describing how to construct the container image, including information such as container images, dependencies, configuration, and runtime settings. The original container image file may be used to repeatedly build the same container image and ensure consistency in different environments.
After the original container image file is obtained, the container image management device further determines the instruction type of the original container image file. The instruction type of the original container mirror image file may be a common instruction or a cross-platform container mirror image construction instruction.
Step a20, when the instruction type of the original container image file is a cross-platform container image construction instruction, sending the cross-platform container image construction instruction to a remote host, so that the remote host receives and constructs a cross-platform container image file according to the cross-platform container image construction instruction, and uploading the cross-platform container image file to the image warehouse to replace the original container image file in the image warehouse.
Specifically, in the case that the instruction type of the original container image file is a cross-platform container image construction instruction, the container image management device sends the cross-platform container image construction instruction to the remote host. The cross-platform container image construction instruction is a set of instructions directing a remote host to construct a cross-platform base container image, ensuring seamless operation across multiple operating systems and architectures.
Correspondingly, the remote host receives a cross-platform container mirror image construction instruction sent by the container mirror image management device, and constructs a cross-platform container mirror image file according to the cross-platform container mirror image construction instruction, wherein the cross-platform container mirror image file comprises a cross-platform basic container mirror image constructed by the remote host. By "cross-platform" is meant that the container image is capable of running on a variety of different operating systems and hardware architectures without modification, meaning that the cross-platform base container image can run seamlessly on a variety of platforms such as Linux, windows, as well as different architectures such as x86 and ARM, providing greater flexibility and portability.
Then, the remote host will upload the cross-platform container image file to the image warehouse, and replace the original container image file in the image warehouse with the cross-platform container image file. Therefore, the latest version of the container image file is always stored in the image warehouse, and a user can conveniently utilize the cross-platform container image file in the image warehouse when needed.
Alternatively, the image repository may be a distributed version control system, git, repository. The Git repository is where project source code and version history are stored in the distributed version control system, it contains complete project records, allowing multiple users to work cooperatively, each user can clone the entire repository and work independently. Git records each commit, supports branching and merging, and provides efficient code management and version control. Each time an image is built, the relevant Dockerfile and build instructions are submitted to the Git repository, forming a version history. If the next build requires the same base image, git can quickly trace back to the already built version without having to re-execute the entire build process, thereby saving time and resources.
It can be understood that the scheme of the embodiment does not destroy the function of the original Continuous Integration (CI) flow, and quickly realizes cross-platform compiling construction.
In this embodiment, the container image management device obtains the original container image file from the image repository, and determines the instruction type of the original container image file. If the instruction type meets the requirement, the container mirror management device sends an instruction to the remote host. Accordingly, the remote host computer can receive and execute the instructions, build a cross-platform container image file, and upload it to the image repository. The process gets rid of the condition limitation of the invariable operating system of the container cluster and the virtualization tool, and the construction of the cross-platform container mirror image file is efficiently realized through the mutual cooperation of the container mirror image management device, the remote host and the mirror image warehouse.
Further, referring to fig. 3, a second embodiment of the container image management method of the present application provides a flowchart, and based on the embodiment shown in fig. 1, the container image management method further includes:
step a011 creates an initial cross-platform container mirror layer based on the container manager tool.
And step A012, obtaining the cross-platform container image file from the image warehouse.
And step A013, adding the cross-platform base container mirror image in the cross-platform container mirror image file into the initial cross-platform container mirror image layer to obtain a target cross-platform container mirror image layer.
Step A014, pushing the target cross-platform container mirror layer to the mirror warehouse; the cross-platform base container mirror image in the target cross-platform container mirror image layer can be used for the container mirror image management device to operate.
In particular, the container manager tool to which the present embodiment relates is preferably a Podman, a software tool for creating, running and managing containers. The container manager tool provides a set of interfaces and functions that enable a user to easily deploy, run, and monitor containerized applications.
After uploading the cross-platform container mirror image file to a mirror image warehouse by a remote host and replacing an original container mirror image file in the mirror image warehouse by the cross-platform container mirror image file, the container mirror image management device creates an initial cross-platform container mirror image layer based on the Podman, then obtains the cross-platform container mirror image file from the mirror image warehouse, and adds a cross-platform basic container mirror image in the cross-platform container mirror image file into the initial cross-platform container mirror image layer to obtain a target cross-platform container mirror image layer.
Further, the container mirror image management device pushes the target cross-platform container mirror image layer into the mirror image warehouse. It can be understood that the cross-platform base container mirror image in the target cross-platform container mirror image layer is a final version which is constructed and can be provided for operation, and the container mirror image management device can perform various operations such as pulling (acquiring), checking, deleting, modifying and the like on the cross-platform base container mirror image in the target cross-platform container mirror image layer.
The following is a code example for realizing the present embodiment:
setting various environment variables: export imagename= "mirror name"; export tag= "mirror tag"; export singleImageName = "single mirror name"; export singleImageTag = "single mirror label".
Creating an initial cross-platform container mirror layer: podman manifest create $ { imageName } $ { tag } (e.g., podman manifest create registry-c.cmft.com/base/cmrhjava-multi: 8_0_27).
Adding a cross-platform base container mirror image (the cross-platform base container mirror image is pushed to a mirror image warehouse along with a cross-platform container mirror image file in advance) into the newly created initial cross-platform container mirror image layer to obtain a target cross-platform container mirror image layer: podman manifest add $ { imageName }: $ { tag } dock }// $ { single imageName } { single imageTag } (e.g., podman manifest create registry-c.cmft.com/base/cmrhjava-multi:8_0_27 dock:// registry-c.cmft.com/base/cmrhjava-arm64: 8.0.53).
Pushing the target cross-platform container mirror layer to a mirror warehouse: podman manifest push- -all $ { imageName } - { tag } dock }// $ { imageName } - { tag } (e.g., podman manifest push- -all registry-c.cmft. Com/base/cmrhjava-multi: 8_0_27).
In this embodiment, the target cross-platform container mirror layer may be obtained by creating an initial cross-platform container mirror layer, and integrating the cross-platform base container mirror into the initial cross-platform container mirror layer. After pushing the target cross-platform container mirror layer to the mirror warehouse, various operations can be ensured to be performed on the cross-platform basic container mirror among the target cross-platform container mirror layer normally. Therefore, the real-time performance and consistency of the cross-platform basic container mirror image are ensured, and the efficiency and controllability of container mirror image management are improved.
Further, referring to fig. 4, a flow chart is provided in a third embodiment of the container image management method according to the present application, based on the embodiment shown in fig. 3, the container image management method further includes:
step A021, responding to the mirror image operation instruction, and performing check operation or deletion operation on the cross-platform basic container mirror image in the target cross-platform container mirror image layer.
Specifically, after pushing the target cross-platform container mirror layer to the mirror warehouse, the container mirror management device may further perform a view operation or a delete operation on the cross-platform base container mirror in the target cross-platform container mirror layer in response to the mirror operation instruction. Wherein, the viewing operation may include viewing detailed information of the mirror image, such as the size of the mirror image, layer information, etc.; the delete operation refers to removing a certain image from the container image layer so that it is no longer available.
The following is a code example for realizing the present embodiment:
performing view operation on a cross-platform base container image in a target cross-platform container image layer: podman manifest inspect $ { imageName } $ { tag } (e.g., podman manifest inspect registry-c.cmft.com/base/cmrhjava-multi: 8_0_27).
Deleting the cross-platform basic container image in the target cross-platform container image layer: podman manifest remove $ { imageName }: $ { tag } sha256 } (e.g., podman manifest remove registry-c.cmft.com/base/cmrhjava-multi:8_0_27 sha256:8ded34db251d43fda58245c8a10c9c1f866c3f2ecbf19bfc0b18b7cc3ae94c08).
In the embodiment, by responding to the mirror image operation instruction, the cross-platform base container mirror image in the target cross-platform container mirror image layer is allowed to be checked or deleted, so that maintainability of the mirror image layer is improved. This allows a system administrator or developer to effectively manage the image, which is beneficial to timely cleaning the image that is no longer needed, and reduces storage space occupation.
Further, referring to fig. 5, a flow chart is provided in a fourth embodiment of the container image management method according to the present application, based on the embodiment shown in fig. 4, the container image management method further includes:
and step A031, responding to a service container image construction instruction, and acquiring the cross-platform basic container image from the target cross-platform container image layer.
And A032, generating a custom service container mirror image based on the cross-platform basic container mirror image and the service corresponding to the service container mirror image construction instruction.
Specifically, the container mirror image management device obtains a required cross-platform basic container mirror image from a target cross-platform container mirror image layer according to a service container mirror image construction instruction. This may involve retrieving, downloading or pulling a particular cross-platform base container image.
The service container image construction instruction is a set of instructions for defining and describing a process of how to construct the custom service container image. These instructions may include basic settings for the container, dependency installation, replication of application code, settings for the configuration file, and so forth. The construction flow of the container mirror image can be regulated through the service container mirror image construction instruction, so that the generated container can meet specific service requirements and running environment requirements.
On the basis of acquiring cross-platform base container images and business container image construction instructions, business services corresponding to the cross-platform base container images and business container image construction instructions are combined (or packaged) through executing the instructions, and custom business container images are generated. Where "business services" generally refer to applications or services, which are software services deployed into containers by containerization techniques, the specific content of the "business services" depends on the specific business needs and applications. The resulting custom service container image is a complete, operational container image.
In this embodiment, the cross-platform base container image is obtained from the target cross-platform container image layer by responding to the service container image construction instruction, and the custom service container image is generated on the basis of the service corresponding to the service container image construction instruction and the base image. This helps to automate the business container image build process, improving development efficiency, while ensuring that the built image meets specific business requirements.
Referring to fig. 6, a fifth embodiment of a container image management method of the present application provides a flowchart, where the container image management method is applied to a remote host, and the container image management method includes:
step B10, receiving a cross-platform container mirror image construction instruction; the container mirror image construction instruction is sent to the remote host by the container mirror image management device under the condition that the instruction type of the original container mirror image file is the container mirror image construction instruction; the original container mirror image file is obtained from a mirror image warehouse by the container mirror image management device; the instruction type of the original container image file is determined by the container image management device.
Specifically, the embodiment provides a container mirror image management method based on a container mirror image management device, a remote host and a mirror image warehouse, which is mainly used for constructing cross-platform container mirror image files. The container mirror image management device is hardware or software for managing the container mirror image and is used for retrieving, constructing, storing, distributing and operating the container mirror image; the remote host is a computer node which receives and executes tasks related to the container mirror image, such as constructing a cross-platform container mirror image, and is connected with a container mirror image management device usually through a network protocol; the image repository is a data or code repository for storing and managing container images. The container mirror image management device, the remote host and the mirror image warehouse belong to the same container cluster.
First, the container image management apparatus acquires an original container image file from an image repository. The original container image file (Dockerfile) contains not only the actual container image but also the relevant instructions needed to build the container image. The original container image file is essentially a script describing how to construct the container image, including information such as container images, dependencies, configuration, and runtime settings. The original container image file may be used to repeatedly build the same container image and ensure consistency in different environments.
After the original container image file is obtained, the container image management device further determines the instruction type of the original container image file. The instruction type of the original container mirror image file may be a common instruction or a cross-platform container mirror image construction instruction.
In the case that the instruction type of the original container image file is a cross-platform container image construction instruction, the container image management device sends the cross-platform container image construction instruction to the remote host. The cross-platform container image construction instruction is a set of instructions directing a remote host to construct a cross-platform base container image, ensuring seamless operation across multiple operating systems and architectures.
Accordingly, the remote host receives the cross-platform container image construction instruction sent by the container image management device.
And step B20, constructing a cross-platform container mirror image file according to the cross-platform container mirror image construction instruction.
Specifically, after receiving a cross-platform container image construction instruction sent by the container image management device, the remote host constructs a cross-platform container image file according to the cross-platform container image construction instruction, wherein the cross-platform container image file comprises a cross-platform base container image constructed by the remote host. By "cross-platform" is meant that the container image is capable of running on a variety of different operating systems and hardware architectures without modification, meaning that the cross-platform base container image can run seamlessly on a variety of platforms such as Linux, windows, as well as different architectures such as x86 and ARM, providing greater flexibility and portability.
And step B30, uploading the cross-platform container image file to the image warehouse to replace the original container image file in the image warehouse.
Specifically, the remote host may upload the cross-platform container image file to the image repository, and replace the original container image file in the image repository with the cross-platform container image file. Therefore, the latest version of the container image file is always stored in the image warehouse, and a user can conveniently utilize the cross-platform container image file in the image warehouse when needed.
Alternatively, the image repository may be a distributed version control system, git, repository.
It can be understood that the scheme of the embodiment does not destroy the function of the original Continuous Integration (CI) flow, and quickly realizes cross-platform compiling construction.
In this embodiment, the container image management device obtains the original container image file from the image repository, and determines the instruction type of the original container image file. If the instruction type meets the requirement, the container mirror management device sends an instruction to the remote host. Accordingly, the remote host computer can receive and execute the instructions, build a cross-platform container image file, and upload it to the image repository. The process gets rid of the condition limitation of the invariable operating system of the container cluster and the virtualization tool, and the construction of the cross-platform container mirror image file is efficiently realized through the mutual cooperation of the container mirror image management device, the remote host and the mirror image warehouse.
Further, referring to fig. 7, a flowchart is provided in a sixth embodiment of the container image management method, based on the embodiment shown in fig. 6, where the step of building the cross-platform container image file according to the cross-platform container image building instruction includes:
step B21, generating a temporary container mirror image file according to the cross-platform container mirror image construction instruction;
step B22, constructing single-platform basic container images corresponding to the CPU architectures of the plurality of central processing units based on the temporary container image file;
step B23, based on a preset container group list instruction, integrating single-platform base container images corresponding to the plurality of CPU architectures respectively to obtain cross-platform base container images;
and step B24, generating the cross-platform container mirror image file according to the cross-platform container mirror image construction instruction and the cross-platform base container mirror image.
Specifically, after receiving a cross-platform container image construction instruction sent by the container image management device, the remote host generates a temporary container image file according to the cross-platform container image construction instruction. Wherein the temporary container image is a partially constructed but not final container image.
In one case, the container cluster comprises computers of several CPU architectures, and the remote host is in communication connection with the computers of the several CPU architectures; in another case, the remote host comprises a computer of several CPU architectures. For any of the above cases, the remote host may construct a single-platform base container image corresponding to each of several CPU architectures based on the temporary container image file. It will be appreciated that the resulting number of single-platform base container images is a plurality, which is the basis for implementing cross-platform.
The container group list instruction related to the embodiment is preferably a pod manifest instruction, and the remote host integrates the generated single-platform base container images of each CPU architecture based on the preset pod manifest instruction to obtain a cross-platform base container image.
The remote host then combines (or packages) the cross-platform container image build instructions with the cross-platform base container image to generate a cross-platform container image file. It will be appreciated that the cross-platform container image file includes both cross-platform container image construction instructions and cross-platform base container images, and subsequent cross-platform container image files will be uploaded by the remote host to the image repository to replace the original container image file in the image repository with the cross-platform container image file.
The following is a code example for realizing the present embodiment:
after the corresponding cross-platform container mirror image construction instruction is identified: based on the instruction, a base image specified in FROM in the Dockerfile (original container image file), such as registry-c.cmft.com/cmhk-grd-ocp/base-a: v1.0.0, a Dockerdil file, such as Dockerdil. Base, i.e., temporary container image file, is regenerated.
On a computer on a specified CPU architecture, executing a dock build-t < basic image name- < CPU architecture > > -f dock. Base, and constructing a single platform basic container image of the specified CPU architecture, wherein the single platform basic container image is registry-c.cmft.com/cmhk-grd-ocp/base-a-linux-arm64 is v1.0.0. And repeating the steps to construct a single-platform basic container mirror image corresponding to each of the plurality of CPU architectures.
And integrating single-platform base container images corresponding to a plurality of CPU architectures through a pod management instruction to obtain cross-platform base container images, such as registry-c.cmft.com/cmhk-grd-ocp/base-a- < tenant code > - < project code > - < issue unit name > -multi-platform form: v1.0.0, namely cross-platform base container images. The cross-platform base container image is then uploaded into an image repository to replace the original container image file in the image repository with the cross-platform container image file.
The FROM registry-c.cmft.com/cmhk-grd-ocp/base-a- < tenant code > - < project code > - < issue unit name > -multiplform: v1.0.0 and cross-platform container image construction instructions are combined into a new Dockerfie (cross-platform container image file), the original Dockerfie (original container image file) is replaced, the new Dockerfie is automatically uploaded to a code warehouse such as Git, and the construction instructions are continuously executed.
In the embodiment, the construction of the cross-platform container mirror image file according to the cross-platform container mirror image construction instruction is realized by generating the temporary container mirror image file, constructing single-platform basic container mirror images corresponding to various CPU architectures and integrating and generating the cross-platform basic container mirror images. This helps to adapt to different CPU architectures, improving portability and flexibility of the image, thereby better meeting diversified deployment requirements.
Further, referring to fig. 8, a flow chart is provided in a seventh embodiment of the container image management method of the present application, based on the embodiment shown in fig. 7, the step of constructing a single-platform base container image corresponding to each of several CPU architectures of a central processing unit based on the temporary container image file includes:
and step B231, constructing single-platform base container images corresponding to a plurality of CPU architectures in an X86 architecture, an AMD64 architecture, an ARM64 architecture and a RISC-V architecture respectively based on the temporary container image file.
Specifically, the CPU architecture according to the present embodiment is preferably an X86 architecture, an AMD64 architecture, an ARM64 architecture, or a RISC-V architecture. The remote host can construct single-platform base container images corresponding to a plurality of CPU architectures in an X86 architecture, an AMD64 architecture, an ARM64 architecture and a RISC-V architecture based on the temporary container image file. The result of each build is a single platform base container image for a particular CPU architecture, and such a process ensures that container images of the corresponding architecture can be run on different hardware platforms.
In this embodiment, the single-platform base container image corresponding to each of the multiple CPU architectures is mainly implemented, including an X86 architecture, an AMD64 architecture, an ARM64 architecture, a RISC-V architecture, and the like. This helps accommodate different hardware platforms, making the container image more versatile, improving usability and applicability in diverse environments.
In addition, the embodiment of the application also provides a container mirror image management system, which comprises a container mirror image management device and a remote host, wherein the container mirror image management system and a mirror image warehouse belong to a container cluster;
the container mirror image management device is used for acquiring an original container mirror image file from the mirror image warehouse and determining the instruction type of the original container mirror image file; transmitting the cross-platform container mirror image construction instruction to the remote host under the condition that the instruction type of the original container mirror image file is the cross-platform container mirror image construction instruction;
the remote host is used for receiving the cross-platform container mirror image construction instruction; constructing the cross-platform container mirror image file according to the cross-platform container mirror image construction instruction; and uploading the cross-platform container image file to the image warehouse to replace the original container image file in the image warehouse.
Optionally, the mirror repository is a distributed version control system Git repository.
The principle and implementation process of the container image management are implemented in this embodiment, please refer to the above embodiments, and are not repeated here.
In addition, the embodiment of the application also provides a computer readable storage medium, wherein the computer readable storage medium stores a container mirror image management program, and the container mirror image management program realizes the steps of the container mirror image management method when being executed by a processor.
Because the container mirror image management program is executed by the processor and adopts all the technical schemes of all the embodiments, the container mirror image management program at least has all the beneficial effects brought by all the technical schemes of all the embodiments and is not described in detail herein.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or system 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 system. 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 system that comprises the element.
The foregoing embodiment numbers of the present application are merely for describing, and do not represent advantages or disadvantages of the embodiments.
From the above description of the embodiments, it will be clear to those skilled in the art that the above-described embodiment method may be implemented by means of software plus a necessary general hardware platform, but of course may also be implemented by means of hardware, but in many cases the former is a preferred embodiment. Based on such understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the prior art in the form of a software product stored in a storage medium (e.g. ROM/RAM, magnetic disk, optical disk) as above, including several instructions for causing a terminal device (which may be a mobile phone, a computer, a server, a controlled terminal, or a network device, etc.) to perform the method of each embodiment of the present application.
The foregoing description is only of the preferred embodiments of the present application, and is not intended to limit the scope of the claims, and all equivalent structures or equivalent processes using the descriptions and drawings of the present application, or direct or indirect application in other related technical fields are included in the scope of the claims of the present application.

Claims (10)

1. A container image management method, characterized in that the container image management method comprises:
acquiring an original container image file from an image warehouse, and determining the instruction type of the original container image file;
and under the condition that the instruction type of the original container mirror image file is a cross-platform container mirror image construction instruction, sending the cross-platform container mirror image construction instruction to a remote host, so that the remote host can receive and construct a cross-platform container mirror image file according to the cross-platform container mirror image construction instruction, and uploading the cross-platform container mirror image file to the mirror image warehouse to replace the original container mirror image file in the mirror image warehouse.
2. The container image management method according to claim 1, wherein the container image management method further comprises:
creating an initial cross-platform container mirror layer based on the container manager tool;
acquiring the cross-platform container image file from the image warehouse;
adding the cross-platform base container mirror image in the cross-platform container mirror image file into the initial cross-platform container mirror image layer to obtain a target cross-platform container mirror image layer;
pushing the target cross-platform container mirror layer to the mirror warehouse; the cross-platform base container mirror image in the target cross-platform container mirror image layer can be used for the container mirror image management device to operate.
3. The container image management method according to claim 2, wherein the container image management method further comprises:
and responding to the mirror image operation instruction, and performing view operation or deletion operation on the cross-platform basic container mirror image in the target cross-platform container mirror image layer.
4. The container image management method according to claim 2, wherein the container image management method further comprises:
responding to a service container image construction instruction, and acquiring the cross-platform basic container image from the target cross-platform container image layer;
and generating a custom service container mirror image based on the service corresponding to the cross-platform basic container mirror image and the service container mirror image construction instruction.
5. A container image management method, wherein the container image management method is applied to a remote host, the container image management method comprising:
receiving a cross-platform container mirror image construction instruction; the container mirror image construction instruction is sent to the remote host by the container mirror image management device under the condition that the instruction type of the original container mirror image file is the container mirror image construction instruction; the original container mirror image file is obtained from a mirror image warehouse by the container mirror image management device; the instruction type of the original container mirror image file is determined by the container mirror image management device;
constructing a cross-platform container mirror image file according to the cross-platform container mirror image construction instruction;
and uploading the cross-platform container image file to the image warehouse to replace the original container image file in the image warehouse.
6. The container image management method according to claim 5, wherein the step of constructing a cross-platform container image file according to the cross-platform container image construction instruction includes:
generating a temporary container mirror image file according to the cross-platform container mirror image construction instruction;
constructing single-platform basic container images corresponding to a plurality of CPU architectures based on the temporary container image file;
based on a preset container group list instruction, integrating single-platform basic container images corresponding to the CPU architectures respectively to obtain cross-platform basic container images;
and generating the cross-platform container mirror image file according to the cross-platform container mirror image construction instruction and the cross-platform base container mirror image.
7. The container image management method according to claim 6, wherein the step of constructing single-platform base container images corresponding to the CPU architectures of the plurality of types of central processing units based on the temporary container image file includes:
based on the temporary container mirror image file, a single-platform base container mirror image corresponding to each of a plurality of CPU architectures in an X86 architecture, an AMD64 architecture, an ARM64 architecture and a RISC-V architecture is constructed.
8. The container mirror image management system is characterized by comprising a container mirror image management device and a remote host, wherein the container mirror image management system and a mirror image warehouse belong to a container cluster;
the container mirror image management device is used for acquiring an original container mirror image file from the mirror image warehouse and determining the instruction type of the original container mirror image file; transmitting the cross-platform container mirror image construction instruction to the remote host under the condition that the instruction type of the original container mirror image file is the cross-platform container mirror image construction instruction;
the remote host is used for receiving the cross-platform container mirror image construction instruction; constructing the cross-platform container mirror image file according to the cross-platform container mirror image construction instruction; and uploading the cross-platform container image file to the image warehouse to replace the original container image file in the image warehouse.
9. The container image management system of claim 8, wherein the image repository is a distributed version control system, git, repository.
10. A computer readable storage medium, wherein a container image management program is stored on the computer readable storage medium, and the container image management program, when executed by a processor, implements the steps of the container image management method according to any one of claims 1-4 or 5-7.
CN202311614191.6A 2023-11-29 2023-11-29 Container mirror image management method, system and storage medium Pending CN117632495A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311614191.6A CN117632495A (en) 2023-11-29 2023-11-29 Container mirror image management method, system and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311614191.6A CN117632495A (en) 2023-11-29 2023-11-29 Container mirror image management method, system and storage medium

Publications (1)

Publication Number Publication Date
CN117632495A true CN117632495A (en) 2024-03-01

Family

ID=90029937

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311614191.6A Pending CN117632495A (en) 2023-11-29 2023-11-29 Container mirror image management method, system and storage medium

Country Status (1)

Country Link
CN (1) CN117632495A (en)

Similar Documents

Publication Publication Date Title
CN109120678B (en) Method and apparatus for service hosting of distributed storage system
US8656387B2 (en) Method and system for workload distributing and processing across a network of replicated virtual machines
US11347555B2 (en) Integrated system to distribute and execute complex applications
Bui et al. Work queue+ python: A framework for scalable scientific ensemble applications
US8544007B2 (en) Customization, deployment and management of virtual and physical machine images in an enterprise system
US8443347B2 (en) Translating declarative models
US9292215B2 (en) Managing virtual hard disk snapshots
US7370322B1 (en) Method and apparatus for performing online application upgrades in a java platform
CN112632566B (en) Vulnerability scanning method and device, storage medium and electronic equipment
CN111527474B (en) Dynamic delivery of software functions
CN111580926A (en) Model publishing method, model deploying method, model publishing device, model deploying device, model publishing equipment and storage medium
US9904574B2 (en) Parallel computing without requiring antecedent code deployment
CN114546588A (en) Task deployment method and device, storage medium and electronic device
CN113253887A (en) Application issuing method, computer device and readable storage medium
US10992733B1 (en) Workload management in hybrid clouds
US20190012161A1 (en) Distributed and self-deleting apparatus for fast software deployment and upgrade in a network
CN117632495A (en) Container mirror image management method, system and storage medium
CN110837394B (en) High-availability configuration version warehouse configuration method, terminal and readable medium
CN105530140A (en) Cloud scheduling system, method and device for removing tight coupling of use case and environment
CN114327770A (en) Container cluster management system and method
US20180173552A1 (en) System and method for content - application split
CN113641641A (en) Switching method, switching system, equipment and storage medium of file storage service
CN113672334A (en) Container management method and device
CN113608744B (en) Method for establishing environment construction unit for executing distributed compiling and distributed compiling system
CN111240998B (en) Test case processing method and device

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