|
|
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, v3839Next:Install the GD extension based on the Docker php:5.6.40-fpm image
|