How does save and export command work in docker and how are they different from one another?

0 votes
I'm a newbie to Docker.I wanted to persist my work and stumbled over the Docker commands save and export and wondered what their difference is. Could you please help me with this?
Jul 2 in Docker by Sam
• 1,520 points
27 views

1 answer to this question.

0 votes

Export :

Export is used to persist a container (not an image). So we need the container id which we can see like this 

sudo docker ps -a

To export a container we simply do: 

sudo docker export <CONTAINER ID> > /home/export.tar


SAVE :

The result is a TAR-file which should be around 2.7 MB big (slightly smaller than the one from save).

Save is used to persist an image (not a container). So we need the image name which we can see like this:

sudo docker images

To save an image we simply do:

sudo docker save (image name)> /home/save.tar

The result is a TAR-file which should be around 2.8 MB big (slightly bigger than the one from export).

Save and Export are both used for sharing tar files. But, Save is used for images and can save multiple images into a tar file with all the layers and history. Export is used for containers without any history or layers.

answered Jul 2 by Sirajul
• 25,220 points

edited Jul 2 by Sirajul

Related Questions In Docker

0 votes
1 answer

How to move Docker containers from one host to another?

Yes you could definitely do it the ...READ MORE

answered Jul 2 in Docker by Sirajul
• 25,220 points
77 views
0 votes
1 answer

How does mixing Swarm and Kubernetes work in the same cluster?

Yes you could use them together. When you ...READ MORE

answered Jul 5 in Docker by Sirajul
• 25,220 points

edited Jul 5 by Sirajul 36 views
0 votes
1 answer

Different file owner inside Docker container and in host machine Ask

Filesystems, at least in Unix- and Linux-like ...READ MORE

answered Jun 25, 2018 in Docker by Damon Salvatore
• 5,510 points
72 views
0 votes
1 answer
0 votes
1 answer

Deploy Docker Containers from Docker Cloud

To solve this problem, I followed advice ...READ MORE

answered Sep 3, 2018 in AWS by Priyaj
• 56,520 points
152 views
0 votes
2 answers