Docker Image Save/Load


Docker Image Save


This command is used to save the image to a tar archive. It saves the image as a tar archive to the standard output stream and can be used to save one or more images at a time. 

Save command maintains all the information about the parent layers, tags, versions, and specified repository tags.


Usage:

$ docker save [OPTIONS] IMAGE [IMAGE...]

Options:

 --output , -o   Used to write to a file instead of STDOUT

Example:

$ docker save myimage > myimage.tar

OR

$ docker save --output myimage.tar myimage 

Save command will save all the images available to a single tar file if the tag is not specified.

For e.g.

$ docker save image ubuntu

The above command will save all the available images of Ubuntu in a single tar file.

To save a specific ubuntu image use the below command -

$ docker image save ubuntu:10.04 > ubuntu.tar


Docker Image Load

The load command is used to restore an image from a tar archive. It can read an image from the Standard Input Stream(STDIN) or a file. This command will restore the image along with all its layers and tags.


Usage:

$ docker image load [OPTIONS]

Options: 

--input , -i   To read from a file instead of input stream

--quiet , -q   To Suppress the load output

Example:

$ docker image load < myimage.tar

OR

$ docker image load --input myimage.tar