To Export & Import vs. save & load Docker images / Container
In this article, I am going to explain How to export & import ( save and load ) docker images / container. Before you can export ( save ) docker container, you need to commit ( It’s means change the container <name> and container <tag> ). Docker has an export command which enables you to migrate conatiner or images from one docker host system to another.
1. List of all images on your system using this command
( docker images or docker ps -a)
2. Docker commit
Commit your changes and save the docker container to an image called container-centos-os1. Using below command
( docker commit <old container image name> < new image name > )
3. Docker export/save
Save the centos-os11 image to a tar file.
Docker export/save command is used to save a docker container / image to a tar file. This command is helpfull for moving docker image from one registry to another .
Used this command to save container to tar file on your drive / local system workspace.
docker save <container-name> -o < file.tar >
Then delete these container/image ( container-centos-os1) on your local system and again check container removed or not. Used these command
( docker rm -f < container-name>
docker rmi -f <image name>
docker images ).
4. Docker Import/Load
Copy the centos-os11.tar file
Load an image or repository from a tar archive from a file or STDIN. It restores both image and tag ( container-centos-os1 ).
docker load -i centos-os11.tar
Same content should be visible in both the containers ( centos-os1 & youthful_yonath )
Thank you !!