Method and system for improving Java application program deployment efficiency based on Docker technology

By performing incremental code updates and compilation on Docker images, the problem of complex deployment processes and image accumulation in existing Docker deployment Java programs is solved, and the rapid deployment and performance improvement of Java applications is achieved.

CN119396527APending Publication Date: 2025-02-07CHINA POWER CONSTR EAST CHINA SURVEY DESIGN & RES INST (ZHENGZHOU) CO LTD +2
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411457350.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-18
Publication Date
2025-02-07

AI Technical Summary

Technical Problem

The existing Docker method to deploy Java programs has complex deployment process and "small" updates that require re-pulling of all images, resulting in image stacking and long deployment time, affecting system availability and performance.

Method used

By obtaining a Docker image that can run Java programs, modify the code and package the incremental code, upload it to the server, share or copy it to the container, compile and update it to Jar, and finally restart the container to achieve system update.

Benefits of technology

It realizes rapid deployment of Java applications, reduces transmission volume and time, avoids mirror accumulation, improves system and server performance, and saves storage resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119396527A_ABST
    Figure CN119396527A_ABST
Patent Text Reader

Abstract

The invention relates to a method and a system for improving Java application program deployment efficiency based on a Docker technology. The method is suitable for software operation. According to the technical scheme, the method comprises the steps that a Docker mirror image capable of running a Java program is obtained; packaging the incremental code after code modification on the basis of the Docker mirror image, and uploading the incremental code to a server; the incremental code in the server is shared or copied to a container; compiling the incremental code shared or copied into the container and updating the incremental code into the Jar; and restarting the updated container. According to the method, code modification is carried out on the Docker mirror image capable of running the Java program, the modified incremental code is packaged and uploaded to the server, the incremental code file shared or copied into the container is compiled and updated, the updated container is restarted to realize system updating, packaging, mirror image manufacturing and pulling of the full amount of codes are not needed, and the system updating efficiency is improved. And the rapid deployment of the program can be realized only by uploading the updated incremental code to a specified path of the server.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a method and system for improving the deployment efficiency of Java applications based on Docker technology, which is applicable to the field of software operation and maintenance. Background Art

[0002] Deploying Java programs with Docker refers to the process of deploying Java applications using Docker containerization technology. Docker is a lightweight containerization solution that can package Java applications and their dependencies into an independent image and deploy and run them in different environments. Using Docker to deploy Java programs can bring many benefits, such as fast deployment, resource isolation, and flexible expansion.

[0003] Currently, the existing Docker deployment method for Java programs is usually to build pipelines through DevOps (such as Figure 1 As shown in the figure, the deployment process is complicated, and "small" updates still need to re-pull all images, which can easily cause image accumulation and long deployment time, ultimately leading to reduced system availability and performance. Summary of the invention

[0004] The technical problem to be solved by the present invention is: in view of the above-mentioned problems, a method and system for improving the deployment efficiency of Java applications based on Docker technology are provided.

[0005] The technical solution adopted by the present invention is: a method for improving the efficiency of Java application deployment based on Docker technology, characterized by comprising:

[0006] Get a Docker image that can run Java programs;

[0007] Package the incremental code modified based on the Docker image and upload it to the server;

[0008] Share or copy incremental code from the server to the container;

[0009] Compile and update the incremental code shared or copied to the container into the Jar;

[0010] Restart the updated container.

[0011] The step of obtaining a Docker image capable of running a Java program includes:

[0012] Replace the base image in the container with a base image that contains the Java hot deployment command;

[0013] An image is created based on a basic image with a Java hot deployment command to obtain a Docker image that can run Java programs.

[0014] The step of sharing or copying the incremental code in the server to the container includes:

[0015] Copy the incremental code file or share the folder where it is located, transfer the incremental code file of the host machine to the container through the Docker Copy command or mount the corresponding directory through the volume command;

[0016] Authorize the incremental code files transferred to the container or the mounted directory, and grant executable permissions to the container using the Chmod command.

[0017] The incremental code shared or copied to the container is compiled and updated into the Jar, including:

[0018] Create a directory for the incremental code file, and create a directory that is consistent with the relative path of the Class file in the Jar;

[0019] Move the incremental code file to the created directory and ensure that the relative path of the current incremental code file is consistent with that of the Class file in the Jar.

[0020] Execute the Javac command on the moved incremental code to compile the incremental code file to obtain the incremental compiled code;

[0021] Execute the Java-uvf command for the incremental compilation code to ensure that the incremental code is updated to the jar.

[0022] A system for improving Java application deployment efficiency based on Docker technology, characterized by comprising:

[0023] The first module is used to obtain a Docker image that can run Java programs;

[0024] The second module is used to package and upload the incremental code modified based on the Docker image to the server;

[0025] The third module shares or copies the incremental code in the server to the container;

[0026] The fourth module is used to compile the incremental code shared or copied to the container and update it into the Jar;

[0027] The fifth module is used to restart the updated container.

[0028] The step of obtaining a Docker image capable of running a Java program includes:

[0029] Replace the base image in the container with a base image that contains the Java hot deployment command;

[0030] An image is created based on a basic image with a Java hot deployment command to obtain a Docker image that can run Java programs.

[0031] The step of sharing or copying the incremental code in the server to the container includes:

[0032] Copy the incremental code file or share the folder where it is located, transfer the incremental code file of the host machine to the container through the Docker Copy command or mount the corresponding directory through the volume command;

[0033] Authorize the incremental code files transferred to the container or the mounted directory, and grant executable permissions to the container using the Chmod command.

[0034] The incremental code shared or copied to the container is compiled and updated into the Jar, including:

[0035] Create a directory for the incremental code file, and create a directory that is consistent with the relative path of the Class file in the Jar;

[0036] Move the incremental code file to the created directory and ensure that the relative path of the current incremental code file is consistent with that of the Class file in the Jar.

[0037] Execute the Javac command on the moved incremental code to compile the incremental code file to obtain the incremental compiled code;

[0038] Execute the Java-uvf command for the incremental compilation code to ensure that the incremental code is updated to the jar.

[0039] The beneficial effects of the present invention are as follows: the present invention performs code modification on a Docker image that can run Java programs, packages the modified incremental code and uploads it to a server, the server shares or copies the incremental code file to a container, compiles and updates the incremental code file shared or copied to the container, and restarts the updated container to implement system updates. There is no need to package, image, and pull the full amount of code, and only the updated incremental code needs to be uploaded to a specified path on the server, thereby enabling rapid deployment of the program.

[0040] The present invention replaces the full code and its environment-dependent images with incremental code, greatly reducing the transmission volume and shortening the transmission time, especially when the network condition is poor. The present invention updates the jar in the container by compiling the incremental code package, replacing the image pull, alleviating the incremental image accumulation problem caused by frequent updates, improving the performance of the system and server, and saving storage resources. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] Figure 1 The flowchart of deploying Java program in Docker in the prior art.

