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, 2019 in Docker by Sam
• 6,260 points
7,003 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, 2019 by Sirajul
• 59,230 points

edited Jul 2, 2019 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, 2019 in Docker by Sirajul
• 59,230 points
12,298 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, 2019 in Docker by Sirajul
• 59,230 points

edited Jul 6, 2019 by Sirajul 2,369 views
+2 votes
1 answer
+2 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
• 58,020 points
2,738 views
0 votes
2 answers
+1 vote
2 answers
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP