docker-image-save

save images to tar archives

TLDR

Save image to tar archive
$ docker image save -o [image.tar] [image]
Save to stdout
$ docker image save [image] > [image.tar]
Save multiple images
$ docker image save -o [images.tar] [image1] [image2]
Save with compression
$ docker image save [image] | gzip > [image.tar.gz]

SYNOPSIS

docker image save [options] image [image...]

DESCRIPTION

docker image save saves one or more Docker images to a tar archive, packaging all image layers, configuration, and metadata into a single file. This command is designed for transferring images between systems without using a registry, backing up important images, or distributing images via offline media.The resulting tar archive contains the complete image structure, including all filesystem layers, image manifests, and configuration JSON. Multiple images can be saved to a single archive, which is useful for bundling related images together.Output can be directed to a file with -o or to stdout, allowing for flexible integration with compression tools like gzip or transmission over network connections. Use docker image load to restore images from these archives.

PARAMETERS

-o, --output file

Write to file instead of stdout.

INSTALL

sudo apt install docker-cli
sudo dnf install docker-cli
sudo pacman -S docker
sudo apk add docker-cli
sudo zypper install docker
brew install docker
nix profile install nixpkgs#docker

CAVEATS

The archive contains the image's filesystem layers as raw tar files; it is not identical to a docker export archive (which dumps a running container's filesystem flat without history). Saving by image ID rather than name preserves no repository tags in the archive; pass a name:tag to retain them. Archives produced by newer Docker engines use the OCI manifest format and may not load cleanly into very old engines.

HISTORY

docker save was part of the original Docker CLI from 2013. The subcommand was reorganized under the docker image namespace in Docker 1.13 (January 2017) while keeping the legacy short form as an alias.

SEE ALSO

docker-save(1), docker-image-load(1), docker-load(1)