[0042] Figure 2 This is a flow chart of Example 1. DETAILED DESCRIPTION

[0043] Embodiment 1: This embodiment is a method for improving the efficiency of Java application deployment based on Docker technology, which specifically includes the following steps:

[0044] S1. Replace the base image in the container with a base image that contains a Java hot deployment command. Ensure that the new base image contains a Jar hot deployment command by replacing the JDK image in the DockerFile file. Create an image based on the DockerFile file that has been updated to create the Docker image, and obtain a Docker image that can run Java programs.

[0045] S2. Package the incremental code after code modification based on the Docker image that can run Java programs and upload it to the server.

[0046] Modify the code based on the Docker image that can run Java programs, package the modified incremental code to obtain a lightweight code compression file; upload the obtained code compression file to ensure that the deployment package exists on the server; decompress the code package to ensure that the code package is complete and readable.

[0047] In this embodiment, only the updated incremental code is uploaded to the server specified path, which greatly reduces the transmission volume and shortens the transmission time, especially when the network condition is poor.

[0048] S3. Share the incremental code in the server through Docker disk or copy it to the container to ensure that the container can read the incremental code file.

[0049] Copy the incremental code file uploaded in step S2 or share the folder where it is located, transfer the incremental code file of the host machine to the container through the Docker Copy command or mount the corresponding directory through the volume instruction.

[0050] Authorize the incremental code files transferred to the container or the mounted directory, and grant executable permissions to the container through the Chmod command to ensure that the container can operate the incremental code files.

[0051] S4. Compile and update the incremental code files shared or copied to the container to ensure that the incremental code is updated to the Jar.

[0052] S4-1. Create a directory for the incremental code files shared or copied to the container, ensuring that the directory created is consistent with the relative path of the Class file in the Jar;

[0053] S4-2. Move the incremental code file to the directory created in step S4-1, and ensure that the relative path of the current incremental code file is consistent with that of the Class file in the Jar;

[0054] S4-3, executing the Javac command on the incremental code moved in step S4-2 to compile the incremental code file to ensure that the incremental code is executable;

[0055] S4-4. Execute the Java-uvf command on the incremental compiled code obtained in step S4-3 to ensure that the incremental code is updated to jar.

[0056] S5. Restart the container updated in step S4 to ensure that the new Jar is loaded and the system is updated.

[0057] Table 1 below is a software environment list table of a method for improving Java application deployment efficiency based on Docker technology in an embodiment.

[0058] Table 1 Software environment list for deploying Java programs in Docker

[0059]

[0060] Based on the above hardware and software environment, the same version of code was launched to compare this embodiment with the existing Docker deployment method. The experimental results are shown in Table 2.

[0061] Table 2 Comparison of experimental results

[0062]

[0063] This embodiment first replaces the basic image in the traditional container, packages the incremental code, uploads it to the server, then shares the code file through Docker disk or copies it to the container, then compiles and updates the code file, and finally restarts the updated container to achieve system updates. This solves the problem of complex deployment process in the process of deploying Java programs with existing Docker technology, and that "small" updates still require re-pulling all images, which easily causes image accumulation and long deployment time, ultimately leading to reduced system availability and performance.

