Docker - Save and Load Images

 

Docker - Save and Load Images

 

docker save

Description

Save one or more images to a tar archive (streamed to STDOUT by default)

Example

docker container run -it --name webserver -p 80:80 -d nginx

docker save webserver > mywebserver.tar

A file mywebserver.tar should be created which can be shared with others so that they can also load it in their repoistory.

docker load

Description

Load an image from a tar archive or STDIN

Example

docker load < mywebserver.tar


Docker Export and Import

docker export command is used to create a tar file from running/stopped container

docker import command to load the tar file into a docker image

docker export c2 -o img.tar

docker import img.tar test/img1

Comments