Difference docker save load export import of

export

export command for persisting container (not mirror images). So, we need to get the container ID in the following ways: 
sudo docker ps -a 
then perform the export: 
sudo docker export <CONTAINER ID> > /home/export.tar

save

Save command persistent image (not a container). So, we need to get image name in the following ways: 
sudo docker images 
then execute the save: 
sudo docker save busybox-1 > /home/save.tar

Use export smaller than the file using Save to save some

load, save respectively, importing, exporting mirror Image , Import, Export are import, export container Container .

Use of both is the same, introducing compressed image generated 
docker import - busybox-1-export:latest 
name mirror docker import can reassign 
docker load < /home/save.tar

the difference

That, in the end there is any difference between them?

  1. First, docker import can reassign the name of the mirror, docker load can not
  2. Secondly, we found that the export version will be slightly smaller than the original version number. That is because after export, lose history and metadata. Run the following commands will know: 
    all layers of the image (Layer) 
    sudo docker images --tree 
    Run, displays the following contents. Positive you can see, export and import (exported-imported) mirrored lose all of history, and saved, and then loaded (saveed-loaded) is no loss of history and mirroring layer (layer). This means that the previous way of using export and import, you will not be able to roll back layer (layer), while using the save and then load the entire way persistent image, you can do layer rollback (you can perform docker tag layer prior to roll back).

    vagrant@Ubuntu-13:~$ sudo docker images --tree
    ├─f502877df6a1 Virtual Size: 2.489 MB Tags: busybox-1-export:latest
    └─511136ea3c5a Virtual Size: 0 B └─bf747efa0e2f Virtual Size: 0 B └─48e5f45168b9 Virtual Size: 2.489 MB └─769b9341d937 Virtual Size: 2.489 MB └─227516d93162 Virtual Size: 2.489 MB Tags: busybox-1:latest

Guess you like

Origin www.cnblogs.com/sunsky303/p/11024672.html