Podman-based cloud server adaptation method and device
By using the podman environment and custom shell scripts on cloud servers, the problem of high resource consumption in traditional cloud server operating system adaptation is solved, achieving efficient adaptation and cost reduction.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-30
- Publication Date
- 2026-03-31
AI Technical Summary
Traditional cloud server operating system adaptation methods require a large amount of development resources and testing and verification processes, resulting in high human resource consumption, long adaptation cycles, and delayed release times.
The podman environment is used for installation and system image installation, running containers, deploying service business and adding custom shell scripts in containers, generating new images, disabling services that conflict with host services, installing podman related packages, and achieving cloud server adaptation.
It improved cloud server adaptation efficiency, reduced development, testing and maintenance costs, simplified the adaptation process, and solved the problems of large workload and long cycle.
Smart Images

Figure CN116185434B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of desktop cloud computing technology, and more specifically to a cloud server adaptation method and apparatus based on podman. Background Technology
[0002] Cloud servers are the infrastructure of the desktop cloud computing industry chain, requiring adaptation based on a fundamental operating system. Traditional server operating systems include CentOS, Red Hat, Ubuntu, and Debian. In recent years, newer operating systems have emerged, such as Anolis, Emuler, Red Flag, UOS, and Kylin. Different scenarios may require different operating systems as the underlying system for adaptation. As cloud computing service providers, we must quickly and accurately adapt to different systems or versions of operating systems.
[0003] However, using traditional adaptation methods to adapt to different operating systems and different versions requires not only a lot of development resources, but also a lot of testing and verification processes. This not only demands a lot of human resources, but also prolongs the adaptation cycle and causes delays in release time. Summary of the Invention
[0004] In view of the shortcomings of the existing technology, the purpose of this invention is to provide a cloud server adaptation method and device based on podman, which can improve adaptation efficiency and reduce development, testing and maintenance costs.
[0005] To achieve the above objectives, this invention provides a cloud server adaptation method based on podman, which specifically includes the following steps:
[0006] Install the podman environment and system image, and run the container;
[0007] Deploying services and adding custom shell scripts within containers, and regenerating new images, enables the construction of cloud server runtime images.
[0008] Install the podman-related packages on the server host to be adapted, and install the newly generated image;
[0009] Install and monitor services to start the container, and disable services that conflict with the container to achieve cloud server compatibility.
[0010] The custom shell script is used to resolve conflicts between the container process and the host service within the podman environment, as well as to resolve the issue of duplicate libvirt UUIDs.
[0011] Based on the above technical solution, the custom shell script is specifically used to optimize services to disable irrelevant services to resolve conflicts with host services, regenerate libvirt's UUID, regenerate iscsi's initiatorname, create and modify permissions of necessary system directories or files, and create and modify permissions of necessary business directories or files.
[0012] Based on the above technical solution, before regenerating a new image, the following is also included:
[0013] Modify the poweroff and reboot commands within the container to send signals to the server host via the server host-container communication mechanism.
[0014] Add a user authentication module inside the container.
[0015] Based on the above technical solution, the specific steps for installing and launching the container service include:
[0016] Add permissions, pass through the server host network, pass through local devices, mount the working directory, specify the container's run program entry point as init, specify the container's image to use as the newly generated image, and mount the host password file, etc and shadow into the container.
[0017] Based on the above technical solution, after mounting the host password file, etc and shadow into the container, the method further includes: renaming the host password file, etc and shadow mounted into the container for use by the user authentication module inside the container.
[0018] Based on the above technical solutions, services that conflict with containers include NFS and firewalld.
[0019] This invention provides a cloud server adaptation device based on podman, comprising:
[0020] The installation module is used to install the podman environment, install system images, and run containers.
[0021] The build module is used to deploy service business in containers and add custom shell scripts, regenerate new images, and build cloud server running images.
[0022] The loading module is used to install podman-related packages on the server host to be adapted, and to install the regenerated image.
[0023] The adaptation module is used to install services and monitoring services for starting containers, as well as to disable services that conflict with containers, thereby achieving cloud server adaptation.
[0024] The custom shell script is used to resolve conflicts between the container process and the host service within the podman environment, as well as to resolve the issue of duplicate libvirt UUIDs.
[0025] Based on the above technical solution, the custom shell script is specifically used to optimize services to disable irrelevant services to resolve conflicts with host services, regenerate libvirt's UUID, regenerate iscsi's initiatorname, create and modify permissions of necessary system directories or files, and create and modify permissions of necessary business directories or files.
[0026] Based on the above technical solution, before regenerating a new image, the following is also included:
[0027] Modify the poweroff and reboot commands within the container to send signals to the server host via the server host-container communication mechanism.
[0028] Add a user authentication module inside the container.
[0029] Based on the above technical solution, the specific process of installing and launching the container service includes:
[0030] Add permissions, pass through the server host network, pass through local devices, mount the working directory, specify the container's run program entry point as init, specify the container's image to use as the newly generated image, and mount the host password file, etc and shadow into the container.
[0031] Compared with existing technologies, the advantages of this invention are as follows: By installing the podman environment and system image, running the container, deploying service business and adding custom shell scripts in the container, and regenerating a new image, the cloud server running image is constructed. Then, the podman-related packages are installed on the server host to be adapted, and the regenerated image is installed. Finally, the services for starting the container and monitoring services are installed, and services that conflict with the container are disabled, thus achieving cloud server adaptation. This effectively solves the problems of large workload, long adaptation cycle, and high human resource consumption in adapting to various server operating systems, thereby improving adaptation efficiency and reducing development, testing, and maintenance costs. Attached Figure Description
[0032] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0033] Figure 1 This is a flowchart of a cloud server adaptation method based on podman in an embodiment of the present invention. Detailed Implementation
[0034] This invention provides a podman-based cloud server adaptation method. It involves installing the podman environment and system image, running a container, deploying services and adding custom shell scripts within the container, and regenerating a new image to build the cloud server runtime image. Then, podman-related packages are installed on the server host to be adapted, along with the newly generated image. Finally, services and monitoring services for starting the container are installed, and services that conflict with the container are disabled. This achieves cloud server adaptation, effectively solving the problems of high workload, long adaptation cycles, and high human resource consumption in adapting to various server operating systems, thereby improving adaptation efficiency and reducing development, testing, and maintenance costs. This invention also provides a podman-based cloud server adaptation device.
[0035] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are some embodiments of this application, but not all embodiments.
[0036] See Figure 1 As shown in the figure, the cloud server adaptation method based on podman provided by this embodiment of the invention specifically includes the following steps:
[0037] S1: Install the podman (a daemon-free, open-source Linux native tool) environment and system image, and run the container;
[0038] This involves installing the podman environment on a system, installing a system image, and then running containers.
[0039] S2: Deploy service business and add custom shell scripts in the container, regenerate a new image, and build the cloud server running image; the custom shell script is used to resolve conflicts between the container process and the host service in the podman environment, as well as to resolve the problem of duplicate libvirt (tools and application interfaces for managing KVM virtual machines) UUID (Universally Unique Identifier).
[0040] That is, based on the container environment in step S1, the service business is deployed into it and debugged. Then, based on the container environment in step S1, a custom shell script is added.
[0041] In this invention, the custom shell script is specifically used to optimize services by disabling irrelevant services to resolve conflicts with host services, regenerate libvirt's UUID, regenerate iscsi (small computer system interface) initiatorname, create and modify permissions of necessary system directories or files, and create and modify permissions of necessary business directories or files.
[0042] In this invention, before regenerating a new image, the following steps are also included:
[0043] S201: Modify the poweroff (virtual machine shutdown command) and reboot (system restart command) commands within the container to send signals to the server host through the communication mechanism between the server host and the container. For example, modify them to send "shutdown" and "reboot" signals to the server host through the communication mechanism between the server host and the container. Furthermore, the communication mechanism includes, but is not limited to, local communication mechanisms such as file identifiers, pipes, and sockets.
[0044] S202: Add a user authentication module inside the container.
[0045] Once service operations are deployed in the container, custom shell scripts are added, and a user authentication module is added within the container, a new image can be generated based on the already built environment.
[0046] S3: Install the podman-related packages on the server host to be adapted, and install the newly generated image;
[0047] S4: Install and monitor services for starting the container, and disable services that conflict with the container to achieve cloud server compatibility. Services that conflict with the container include NFS (Network File System) and firewalld (firewall management tool).
[0048] In this invention, the specific steps for installing and launching the container service include:
[0049] Add permissions, pass through the server host network, pass through local devices, mount the working directory, specify the container's run program entry point as init (a user-level process started by the kernel), specify the container's image to use as a newly generated image, and mount the host password file, etc (a folder in Linux systems, generally used to store the entire file system configuration files required by the program) and shadow (shadow file) into the container.
[0050] In this invention, after mounting the host password file, etc., and shadow into the container, the method further includes renaming the host password file, etc., and shadow mounted into the container for use by the user authentication module within the container.
[0051] Specifically, the cloud server adaptation method of the present invention includes cloud server runtime image construction based on podman and cloud server adaptation based on podman.
[0052] For cloud server image building based on podman, the building steps are as follows: add business through system image, customize shell script. The main purpose of custom shell script is to resolve conflicts between the container process in the podman environment and the host service, resolve libvirt uuid duplication issues, and create and modify permissions of necessary system directories or files, as well as create and modify permissions of necessary business directories or files.
[0053] For cloud server adaptation based on podman, the steps are as follows: install the podman runtime packages, install the scripts to run on the host and start the business services, modify the host system to disable services that conflict with the container, and install the podman runtime environment image. Notably, building the cloud server runtime image only requires adaptation once; subsequent adaptation and installation can be performed on various operating systems. By running the entire server business within a single container, the adaptation process is simplified, achieving rapid server adaptation to operating systems and solving the problems of high adaptation difficulty and long adaptation cycles.
[0054] The podman-based cloud server adaptation method of this invention involves installing the podman environment and system image, running the container, deploying service business and adding custom shell scripts within the container, regenerating a new image, and building a cloud server runtime image. Then, podman-related packages are installed on the server host to be adapted, along with the newly generated image. Finally, services and monitoring services for starting the container are installed, and services that conflict with the container are disabled. This method effectively solves the problems of large workload, long adaptation cycles, and high human resource consumption in adapting to various server operating systems, thereby improving adaptation efficiency and reducing development, testing, and maintenance costs.
[0055] In one possible implementation, the present invention also provides a readable storage medium located in a PLC (Programmable Logic Controller) controller. The readable storage medium stores a computer program that, when executed by a processor, implements the steps of the podman-based cloud server adaptation method described below:
[0056] Install the podman environment and system image, and run the container;
[0057] Deploying services and adding custom shell scripts within containers, and regenerating new images, enables the construction of cloud server runtime images.
[0058] Install the podman-related packages on the server host to be adapted, and install the newly generated image;
[0059] Install and monitor services to start the container, and disable services that conflict with the container to achieve cloud server compatibility.
[0060] The custom shell script is used to resolve conflicts between the container process and the host service within the podman environment, as well as to resolve the issue of duplicate libvirt UUIDs.
[0061] Storage media may be any combination of one or more computer-readable media. A computer-readable medium may be a computer-readable signal medium or a computer-readable storage medium. Computer-readable storage media may be, for example, but not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatuses, or devices, or any combination thereof. More specific examples (a non-exhaustive list) of computer-readable storage media include: electrical connections having one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this document, a computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
[0062] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, capable of transmitting, propagating, or transmitting programs for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium may be transmitted using any suitable medium, including but not limited to: wireless, wireline, optical fiber, RF, etc., or any suitable combination thereof.
[0063] Computer program code for performing the operations of this invention can be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, and C++, as well as conventional procedural programming languages—such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0064] This invention provides a cloud server adaptation device based on podman, which includes an installation module, a build module, a loading module, and an adaptation module.
[0065] The installation module is used to install the podman environment and system image, and to run the container. The build module is used to deploy services within the container, add custom shell scripts, and regenerate a new image to build the cloud server runtime image. The loading module is used to install podman-related packages on the host server to be adapted, and to install the regenerated image. The adaptation module is used to install services for starting the container and monitoring services, and to disable services that conflict with the container, thus achieving cloud server adaptation. The custom shell scripts are used to resolve conflicts between the container process in the podman environment and the host service, as well as to resolve libvirt UUID duplication issues.
[0066] In this invention, the custom shell script is specifically used to optimize services by disabling irrelevant services to resolve conflicts with host services, regenerate libvirt's UUID, regenerate iscsi's initiatorname, create and modify permissions of necessary system directories or files, and create and modify permissions of necessary business directories or files.
[0067] In this invention, before regenerating a new image, the following steps are also included:
[0068] Modify the poweroff and reboot commands within the container to send signals to the server host via the server host-container communication mechanism.
[0069] Add a user authentication module inside the container.
[0070] In this invention, the specific process of installing and launching the container service includes:
[0071] Add permissions, pass through the server host network, pass through local devices, mount the working directory, specify the container's run program entry point as init, specify the container's image to use as the newly generated image, and mount the host password file, etc and shadow into the container.
[0072] The above description is merely a specific embodiment of this application, enabling those skilled in the art to understand or implement this application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this application. Therefore, this application is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features claimed herein.
[0073] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can 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, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
Claims
1. A podman-based cloud server adaptation method, characterized in that, Specifically comprising the following steps: The installation of the podman environment, the installation of the system image, and the running of the container are performed; The deployment of service business and the addition of a custom shell script in the container are performed, a new image is regenerated, and the construction of a cloud server running image is implemented; The podman related package is installed on the server host to be adapted, and the regenerated image is installed; The installation of the service and the monitoring service for starting the container is performed, and the service conflicting with the container is disabled, so as to adapt the cloud server; Before the new image is regenerated, the following steps are further included: The poweroff and reboot commands in the container are modified to send a signal to the server host through the server host and the container communication mechanism; A user verification module is added in the container; The custom shell script is specifically used for service optimization to disable irrelevant services to solve the conflict with the host service, regenerate the uuid of libvirt to solve the problem of repeated libvirt uuid, regenerate the initiatorname of iscsi, create and modify the permissions of the system required directory or file, and create and modify the permissions of the business required directory or file.
2. The podman-based cloud server adaptation method of claim 1, wherein, The service for starting the container is installed, and the specific steps include: The permissions are added, the server host network is transmitted, the local device is transmitted, the working directory is mounted, the running program entry of the container is specified as init, the usage image of the container is specified as the regenerated image, and the host password file, etc and shadow are mounted into the container.
3. The podman-based cloud server adaptation method of claim 2, wherein, After the host password file, etc and shadow are mounted into the container, the following steps are further included: the host password file, etc and shadow mounted into the container are renamed for use by the user verification module in the container.
4. The podman-based cloud server adaptation method of claim 1, wherein: The services conflicting with the container include nfs and firewalld. 5.A podman-based cloud server adaptation apparatus, characterized in that, It includes: The installation module is used to install the podman environment, install the system image, and run the container; The construction module is used to deploy service business and add a custom shell script in the container, regenerate a new image, and implement the construction of a cloud server running image; The loading module is used to install the podman related package on the server host to be adapted, and install the regenerated image; The adaptation module is used to install the service and the monitoring service for starting the container, and disable the service conflicting with the container, so as to adapt the cloud server; Before the new image is regenerated, the following steps are further included: The poweroff and reboot commands in the container are modified to send a signal to the server host through the server host and the container communication mechanism; A user verification module is added in the container; The self-defined shell script is specifically used for service optimization to disable irrelevant services to solve the conflict with the host service, regenerate the uuid of libvirt to solve the problem of repeated libvirt uuid, regenerate the initiatorname of iscsi, create and modify the permissions of the system required directory or file, and create and modify the permissions of the business required directory or file.
6. The podman-based cloud server adaptation apparatus of claim 5, wherein, The service of installing and starting the container includes the following specific processes: Adding permissions, transmitting the server host network, transmitting the local device, performing working directory mounting, specifying the running program entry of the container as init, specifying the used image of the container as the regenerated image, and mounting the host password file, etc and shadow into the container.