LinuxCommandLibrary

docker-image-save

TLDR

Save an image by redirecting stdout to a .tar archive

$ docker [[save|image save]] [image]:[tag] > [path/to/file.tar]
copy

Save an image to a .tar archive
$ docker [[save|image save]] [[-o|--output]] [path/to/file.tar] [image]:[tag]
copy

Save all tags of the image
$ docker [[save|image save]] [[-o|--output]] [path/to/file.tar] [image_name]
copy

Cherry-pick particular tags of an image to save
$ docker [[save|image save]] [[-o|--output]] [path/to/file.tar] [image_name:tag1 image_name:tag2 ...]
copy

SYNOPSIS

docker image save [-o file] [-q] IMAGE [IMAGE...]

PARAMETERS

-o, --output string
    Write to a file instead of STDOUT

-q, --quiet
    Suppress the progress output

DESCRIPTION

The docker image save command exports one or more Docker images to a tar archive file. By default, it streams the output to STDOUT as a tar stream containing image layers, configurations, and manifests. This is useful for backing up images, transferring them between systems without a registry, or archiving for offline use.

It saves the complete image including all layers, but does not include container filesystems or runtime state—only the image itself. Multiple images can be specified, creating a single tar with all their contents. Use cases include creating portable image bundles for air-gapped environments, CI/CD pipelines needing image artifacts, or manual backups.

The command requires images to be present locally (pulled or built). Output can be redirected or written to a file via -o. Progress bars show layer export unless suppressed with -q. Loaded back with docker image load.

Large images with many layers may produce sizable tars; compression (e.g., via gzip) is manual post-export.

CAVEATS

Images must exist locally; cannot save remote-only images without pulling first. Exports layers fully, creating large files for multi-platform or deep-layered images. No built-in compression or deduplication.

EXAMPLES

docker image save -o nginx.tar nginx
Saves nginx image to file.

docker image save alpine nginx > images.tar
Streams two images to tar on STDOUT.

OUTPUT FORMAT

Tar contains manifest.json, layer tarballs (e.g., abc123/layer.tar), config JSON, and repositories file for multi-image archives.

HISTORY

Originally docker save in Docker 1.0 (2014); refactored to subcommand docker image save in Docker 1.12 (2016) during CLI reorganization for consistency.

SEE ALSO

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

Copied to clipboard