Method, device and equipment for automatically upgrading Docker container and storage medium
By receiving upgrade instructions in the Docker container, the environment checksum snapshot backup is solved, and the problem of lossless back-up cannot be achieved when upgrading the Docker container, the speed, security and fault tolerance of automated upgrades are achieved, ensuring that it can return when an error occurs. Retracement to the previous version reduces the complexity and risk of manual operations.
Patent Information
- Application Number
- CN202411226339.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-03
- Publication Date
- 2025-01-14
AI Technical Summary
There is a problem that the Docker container is upgraded with an update error that cannot fall back to the original version without loss. Automatic upgrade requires providing source code to customers, which increases complexity and risk.
Provides an automatic upgrade method for Docker containers. By receiving upgrade instructions, obtaining upgrade packages, using preset upgrade tools for environment verification, if the conditions are met, snapshot backup will be performed and the image container will be replaced, ensuring that it can be rolled back to the upgrade error. Previous version.
It solves the problem of fastness, security and fault tolerance of Docker container upgrades, reduces the error rate of manual operation, improves system stability and data security, and ensures that it can fall back to the previous version without loss when an upgrade error occurs.
Smart Images

Figure CN119311367A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of Docker container upgrade, and in particular to a method, apparatus, device and storage medium for automatic upgrade of a Docker container. Background Art
[0002] With the continuous development of software development and deployment, containerization technology has become an important part of the modern development process. As one of the most popular containerization platforms, Docker provides us with a convenient, flexible and scalable container management method.
[0003] Currently, there are two types of Docker container upgrades: manual upgrade and automatic upgrade. Manual upgrades include manual start and stop of containers and manual updates of Docker Compose. Automatic upgrades include CI / CD (Jenkins, GitLab, GitHub) updates. Manual container upgrades require manual effort and are prone to errors. Although automatic upgrades solve the problem of manual effort, there are still problems such as the inability to roll back to the original version without loss when an update error occurs, and the need to provide source code to customers. Summary of the invention
[0004] The present application provides a method, apparatus, device and storage medium for automatically upgrading a Docker container, which can solve the problem that a Docker container cannot be restored to its original version without loss when an update error occurs.
[0005] In order to achieve the above objectives, this application adopts the following technical solutions:
[0006] In a first aspect of an embodiment of the present application, a method for automatically upgrading a Docker container is provided, the method comprising:
[0007] After receiving the upgrade instruction of the target Docker container, obtain the upgrade package corresponding to the target Docker container, and call the preset upgrade tool, wherein the upgrade package includes the target image container after the target Docker container is upgraded;
[0008] Using the upgrade tool to verify the current upgrade environment, if the current upgrade environment meets the preset conditions, then loading the target image container;
[0009] A snapshot backup is performed on the target Docker container, and the current image container of the target Docker container is replaced with the target image container.
[0010] As a possible implementation, before receiving the upgrade instruction of the target Docker container, the method further includes:
[0011] Pre-installing the upgrade tool, container management tool and snapshot tool on the current device;
[0012] The disk in the current device is preprocessed to obtain a target storage space.
[0013] As a possible implementation manner, the using the upgrade tool to verify the current upgrade environment includes:
[0014] Using the upgrade tool to check the remaining memory of the target storage space, the installation status of the snapshot tool and the container management tool, and whether the upgrade tool is executing an upgrade task;
[0015] If the current upgrade environment meets the preset conditions, loading the target image container includes:
[0016] If the remaining memory of the target storage space is greater than the preset memory size, the installation status is all installed, and the upgrade tool has no upgrade task being executed, then the target image container is loaded.
[0017] As a possible implementation manner, the upgrade package is an encrypted file, and before loading the target image container, the method further includes:
[0018] The upgrade package is decrypted, and the MD5 value of the decrypted upgrade package is calculated to see whether it is consistent with the MD5 value before encryption. If they are consistent, the target image container is loaded.
[0019] As a possible implementation, before replacing the current image container of the target Docker container with the target image container, the method further includes:
[0020] If the upgrade package includes a pre-upgrade program, executing the pre-upgrade program;
[0021] The step of replacing the current image container of the target Docker container with the target image container includes:
[0022] If the pre-upgrade program is executed successfully, the target image container is used to replace the current image container of the target Docker container.
[0023] As a possible implementation manner, after executing the pre-upgrade program, the method further includes:
[0024] If the pre-upgrade program execution fails, a snapshot rollback is performed on the target Docker container.
[0025] As a possible implementation manner, after replacing the current image container of the target Docker container with the target image container, the method further includes:
[0026] If the upgrade package includes an upgraded program, executing the upgraded program;
[0027] If the upgraded program fails to execute, a snapshot rollback is performed on the target Docker container.
[0028] In a second aspect of an embodiment of the present application, a device for automatically upgrading a Docker container is provided, the device comprising:
[0029] An acquisition module is used to, after receiving an upgrade instruction of a target Docker container, acquire an upgrade package corresponding to the target Docker container and call a preset upgrade tool, wherein the upgrade package includes a target image container after the target Docker container is upgraded;
[0030] A verification module, used to verify the current upgrade environment using the upgrade tool, and if the current upgrade environment meets the preset conditions, load the target image container;
[0031] The upgrade module is used to perform a snapshot backup of the target Docker container and replace the current image container of the target Docker container with the target image container.
[0032] In a third aspect of an embodiment of the present application, an electronic device is provided, including a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the automatic upgrade method for the Docker container in the first aspect of the embodiment of the present application is implemented.
[0033] In a fourth aspect of an embodiment of the present application, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the method for automatically upgrading a Docker container in the first aspect of an embodiment of the present application is implemented.
[0034] The beneficial effects brought by the technical solution provided by the embodiment of the present application include at least:
[0035] The method for automatic upgrading of Docker containers provided in the embodiment of the present application obtains the upgrade package corresponding to the target Docker container and calls a preset upgrade tool after receiving the upgrade instruction of the target Docker container, wherein the upgrade package includes the target image container after the target Docker container is upgraded; the current upgrade environment is verified by using the upgrade tool, and if the current upgrade environment meets the preset conditions, the target image container is loaded; a snapshot backup of the target Docker container is performed, and the current image container of the target Docker container is replaced by the target image container. The method for automatic upgrading of Docker containers provided in the embodiment of the present application can solve the problems of speed, security and fault tolerance of Docker container upgrades, and in the event of an upgrade error, it can roll back to the previous version. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] Figure 1 A flow chart of a method for automatically upgrading a Docker container provided in an embodiment of the present application;
[0037] Figure 2 A structural diagram of a device for automatically upgrading a Docker container provided in an embodiment of the present application;
[0038] Figure 3 A structural diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0039] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0040] In the following, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of the embodiments of the present disclosure, unless otherwise specified, "plurality" means two or more.
[0041] Additionally, the use of “based on” or “according to” is meant to be open and inclusive, as a process, step, calculation, or other action “based on” or “according to” one or more conditions or values may, in practice, be based on additional conditions or beyond values.
[0042] The widespread application of virtualization technology and cloud computing has promoted the development of snapshot technology. Virtualization technology allows multiple virtual machines to run on a single physical server, and each virtual machine can run different operating systems and applications independently. Cloud computing provides elastic computing resources and storage services, making the management of data and applications more complex and diverse. This requires more flexible and efficient environment management and data protection measures. Automatic container upgrades allow rapid iterations and rollbacks to a stable state at any time, thereby improving development efficiency and system stability. And with the continuous development of software development and deployment, containerization technology has become an important part of the modern development process. Docker, as one of the most popular containerization platforms, provides us with a convenient, flexible and scalable way to manage containers.
[0043] Currently, there are two types of Docker container upgrades: manual upgrade and automatic upgrade. Manual upgrades include manual start and stop of containers and manual updates of Docker Compose. Automatic upgrades include CI / CD (Jenkins, GitLab, GitHub) updates. Manual container upgrades require manual effort and are prone to errors. Automatic upgrades such as Jenkins, GitLab, and GitHub solve the problem of manual upgrades requiring manual effort, but there is still the problem of not being able to roll back to the original version without loss when an update error occurs, and the problem of needing to provide source code to customers.
[0044] Based on the above problems, the present application embodiment provides a method for automatically upgrading a Docker container, such as Figure 1 As shown, the method comprises the following steps:
[0045] Step 101: After receiving an upgrade instruction of a target Docker container, an upgrade package corresponding to the target Docker container is obtained, and a preset upgrade tool is called, wherein the upgrade package includes a target image container after the target Docker container is upgraded.
[0046] Optionally, before executing step 101 to receive the upgrade instruction of the target Docker container, the method further includes:
[0047] The upgrade tool, container management tool and snapshot tool are pre-installed on the current device; and the disk in the current device is pre-processed to obtain a target storage space.
[0048] Among them, the container management tool can be Docker Compose, which is a tool for defining and managing multi-container Docker applications. It uses YAML files to configure application services, and can create and start all services with a single command. Docker Compose simplifies complex application deployment and management, making development and operation more efficient.
[0049] The snapshot tool can be Snapper, which is a powerful package management and application snapshot tool widely used in modern Linux distributions. By providing simplified package management, version control, and enhanced security, Snapper greatly improves the efficiency of system management and application maintenance. Whether in development, testing, or production environments, Snapper provides a reliable solution to help users better manage their applications and data. Here it is used for snapshots and rollbacks of Docker container data disks.
[0050] The upgrade tool can be developed in Golang, and the build process compiles the source code into an executable binary file. Go's build tool is very efficient and intuitive, supports cross-platform compilation, and can quickly generate small statically linked binary files. Use Linux's Systemctl to automatically manage binary files, and use the upgrade tool to control the import and execution of Docker containers, files, and scripts in the upgrade package, as well as Snapper to execute snapshots of Docker container data disks and rollback after upgrade exceptions. In addition, the upgrade tool provides an API interface that can realize automated upgrades, thereby improving the compatibility and flexibility of the system and adapting to different application scenarios.
[0051] In addition, before executing step 101, the method further includes: formatting a disk in the current device into Btrfs format for mounting the Docker container data disk to quickly and efficiently manage snapshots.
[0052] Step 102: Use the upgrade tool to verify the current upgrade environment. If the current upgrade environment meets the preset conditions, load the target image container.
[0053] Step 103: perform a snapshot backup of the target Docker container, and use the target image container to replace the current image container of the target Docker container.
[0054] Specifically, you can use Snapper to back up Docker container snapshots, which ensures the integrity of the original system and lossless rollback to minimize security risks and losses.
[0055] The method for automatic upgrading of Docker containers provided in the embodiment of the present application obtains the upgrade package corresponding to the target Docker container and calls a preset upgrade tool after receiving the upgrade instruction of the target Docker container, wherein the upgrade package includes the target image container after the target Docker container is upgraded; the current upgrade environment is verified by using the upgrade tool, and if the current upgrade environment meets the preset conditions, the target image container is loaded; a snapshot backup of the target Docker container is performed, and the current image container of the target Docker container is replaced by the target image container. The method for automatic upgrading of Docker containers provided in the embodiment of the present application can solve the problems of speed, security and fault tolerance of Docker container upgrades, and in the event of an upgrade error, it can roll back to the previous version.
[0056] Optionally, in step 102, verifying the current upgrade environment using the upgrade tool includes:
[0057] Using the upgrade tool to check the remaining memory of the target storage space, the installation status of the snapshot tool and the container management tool, and whether the upgrade tool is executing an upgrade task;
[0058] Correspondingly, in the above step 102, if the current upgrade environment meets the preset conditions, loading the target image container includes:
[0059] If the remaining memory of the target storage space is greater than the preset memory size, the installation status is all installed, and the upgrade tool has no upgrade task being executed, then the target image container is loaded.
[0060] Optionally, the upgrade package is an encrypted file. Before loading the target image container in step 102, the method further includes:
[0061] The upgrade package is decrypted, and the MD5 value of the decrypted upgrade package is calculated to see whether it is consistent with the MD5 value before encryption. If they are consistent, the target image container is loaded.
[0062] It is understandable that the upgrade package is encrypted for overall security through the built-in method, and its MD5 value is calculated to generate an encrypted upgrade package. The upgrade package is decrypted before the upgrade, and the MD5 value of the decrypted upgrade package is calculated to see if it is consistent with the MD5 value before encryption. If they are consistent, the target image container is loaded, which can ensure the integrity and security of the upgrade package. In addition, this encryption method can improve the security of the upgrade package, prevent tampering, occupy very little memory during operation, is lightweight and suitable for Linux systems, and has higher scalability.
[0063] Optionally, before replacing the current image container of the target Docker container with the target image container in step 103, the method further includes: if the upgrade package includes a pre-upgrade program, executing the pre-upgrade program;
[0064] Correspondingly, the step of replacing the current image container of the target Docker container with the target image container in step 103 includes: if the pre-upgrade program is successfully executed, replacing the current image container of the target Docker container with the target image container.
[0065] After executing the pre-upgrade program, the method further includes: if the pre-upgrade program fails to execute, performing a snapshot rollback on the target Docker container.
[0066] Among them, the pre-upgrade program may include a time synchronization program, an SSH control program, and a Docker restart control program, etc.
[0067] That is, if there is a pre-upgrade program in the upgrade package, the pre-upgrade program is executed, and then the container import replacement in the upgrade package is started. If the pre-upgrade program fails to execute, the upgrade tool is used to control the Docker upgrade to terminate and execute the Snapper snapshot rollback.
[0068] Optionally, after replacing the current image container of the target Docker container with the target image container in step 103, the method further includes:
[0069] If the upgrade package includes an upgraded program, the upgraded program is executed; if the upgraded program fails to execute, a snapshot rollback is performed on the target Docker container.
[0070] Among them, the upgraded programs may be a time synchronization program, an SSH control program, and a Docker restart control program, etc. That is, the time synchronization program, the SSH control program, and the Docker restart control program may be executed before or after the Docker container is upgraded.
[0071] If the program fails to execute after the upgrade, the Snapper snapshot rollback will be executed. If the program is executed successfully after the upgrade, the current upgrade information will be recorded and the upgrade success will be prompted. During the upgrade process, the current upgrade log information can be viewed in real time.
[0072] The method for automatic upgrading of Docker containers provided in the embodiment of the present application is to obtain the upgrade package corresponding to the target Docker container after receiving the upgrade instruction of the target Docker container, and call the preset upgrade tool, wherein the upgrade package includes the target image container after the target Docker container is upgraded; use the upgrade tool to verify the current upgrade environment, and if the current upgrade environment meets the preset conditions, load the target image container; take a snapshot backup of the target Docker container, and use the target image container to replace the current image container of the target Docker container. The method for automatic upgrading of Docker containers provided in the embodiment of the present application can solve the problems of speed, security and fault tolerance of Docker container upgrades, and in the case of an upgrade error, it can be rolled back to the previous version. In addition, the upgrade tool can be used instead of manual operation, which can significantly reduce the error rate in the execution process and improve the stability of the overall operation. The upgrade tool replaces the traditional CI / CD automated upgrade, which not only effectively improves the execution speed, but also improves the accuracy and consistency of execution.
[0073] In addition, the upgrade tool provides an API interface to achieve automated upgrades, thereby improving the compatibility and flexibility of the system and adapting to different application scenarios. At the same time, Snapper is used to take snapshots of Docker containers to achieve lossless upgrades, effectively improving the fault tolerance and reliability of the upgrade process and ensuring data security. The use of the upgrade tool simplifies the operation and maintenance process, reduces manual intervention, and improves operation and maintenance efficiency and productivity.
[0074] It can be understood that the method for automatically upgrading the Docker container provided in the embodiment of the present application can effectively solve the problems of speed, security and fault tolerance of container upgrading.
[0075] The tool mainly includes two parts: 1. Security encryption and verification: The first part uses a built-in method to perform overall security encryption on the upgrade package, calculates its MD5 value, generates an encrypted upgrade package, and ensures the integrity and security of the upgrade package. 2. Upgrade function and fault-tolerant mechanism: The second part implements the upgrade function. First, the upgrade package is decrypted and verified, and then Snapper is used to perform a snapshot operation on the data disk of the Docker container to ensure that data will not be lost during the upgrade process. In addition, this part also opens up the script file execution interface before and after the upgrade to enhance the scalability of the upgrade content. The tool controls the entire upgrade process to ensure that a rollback operation can be performed when an error occurs during the upgrade process, and supports upgrades through API integration. Through these designs, the present invention can effectively improve the efficiency, stability and security of container upgrades, ensure the reliability of the upgrade process and the security of data.
[0076] like Figure 2As shown, an embodiment of the present application provides a device for automatically upgrading a Docker container, the device comprising:
[0077] The acquisition module 11 is used to obtain the upgrade package corresponding to the target Docker container after receiving the upgrade instruction of the target Docker container, and call a preset upgrade tool, wherein the upgrade package includes the target image container after the target Docker container is upgraded;
[0078] A verification module 12 is used to verify the current upgrade environment using the upgrade tool, and if the current upgrade environment meets the preset conditions, load the target image container;
[0079] The upgrade module 13 is used to perform a snapshot backup of the target Docker container and replace the current image container of the target Docker container with the target image container.
[0080] In one embodiment, the device further comprises a processing module 14, wherein the processing module 14 is configured to:
[0081] Pre-installing the upgrade tool, container management tool and snapshot tool on the current device;
[0082] The disk in the current device is preprocessed to obtain a target storage space.
[0083] In one embodiment, the verification module 12 is specifically used for:
[0084] Using the upgrade tool to check the remaining memory of the target storage space, the installation status of the snapshot tool and the container management tool, and whether the upgrade tool is executing an upgrade task;
[0085] If the current upgrade environment meets the preset conditions, loading the target image container includes:
[0086] If the remaining memory of the target storage space is greater than the preset memory size, the installation status is all installed, and the upgrade tool has no upgrade task being executed, then the target image container is loaded.
[0087] In one embodiment, the upgrade package is an encrypted file, and the verification module 12 is further used to:
[0088] The upgrade package is decrypted, and the MD5 value of the decrypted upgrade package is calculated to see whether it is consistent with the MD5 value before encryption. If they are consistent, the target image container is loaded.
[0089] In one embodiment, the processing module 14 is further configured to:
[0090] If the upgrade package includes a pre-upgrade program, executing the pre-upgrade program;
[0091] The step of replacing the current image container of the target Docker container with the target image container includes:
[0092] If the pre-upgrade program is executed successfully, the target image container is used to replace the current image container of the target Docker container.
[0093] In one embodiment, the upgrade module 13 is further used for:
[0094] If the pre-upgrade program execution fails, a snapshot rollback is performed on the target Docker container.
[0095] In one embodiment, the upgrade module 13 is specifically used for:
[0096] If the upgrade package includes an upgraded program, executing the upgraded program;
[0097] If the upgraded program fails to execute, a snapshot rollback is performed on the target Docker container.
[0098] The Docker container automatic upgrade device provided in this embodiment can execute the above-mentioned Docker container automatic upgrade method embodiment, and its implementation principle and technical effect are similar, which will not be repeated here.
[0099] For the specific definition of the automatic upgrade device based on the Docker container, please refer to the definition of the automatic upgrade method of the Docker container above, which will not be repeated here. Each module in the above-mentioned automatic upgrade device for Docker containers can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor of the electronic device in the form of hardware, or can be stored in the memory of the electronic device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0100] The executor of the Docker container automatic upgrade method provided in the embodiment of the present application can be a local device, which can be an electronic device, which can be a computer device, a terminal device, a server or a server cluster, and the embodiment of the present application does not specifically limit this.
[0101] Figure 3 This is a schematic diagram of the internal structure of an electronic device provided in an embodiment of the present application. Figure 3As shown, the electronic device includes a processor and a memory connected via a system bus. The processor is used to provide computing and control capabilities. The memory may include a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The computer program can be executed by the processor to implement the steps of the Docker container automatic upgrade method provided in each of the above embodiments. The internal memory provides a cached operating environment for the operating system and computer program in the non-volatile storage medium.
[0102] Those skilled in the art will understand that Figure 3 The internal structure diagram of the electronic device shown in the figure is only a block diagram of a partial structure related to the scheme of the present application, and does not constitute a limitation on the electronic device to which the scheme of the present application is applied. The specific electronic device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0103] In another embodiment of the present application, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the automatic upgrade method of the Docker container in the embodiment of the present application are implemented.
[0104] In another embodiment of the present application, a computer program product is also provided. The computer program product includes computer instructions. When the computer instructions execute the various steps of the Docker container automatic upgrade method in the method flow shown in the above method embodiment.
[0105] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using a software program, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loading and executing computer execution instructions on a computer, the process or function according to the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. Computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, computer instructions can be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (digital subscriber line, DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server, data center, etc. that contains one or more servers that can be integrated with a medium. The available medium may be a magnetic medium (eg, a floppy disk, a hard disk, a magnetic tape), an optical medium (eg, a DVD), or a semiconductor medium (eg, a solid state disk (SSD)).
[0106] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0107] The above embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.
Claims
1. A method for automatically upgrading a Docker container, characterized in that: The method comprises: After receiving the upgrade instruction of the target Docker container, obtain the upgrade package corresponding to the target Docker container, and call the preset upgrade tool, wherein the upgrade package includes the target image container after the target Docker container is upgraded; Using the upgrade tool to verify the current upgrade environment, if the current upgrade environment meets the preset conditions, then loading the target image container; A snapshot backup is performed on the target Docker container, and the current image container of the target Docker container is replaced with the target image container.
2. The method according to claim 1, characterized in that Before receiving the upgrade instruction of the target Docker container, the method further includes: Pre-installing the upgrade tool, container management tool and snapshot tool on the current device; The disk in the current device is preprocessed to obtain a target storage space.
3. The method according to claim 1, characterized in that The verifying the current upgrade environment by using the upgrade tool includes: Using the upgrade tool to check the remaining memory of the target storage space, the installation status of the snapshot tool and the container management tool, and whether the upgrade tool is executing an upgrade task; If the current upgrade environment meets the preset conditions, loading the target image container includes: If the remaining memory of the target storage space is greater than the preset memory size, the installation status is all installed, and the upgrade tool has no upgrade task being executed, then the target image container is loaded.
4. The method according to claim 1 or 3, characterized in that: The upgrade package is an encrypted file. Before loading the target image container, the method further includes: The upgrade package is decrypted, and the MD5 value of the decrypted upgrade package is calculated to see whether it is consistent with the MD5 value before encryption. If they are consistent, the target image container is loaded.
5. The method according to claim 1, characterized in that Before replacing the current image container of the target Docker container with the target image container, the method further includes: If the upgrade package includes a pre-upgrade program, executing the pre-upgrade program; The step of replacing the current image container of the target Docker container with the target image container includes: If the pre-upgrade program is executed successfully, the target image container is used to replace the current image container of the target Docker container.
6. The method according to claim 5, characterized in that After executing the pre-upgrade program, the method further includes: If the pre-upgrade program execution fails, a snapshot rollback is performed on the target Docker container.
7. The method according to claim 1, characterized in that After replacing the current image container of the target Docker container with the target image container, the method further includes: If the upgrade package includes an upgraded program, executing the upgraded program; If the upgraded program fails to execute, a snapshot rollback is performed on the target Docker container.
8. A device for automatically upgrading a Docker container, characterized in that: The device comprises: An acquisition module is used to, after receiving an upgrade instruction of a target Docker container, acquire an upgrade package corresponding to the target Docker container and call a preset upgrade tool, wherein the upgrade package includes a target image container after the target Docker container is upgraded; A verification module, used to verify the current upgrade environment using the upgrade tool, and if the current upgrade environment meets the preset conditions, load the target image container; The upgrade module is used to perform a snapshot backup of the target Docker container and replace the current image container of the target Docker container with the target image container.
9. A local device, characterized in that: The invention comprises a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the method for automatically upgrading a Docker container according to any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium, characterized in that: A computer program is stored thereon, and when the computer program is executed by a processor, the method for automatically upgrading a Docker container according to any one of claims 1 to 7 is implemented.