docker-save
Save Docker images to a tar archive
TLDR
Save an image by redirecting stdout to a tar archive
Save an image to a tar archive
Save all tags of the image
Cherry-pick particular tags of an image to save
SYNOPSIS
docker save [OPTIONS] IMAGE [IMAGE...]
PARAMETERS
--output, -o string
Write to a file, instead of STDOUT. (default "")
DESCRIPTION
The docker save command creates a tar archive containing one or more Docker images. This archive can then be transported and loaded on another Docker host using the docker load command. This is useful for backing up images, transferring images to environments without internet access, or sharing images with others. The saved archive preserves all layers and metadata of the specified image(s). It's important to note that docker save saves image layers in the order they appear in the image's history, ensuring integrity during loading. When saving multiple images, all layers they share will only be saved once, which helps in creating space-efficient archives. The output can be redirected to a file or piped to another command for further processing like compression (e.g., using gzip). If you use --output, the file name where the tarball is stored will be saved.
The use case is very important when you want to transport docker images from one environment to another.
EXAMPLES
To save a single image to a file named 'my_image.tar':
`docker save my_image > my_image.tar`
To save multiple images to a file named 'all_images.tar':
`docker save image1 image2 image3 > all_images.tar`
To save an image and pipe it to gzip for compression:
`docker save my_image | gzip > my_image.tar.gz`
To save an image into a file using the `--output` option:
`docker save -o my_image.tar my_image`
SEE ALSO
docker load(1)