This article is a mirror article of machine translation, please click here to jump to the original article.

View: 5565|Reply: 1

The difference between Docker's save and export commands

[Copy link]
Posted on 11/27/2021 2:33:20 PM | | | |
Docker is image-based. The image is similar to a virtual machine image that already contains files, configurations, and installed programs. Similarly, you can start multiple image instances just like you would a virtual machine. A running image is called a container. You can modify the container (such as deleting a file), but these changes will not affect the image. However, you can use the docker commit <container-id> <image-name>command to turn a running container into a new image.

Export

The export command is used to persist the container (not the image). Therefore, we need to obtain the container ID through the following methods:

Then perform the export:



Then, another server, docker import, is used to load the exported files.

Official document address:The hyperlink login is visible.

Save

The save command is used to persist the image (not the container). Therefore, we need to get the image name in the following way:

Perform a save:



Then, another server, docker load, is used to load the saved files.

Official document address:The hyperlink login is visible.

Summarize the difference

export exports are for container applications and lose all layers, the exported file structure is as follows:



save export is for the image, and the file structure is layered, as shown in the figure below:



Exported-imported images lose all history, while saved-loaded images do not lose history and layers. This means that you will not be able to roll back to the previous layer by using the export-and-import method, and you can use the save and load method to persist the entire image (you can perform docker tag <LAYER ID> <IMAGE NAME> to roll back the previous layer).

Thinking: The first docker image should be created through the import-export principle, compressing the system files into tar format, and then importing them through the import command.





Previous:LdapErr: DSID-0C09042A, comment: AcceptSecurityContext error, data 52e, v3839
Next:Install the GD extension based on the Docker php:5.6.40-fpm image
 Landlord| Posted on 2/27/2022 4:52:12 PM |
Save the image



Load the image

Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com