Backup method and recovery method of docker-based Linux operating system
The backup and recovery of the Linux operating system is solved through docker technology, which is time-consuming, large occupancy and poor security, and realizes efficient and secure operating system replication and recovery.
Patent Information
- Application Number
- CN202411093682.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-09
- Publication Date
- 2024-11-22
AI Technical Summary
The backup and recovery methods of existing Linux operating systems are time-consuming, have large space usage, poor data security, and cannot distinguish scenes during recovery, resulting in a high risk of user data loss.
Using docker-based backup method, data transmission is carried out through the docker client and the image warehouse of the backup server, target subdirectories are filtered out, docker images are generated and backups are uploaded. During recovery, filter and restore the target docker images according to the recovery mode and backup time.
Save backup time and space, improve data security, support different recovery modes to meet different scenario needs, improve user experience, and achieve efficient and accurate operating system replica.
Smart Images

Figure CN119003243A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a backup method and a recovery method of a Linux operating system based on Docker. Background Art
[0002] With the development of the times, the Linux operating system has gradually entered the field of vision of ordinary users and is moving towards daily use. However, for ordinary users, daily use often encounters sudden power outages, system freezes, and viruses, which require reinstalling the operating system. This creates the risk of user data loss, and backup and recovery of the Linux operating system becomes extremely important.
[0003] In the prior art, the backup and recovery of the Linux operating system is usually completed by copying all files and folders to a backup node, and then restoring through reverse copying.
[0004] This method has the following problems: 1. It is very time-consuming; 2. The space capacity of the backup node must be more than one-to-one; 3. All backup files are exposed and data security cannot be guaranteed; 4. There is no distinction between scenarios during recovery. When the user only has a few important files to recover, it still takes a long time to restore the entire system to obtain the files that are really needed. Summary of the invention
[0005] In order to solve the above problems existing in the prior art, the present invention provides a backup method and a recovery method of a Linux operating system based on Docker, which specifically include:
[0006] In a first aspect, the present invention provides a Docker-based Linux operating system backup method, which is applied to a user device, and a Docker client is deployed on the user device;
[0007] The Docker-based Linux operating system backup method includes:
[0008] In response to a backup instruction input by a user, acquiring attribute information of a backup server;
[0009] According to the attribute information, configure the Docker client on the user device so that the user device can use the https protocol and self-signed certificate to transmit data to the image repository on the backup server;
[0010] Filter out target subdirectories that meet preset conditions from the subdirectories of the root directory of the local Linux operating system;
[0011] Copy the target subdirectory to the preset backup directory;
[0012] Get the current time and generate a tag based on the current time;
[0013] Generate the target Docker image based on the tag label and the data in the backup directory;
[0014] Upload the target docker image to the image repository on the backup server to complete the Linux operating system backup.
[0015] In a second aspect, the present invention further provides a Docker-based Linux operating system recovery method, which is applied to a backup server, where an image repository is deployed;
[0016] The Docker-based Linux operating system recovery method includes:
[0017] In response to a recovery instruction input by a user, obtaining a recovery mode and a backup time from the recovery instruction;
[0018] According to the backup time, a target Docker image is selected from the image repository on the backup server, where the target Docker image is backed up in the image repository by any method in the first aspect;
[0019] Based on the recovery mode, perform recovery operations on the target Docker image.
[0020] In a third aspect, the present invention further provides an electronic device, comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus;
[0021] Memory, used to store computer programs;
[0022] The processor is used to implement any method provided in the first aspect or the second aspect when executing the program stored in the memory.
[0023] Beneficial effects of the present invention:
[0024] The backup method and recovery method of the Linux operating system based on docker provided by the present invention, the backup process is based on docker technology, the file system of the operating system is compressed and packaged into a docker image and uploaded to the image warehouse of the backup server, which saves time and space occupied by the backup. Since the docker image is not directly exposed and cannot be directly viewed, data security is protected, and the security and reliability of the backup result are also improved; the recovery process supports different recovery modes, which can meet the recovery requirements of different scenarios, and meet the different needs of users while saving recovery time, thereby improving user experience. The backup and recovery method provided by the present invention is not only for the backup of one or several files, but for the backup and recovery of the file system of the entire operating system, which can efficiently and accurately achieve the replication of the original system.
[0025] The present invention will be further described in detail below with reference to the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] Figure 1 A schematic diagram of a process flow of a backup method for a Linux operating system based on Docker provided by the present invention;
[0027] Figure 2 A schematic diagram of a process flow of another Docker-based Linux operating system backup method provided by the present invention;
[0028] Figure 3 A schematic diagram of a process flow of a Linux operating system recovery method based on Docker provided by the present invention;
[0029] Figure 4 A schematic flow chart of another method for recovering a Linux operating system based on Docker provided by the present invention. DETAILED DESCRIPTION
[0030] The present invention is further described in detail below with reference to specific embodiments, but the embodiments of the present invention are not limited thereto.
[0031] Figure 1 A schematic flow chart of a backup method for a Linux operating system based on Docker provided by the present invention is provided. The method is applied to a user device on which a Docker client is deployed.
[0032] like Figure 1 As shown, the method includes:
[0033] S101. In response to a backup instruction input by a user, obtain attribute information of a backup server.
[0034] Optionally, the attribute information includes at least one of an image repository service port, a self-signed certificate, and a private key file. Exemplarily, the attribute information includes an image repository service port, a self-signed certificate, and a private key file.
[0035] S102: According to the attribute information, configure the docker client on the user device so that the user device can use the https protocol and the self-signed certificate to perform data transmission with the image repository on the backup server.
[0036] S103: Filter out target subdirectories that meet preset conditions from the subdirectories of the root directory of the local Linux operating system.
[0037] Optionally, a target subdirectory that meets preset conditions is filtered out from the subdirectories of the root directory of the local Linux operating system, including: determining in sequence in a preset order whether the name of each subdirectory of the root directory of the local Linux operating system is any one of dev, sys, proc, run, tmp, media, mnt, cdrom, lost+found, recovery, and data; if so, skip it; if not, determine the current subdirectory as the target subdirectory until all subdirectories of the root directory of the local Linux operating system are traversed.
[0038] Among them, the root directory is the top-level directory of the Linux operating system, and all directories and files are located under the root directory.
[0039] Because dev, sys, proc, run, tmp, media, mnt, cdrom, lost+found, recovery, and data usually do not contain user-related data, filtering by the above method can reduce the amount of backup data, thus saving resources and improving backup efficiency.
[0040] For example, the following script can be used to implement the operation of filtering out target subdirectories that meet preset conditions from subdirectories of the root directory of the local Linux operating system. The details are as follows:
[0041]
[0042]
[0043] The above code uses shell script language only to illustrate the logic of this step. It does not mean that only this programming language can be used, nor is it a limitation on the implementation level of the present invention. Anything that conforms to the logic of this step or diverges from it should be considered as the scope of protection of this patent.
[0044] Optionally, before S104, the step further includes: determining whether a backup directory exists, and if not, creating a backup directory.
[0045] A directory is an organizational unit in the Linux operating system, which is used to store files and other directories, similar to folders in Windows systems. Specifically, determine whether a backup directory exists on the user's machine. If so, proceed to the next step. If not, create the directory.
[0046] S104: Copy the target subdirectory to a preset backup directory.
[0047] S105: Get the current time and generate a tag according to the current time.
[0048] In Docker images, tags are a method for marking and distinguishing different images.
[0049] The current time may be the time when this step is executed, or the time when the backup instruction of the current response is received may be used as the current time.
[0050] S106. Generate a target docker image based on the tag label and the data in the backup directory.
[0051] Specifically, execute the Linux command tar-c.|docker import-$imgtag command to package the current directory into a tar file and pass it to the docker import command through a pipe. Then docker import uses this tar file to create a new docker image.
[0052] Among them, tar -c. is used to package all files and subdirectories in the current directory into an archive file.
[0053] | is a pipe character, which is used to pass the output of the previous command as the input of the next command.
[0054] docker import – Used to create a new Docker image from an archive file read from standard input.
[0055] S107, uploading the target docker image to the image repository on the backup server to complete the Linux operating system backup.
[0056] Specifically, execute the docker push$imgtag command to upload the target docker image to the image repository of the backup server to complete the backup. Docker push is a docker command of the Linux operating system, which is used to push the local docker image to the remote docker image repository.
[0057] The Docker-based Linux operating system backup method provided by the present invention obtains the attribute information of the backup server in response to the backup instruction input by the user; configures the Docker client on the user device according to the attribute information, so that the user device can use the https protocol and the self-signed certificate to transmit data with the image warehouse on the backup server; filters out the target subdirectory that meets the preset conditions from the subdirectory of the root directory of the local Linux operating system; copies the target subdirectory to the preset backup directory; obtains the current time, and generates a tag label according to the current time, and generates a target Docker image based on the tag label and the data in the backup directory; uploads the target Docker image to the image warehouse on the backup server to complete the Linux operating system backup, realizes the compression and packaging of the file system of the operating system into the Docker image and uploads it to the image warehouse of the backup server, saves time, saves the space occupied by the backup, and protects the data security because the Docker image cannot be directly exposed and viewed directly, and also improves the security and reliability of the backup result.
[0058] Figure 2 A flowchart of another Docker-based Linux operating system backup method provided by the present invention is provided. The method is applied to a user device, and a Docker client is deployed on the user device. Figure 2 The embodiment shown in Figure 1 Based on the embodiment shown, the backup method of the Linux operating system based on Docker is further refined, such as Figure 2 As shown, the method includes:
[0059] S201. In response to a backup instruction input by a user, obtain attribute information of a backup server.
[0060] S202. According to the attribute information, configure the docker client on the user device so that the user device can use the https protocol and the self-signed certificate to perform data transmission with the image repository on the backup server.
[0061] S203, determine whether there is a backup directory, if not, execute S204, if yes, execute S205.
[0062] S204: Create a backup directory.
[0063] S205. Determine in sequence in a preset order whether the name of each subdirectory of the root directory of the local Linux operating system is any one of dev, sys, proc, run, tmp, media, mnt, cdrom, lost+found, recovery, and data. If so, skip it; if not, determine the current subdirectory as the target subdirectory until all subdirectories of the root directory of the local Linux operating system are traversed.
[0064] S206: Copy the target subdirectory to a preset backup directory.
[0065] S207: Get the current time and generate a tag according to the current time.
[0066] S208. Generate a target docker image based on the tag label and the data in the backup directory.
[0067] S209, uploading the target docker image to the image repository on the backup server to complete the Linux operating system backup.
[0068] Figure 3 The present invention provides a flow chart of a method for restoring a Linux operating system based on Docker. The method is applied to a backup server, and a mirror repository is deployed on the backup server, such as Figure 3 As shown, the method includes:
[0069] S301 . In response to a recovery instruction input by a user, a recovery mode and a backup time are obtained from the recovery instruction.
[0070] The recovery instruction transmitted to the backup server may be directly input by the user to the server, or may be input by the user to the user device and then transmitted to the backup server by the user device.
[0071] In a possible implementation, in response to a recovery instruction input by a user, the backup server directly obtains the recovery mode and backup time in the recovery instruction.
[0072] In another possible implementation, in response to a recovery instruction input by the user, the recovery mode and backup time are obtained, including: in response to the recovery instruction input by the user, querying whether the docker image backed up by the user exists in the image repository on the backup server, and if so, obtaining the recovery mode and backup time from the recovery instruction.
[0073] Exemplarily, the Docker image in the image repository on the backup server carries identification information related to the user, and the recovery instruction also carries identification information related to the user. The backup server can query whether there is a Docker image backed up by the user in the image repository based on the identification information related to the user.
[0074] S302: Filter out the target docker image from the image repository on the backup server according to the backup time.
[0075] The target docker image is backed up in the image repository by any docker-based Linux operating system backup method provided by the present invention.
[0076] Optionally, based on the backup time, filter out the target docker image from the image repository on the backup server, including: traversing the tag labels of each docker image in the image repository on the backup server, and determining the tag label whose corresponding time is not greater than and closest to the backup time as the target tag label; and determining the docker image corresponding to the target tag label as the target docker image.
[0077] In other words, if there is a docker image whose tag is consistent with the backup time, then the docker image is determined as the target docker image; if there is no docker image whose tag is consistent with the backup time, then the docker image whose tag is less than the backup time and closest to the backup time is determined as the target docker image.
[0078] There is usually a certain time interval between the user's backup system and the restoration system. Sometimes, the user of the backup system and the user of the restoration system are inconsistent, which results in the user who requests to restore the system being unable to enter the accurate backup time. The above method can not only effectively complete the restoration operation, but also reduce the requirements for the accuracy of the user's input information, reduce the difficulty of operation, and improve the user experience.
[0079] S303: Based on the recovery mode, perform a recovery operation on the target docker image.
[0080] Optionally, the recovery mode includes container mode and iso mode.
[0081] Specifically, restoring to container mode can use container technology to quickly restore a virtual environment that is identical to the backup node, allowing users to retrieve some important files.
[0082] Restoring to iso mode can restore the Docker image to a complete file system, and package it together with the initrd file and kernel file into an iso file that can be directly installed on the bare metal, meeting the user's need to restore the system to the same state as before after reinstalling the bare metal system.
[0083] When the recovery mode is the container mode, in a possible implementation, based on the recovery mode, a recovery operation is performed on the target docker image, including the following steps A1-A2:
[0084] A1. Start a temporary container based on the target Docker image, and configure the static IP address and remote login account information of the temporary container.
[0085] For example, pipework is used to configure a static IP for a temporary container. Pipework is a tool for configuring container networks, which allows users to set a static IP address for a container and connect the container to a specified network interface for communication.
[0086] Install the openssh-server service for remote login to the Linux system in the temporary container and enable root login permissions, close the firewall, configure the root user password, and prepare for remote login. The root user is the administrator user of the Linux operating system and has the highest permissions.
[0087] A2. Send the static IP address of the temporary container and the remote login account information to the user device, so that the user can access the temporary container according to the static IP address and the remote login account information to obtain the backed-up Linux operating system.
[0088] Specifically, the IP address of the temporary container and the root user password are returned to the user device.
[0089] Optionally, the recovery method of the Linux operating system based on Docker also includes: sending a first prompt message to the user device to prompt the user to log in to the temporary container using the remote login account information to obtain the required files.
[0090] Specifically, the IP address and root user password of the temporary container are returned to the user device, and the user is prompted to click the Finish button after the operation is completed. The user can log in to the container through ssh to view or save files.
[0091] Optionally, the recovery method of the Linux operating system based on Docker also includes: deleting the temporary container in response to a recovery completion instruction sent by the user device.
[0092] Specifically, after the user completes viewing or saving, he clicks Done and sends a restore completion instruction to the backup server. The backup server deletes the temporary container in response to the restore completion instruction sent by the user device.
[0093] When the recovery mode is iso mode, in a possible implementation, based on the recovery mode, a recovery operation is performed on the target docker image, including the following steps B1-B9:
[0094] B1. Pull the target Docker image to the local computer and save it as a .tar archive file.
[0095] Specifically, execute the docker pull command to pull the target docker image to the local computer. Docker pull is a command in the docker command line tool that is used to pull and download the specified image from the image repository to the local computer.
[0096] Execute the docker save -o command (such as docker save -o imgB.tar imgB) to save the target docker image as an archive file in .tar format. The docker save command is used to save one or more docker images into an archive file, and the -o option is used to specify the name of the output file.
[0097] B2. Decompress the data of each layer corresponding to the archive file into the same temporary directory to obtain the decompression result.
[0098] Specifically, the archive file in .tar format is decompressed into a temporary directory, and then decompressed layer by layer to decompress all of them into a temporary directory (such as / tmp / imgB / squashfs-root).
[0099] B3. Create a compressed file system for the Linux operating system based on the decompression result.
[0100] Specifically, execute the command mksquashfs.filesystem.squashfs to create a compressed file system for the Linux operating system based on the decompression result. mksquashfs is the command for making a SquashFS file system. The dot after mksquashfs indicates the current directory, and filesystem.squashfs is the name of the SquashFS file system to be made. This command makes the current directory into a SquashFS file system named filesystem.squashfs. The SquashFS file system plays an important role in the Linux installation iso image. It allows the file system to be stored in the iso image in a highly compressed form. When the installation medium is started, the SquashFS file system is mounted as read-only, and the installation program can read the required files from it.
[0101] B4. Mount the first iso file to the temporary mount point / mnt directory of the backup server.
[0102] Specifically, mount a directly installable iso file to a temporary mount point / mnt directory on the backup server. In the Linux operating system, the / mnt directory is a standard temporary mount point for temporarily mounting file systems. This directory is usually empty and is used by system administrators or system tools to mount external devices or temporary file systems when needed, such as USB drives, optical disks, network shares, etc.
[0103] B5. Create the iso target directory.
[0104] Specifically, create a new iso target directory.
[0105] B6. Copy all files except filesystem.squashfs in the temporary mount point / mnt directory to the iso target directory.
[0106] B7. Copy the compressed file system of the Linux operating system to the iso target directory.
[0107] B8. Generate the second iso file according to the iso target directory.
[0108] Specifically, use the genisoimage command to package and generate a new iso file. genisoimage is a command tool for the Linux operating system to generate ISO images that can be used to create bootable media.
[0109] B9. Send a prompt message to the user's device, prompting the user to download the second iso file.
[0110] Specifically, the backup server returns a prompt message to the user device, and the user downloads the second iso file, and then can install and run it on the bare metal to completely restore the operating system.
[0111] The Docker-based Linux operating system recovery method provided by the present invention obtains the recovery mode and backup time by responding to the recovery instruction input by the user; according to the backup time, the target Docker image is screened out from the image warehouse on the backup server, and the target Docker image is backed up in the image warehouse by any Docker-based Linux operating system backup method provided by the present invention; based on the recovery mode, the recovery operation is performed on the target Docker image, which can meet the recovery requirements of different scenarios, meet the different needs of users while saving recovery time, and improve user experience.
[0112] Figure 4 The present invention provides another flow chart of a recovery method for a Linux operating system based on Docker. The method is applied to a backup server, and an image repository is deployed on the backup server. According to the backup time, the step of selecting the target Docker image from the image repository on the backup server can also be performed after determining the recovery. Specifically, Figure 4 As shown, the method includes:
[0113] S401: Receive a restore instruction input by a user.
[0114] S402: Determine whether the user's backed-up docker image exists in the image repository on the backup server according to the recovery instruction. If yes, execute S403; otherwise, execute S418.
[0115] S403, obtaining the recovery mode and backup time from the recovery instruction, if the recovery mode is the container mode, executing S404, if the recovery mode is the iso mode, executing S408.
[0116] S404, traverse the tag labels of each docker image in the image repository on the backup server, determine the tag label whose corresponding time is not greater than and closest to the backup time as the target tag label, and determine the docker image corresponding to the target tag label as the target docker image.
[0117] S405. Start a temporary container according to the target Docker image, and configure the static IP address of the temporary container and the account information for remote login.
[0118] S406: Send the static IP address of the temporary container and the remote login account information to the user device, so that the user can access the temporary container according to the static IP address and the remote login account information to obtain the backed-up Linux operating system.
[0119] S407: In response to the restoration completion instruction sent by the user equipment, delete the temporary container.
[0120] S408, traverse the tag labels of each docker image in the image repository on the backup server, determine the tag label whose corresponding time is not greater than and closest to the backup time as the target tag label, and determine the docker image corresponding to the target tag label as the target docker image.
[0121] S409, pull the target docker image to the local computer and save it as an archive file in .tar format.
[0122] S410, decompressing each layer of data corresponding to the archive file into the same temporary directory to obtain a decompression result.
[0123] S411. Create a compressed file system of the Linux operating system according to the decompression result.
[0124] S412: Mount the first iso file to the temporary mount point / mnt directory of the backup server.
[0125] S413. Create an iso target directory.
[0126] S414. Copy all files except filesystem.squashfs in the temporary mount point / mnt directory to the iso target directory.
[0127] S415, copy the compressed file system of the Linux operating system to the iso target directory.
[0128] S416: Generate a second iso file according to the iso target directory.
[0129] Specifically, use the genisoimage command to package and generate a new iso file. genisoimage is a command tool for the Linux operating system to generate ISO images that can be used to create bootable media.
[0130] S417: Send a prompt message to the user device, prompting the user to download the second iso file.
[0131] S418. Send a second prompt message to the user device, prompting that the docker image backed up by the user does not exist in the image repository on the backup server.
[0132] The present invention also provides a structure of an electronic device, including a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus.
[0133] Memory, used to store computer programs;
[0134] The processor is used to implement the steps provided in any of the above method embodiments when executing the program stored in the memory.
[0135] The communication interface is used for communication between the above electronic device and other devices.
[0136] The method provided in the embodiment of the present invention can be applied to electronic devices. Specifically, the electronic device can be: a desktop computer, a portable computer, an intelligent mobile terminal, a server, etc. This is not limited here, and any electronic device that can implement the present invention belongs to the protection scope of the present invention.
[0137] The terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of the present invention, the meaning of "plurality" is two or more, unless otherwise clearly and specifically defined.
[0138] The above contents are further detailed descriptions of the present invention in combination with specific preferred embodiments, and it cannot be determined that the specific implementation of the present invention is limited to these descriptions. For ordinary technicians in the technical field to which the present invention belongs, several simple deductions or substitutions can be made without departing from the concept of the present invention, which should be regarded as falling within the protection scope of the present invention.
Claims
1. A backup method for Linux operating system based on Docker. It is characterized in that Applied to a user device, where a docker client is deployed; The Docker-based Linux operating system backup method includes: In response to a backup instruction input by a user, acquiring attribute information of a backup server; According to the attribute information, configure the Docker client on the user device so that the user device can use the https protocol and the self-signed certificate to perform data transmission with the image repository on the backup server; Filter out target subdirectories that meet preset conditions from the subdirectories of the root directory of the local Linux operating system; Copying the target subdirectory to a preset backup directory; Get the current time and generate a tag based on the current time; Based on the tag label, generate a target Docker image according to the data in the backup directory; Upload the target docker image to the image repository on the backup server to complete the Linux operating system backup.
2. The backup method of the Linux operating system based on Docker according to claim 1, It is characterized in that The step of selecting a target subdirectory that meets a preset condition from a subdirectory of a root directory of a local Linux operating system includes: Determine in sequence in a preset order whether the name of each subdirectory of the root directory of the local Linux operating system is any one of dev, sys, proc, run, tmp, media, mnt, cdrom, lost+found, recovery, and data. If so, skip it; if not, determine the current subdirectory as the target subdirectory until all subdirectories of the root directory of the local Linux operating system are traversed.
3. The backup method of the Linux operating system based on Docker according to claim 1 or 2, It is characterized in that Before copying the target subdirectory to a preset backup directory, the method further includes: Determine whether the backup directory exists, and if not, create the backup directory.
4. The backup method of the Linux operating system based on Docker according to claim 1 or 2, It is characterized in that The attribute information includes at least one of an image repository service port, a self-signed certificate, and a private key file.
5. A method for recovering a Linux operating system based on Docker. It is characterized in that Applied to a backup server, where an image repository is deployed; The Docker-based Linux operating system recovery method includes: In response to a recovery instruction input by a user, obtaining a recovery mode and a backup time from the recovery instruction; According to the backup time, a target Docker image is screened out from the image repository on the backup server, wherein the target Docker image is backed up in the image repository by the Docker-based Linux operating system recovery method according to any one of claims 1 to 4; Based on the recovery mode, a recovery operation is performed on the target Docker image.
6. The method for recovering a Linux operating system based on Docker according to claim 5, It is characterized in that The step of selecting a target Docker image from the image repository on the backup server according to the backup time includes: Traverse the tag labels of each Docker image in the image repository on the backup server, and determine the tag label whose corresponding time is not greater than and closest to the backup time as the target tag label; The Docker image corresponding to the target tag label is determined as the target Docker image.
7. The method for recovering a Linux operating system based on Docker according to claim 5 or 6, It is characterized in that When the recovery mode is a container mode, performing a recovery operation on the target Docker image based on the recovery mode includes: According to the target Docker image, start a temporary container, and configure the static IP address and remote login account information of the temporary container; The static IP address of the temporary container and the remote login account information are sent to the user device, so that the user can access the temporary container according to the static IP address and the remote login account information to obtain the backed-up Linux operating system.
8. The method for recovering a Linux operating system based on Docker according to claim 5 or 6, It is characterized in that When the recovery mode is iso mode, performing a recovery operation on the target docker image based on the recovery mode includes: Pull the target Docker image to the local computer and save it as a .tar archive file; Decompress the data of each layer corresponding to the archive file into the same temporary directory to obtain the decompression result; Creating a compressed file system of a Linux operating system according to the decompression result; Mount the first iso file to the temporary mount point / mnt directory of the backup server; Create the iso target directory; Copy all files except filesystem.squashfs in the temporary mount point / mnt directory to the iso target directory; Copy the compressed file system of the Linux operating system to the iso target directory; Generate a second iso file according to the iso target directory; Send a prompt message to the user equipment, prompting the user to download the second iso file.
9. The method for recovering a Linux operating system based on Docker according to claim 5 or 6, It is characterized in that The step of obtaining the recovery mode and the backup time from the recovery instruction in response to the recovery instruction input by the user includes: In response to the recovery instruction input by the user, it is queried whether the docker image backed up by the user exists in the image repository on the backup server. If so, the recovery mode and backup time are obtained from the recovery instruction.
10. An electronic device, It is characterized in that It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor, for implementing the backup method of a Linux operating system based on Docker as described in any one of claims 1 to 4, or implementing the recovery method of a Linux operating system based on Docker as described in any one of claims 5 to 9, when executing a program stored in a memory.
