Aliasger Jaffer
Aliasger Jaffer's Blog

Follow

Aliasger Jaffer's Blog

Follow
Saving docker images to a file

Photo by Pau Casals on Unsplash

Saving docker images to a file

Aliasger Jaffer's photo
Aliasger Jaffer
·Dec 23, 2021·

1 min read

It is quite common to get docker images from the registry. However, what if you need to persist your docker images and load them later from disk?

Here are two commands that can help you with it:

docker save -o back.tar.gz myApp:v12 myApp:latest dbApp:v4

This will save all the three images into the back.tar.gz file. Perform a 'dir' or an 'ls' command and you should see the back.tar.gz file created.

To get the images back from the compressed file into your images in docker, use the following command (run it from the location of the back.tar.gz file):

docker load -i back.tar.gz

Run docker images command to see the changes.