[0064] In this embodiment, application deployment only requires uploading updated incremental code to the specified path of the server, which greatly reduces the transmission volume and shortens the transmission time. It can also be deployed quickly, especially in poor network conditions. At the same time, it avoids pulling image layers, reduces image accumulation, and improves server performance to a certain extent.

[0065] Embodiment 2: This embodiment is a system for improving the deployment efficiency of Java applications based on Docker technology, including first, second, third, fourth and fifth modules.

[0066] In this example, the first module is used to obtain a Docker image that can run Java programs, replace the base image in the container with a base image that has a Java hot deployment command; and create an image based on the base image that has a Java hot deployment command to obtain a Docker image that can run Java programs.

[0067] In this embodiment, the second module is used to package the incremental code after the code is modified based on the Docker image and upload it to the server.

[0068] In this example, the third module shares or copies the incremental code in the server to the container, copies the incremental code file or shares the folder where it is located, transfers the incremental code file of the host to the container through the Docker Copy command or mounts the corresponding directory through the volume instruction; authorizes the incremental code file transferred to the container or the mounted directory, and grants executable permissions to the container through the Chmod command.

[0069] The fourth module in this embodiment is used to compile the incremental code shared or copied to the container and update it to the Jar. Create a directory for the incremental code file, and create a directory that is consistent with the relative path of the Class file in the Jar; move the incremental code file to the created directory to ensure that the current incremental code file is consistent with the relative path of the Class file in the Jar; execute the Javac command on the moved incremental code to compile the incremental code file to obtain the incremental compiled code; execute the Java-uvf command on the incremental compiled code to ensure that the incremental code is updated to the jar.

[0070] In this embodiment, the fifth module is used to restart the updated container to ensure that the new Jar is loaded and the system is updated.

[0071] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the present invention.

Claims

1. A method for improving the deployment efficiency of Java applications based on Docker technology, characterized in that: include: Get a Docker image that can run Java programs; Package the incremental code modified based on the Docker image and upload it to the server; Share or copy incremental code from the server to the container; Compile and update the incremental code shared or copied to the container into the Jar; Restart the updated container.

2. The method for improving the deployment efficiency of Java applications based on Docker technology according to claim 1, characterized in that: The step of obtaining a Docker image capable of running a Java program includes: Replace the base image in the container with a base image that contains the Java hot deployment command; An image is created based on a basic image with a Java hot deployment command to obtain a Docker image that can run Java programs.

3. The method for improving Java application deployment efficiency based on Docker technology according to claim 1, characterized in that: The step of sharing or copying the incremental code in the server to the container includes: Copy the incremental code file or share the folder where it is located, transfer the incremental code file of the host machine to the container through the Docker Copy command or mount the corresponding directory through the volume command; Authorize the incremental code files transferred to the container or the mounted directory, and grant executable permissions to the container using the Chmod command.

4. The method for improving Java application deployment efficiency based on Docker technology according to claim 1, characterized in that: The incremental code shared or copied to the container is compiled and updated into the Jar, including: Create a directory for the incremental code file, and create a directory that is consistent with the relative path of the Class file in the Jar; Move the incremental code file to the created directory and ensure that the relative path of the current incremental code file is consistent with that of the Class file in the Jar. Execute the Javac command on the moved incremental code to compile the incremental code file to obtain the incremental compiled code; Execute the Java-uvf command for the incremental compilation code to ensure that the incremental code is updated to the jar.

5. A system for improving Java application deployment efficiency based on Docker technology, characterized in that: include: The first module is used to obtain a Docker image that can run Java programs; The second module is used to package and upload the incremental code modified based on the Docker image to the server; The third module shares or copies the incremental code in the server to the container; The fourth module is used to compile the incremental code shared or copied to the container and update it into the Jar; The fifth module is used to restart the updated container.

6. The system for improving Java application deployment efficiency based on Docker technology according to claim 5, characterized in that: The step of obtaining a Docker image capable of running a Java program includes: Replace the base image in the container with a base image that contains the Java hot deployment command; An image is created based on a basic image with a Java hot deployment command to obtain a Docker image that can run Java programs.

7. The system for improving Java application deployment efficiency based on Docker technology according to claim 5, characterized in that: The step of sharing or copying the incremental code in the server to the container includes: Copy the incremental code file or share the folder where it is located, transfer the incremental code file of the host machine to the container through the Docker Copy command or mount the corresponding directory through the volume command; Authorize the incremental code files transferred to the container or the mounted directory, and grant executable permissions to the container using the Chmod command.

8. The method for improving Java application deployment efficiency based on Docker technology according to claim 5, characterized in that: The incremental code shared or copied to the container is compiled and updated into the Jar, including: Create a directory for the incremental code file, and create a directory that is consistent with the relative path of the Class file in the Jar; Move the incremental code file to the created directory and ensure that the relative path of the current incremental code file is consistent with that of the Class file in the Jar. Execute the Javac command on the moved incremental code to compile the incremental code file to obtain the incremental compiled code; Execute the Java-uvf command for the incremental compilation code to ensure that the incremental code is updated to the jar.