Difference between save and export in Docker – Thomas Uhrig
How Docker works (in a nutshell)
How Docker works (in a nutshell)
Docker is based on so called images. These images are comparable to virtual machine images and contain files, configurations and installed programs. And just like virtual machine images you can start instances of them. A running instance of an image is called container. You can make changes to a container (e.g. delete a file), but these changes will not affect the image. However, you can create a new image from a running container (and all it changes) using
docker commit <container-id> <image-name>
.
Export
Export is used to persist a container (not an image). So we need the container id which we can see like this:
To export a container we simply do:
The result is a TAR-file which should be around 2.7 MB big (slightly smaller than the one from
save
).
Save
Save is used to persist an image (not a container). So we need the image name which we can see like this:
To save an image we simply do:
The result is a TAR-file which should be around 2.8 MB big (slightly bigger than the one from
So what’s the difference between both? Well, as we saw the exported version is slightly smaller. That is because it is flattened, which means it lost its history and meta-data. We can see this by the following command:export
).
If we run the command we will see an output like the following. As you can see there, the exported-imported image has lost all of its history whereas the saved-loaded image still have its history and layers. This means that you cannot do any rollback to a previous layer if you export-import it while you can still do this if you save-load the whole (complete) image (you can go back to a previous layer by using
Read full article from Difference between save and export in Docker – Thomas Uhrigdocker tag <LAYER ID> <IMAGE NAME>
).
No comments:
Post a Comment