LinuxCommandLibrary

docker-save

Save Docker images to a tar archive

TLDR

View documentation for the original command

$ tldr docker image save
copy

SYNOPSIS

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

PARAMETERS

-o, --output string
    Write to a file with the given name instead of STDOUT

DESCRIPTION

The docker save command exports one or more Docker images into a single tar archive file, which includes the image layers, manifest, and configuration. This is ideal for offline image distribution, backups, or transferring images between air-gapped systems without a registry.

By default, output goes to STDOUT, allowing piping to files or networks. Specify multiple images to bundle them together, enabling efficient sharing of image sets like an application stack.

Key benefits include portability across Docker versions and hosts, as the tar preserves all necessary data for docker load to recreate images exactly. Layers are not deduplicated across images in the archive, so size reflects full content.

Common workflow: Build or pull images, save to tar, transfer via USB/SCP, then load on target. Note it captures images only—no running containers or volumes. For container filesystems, use docker export instead.

Large images (e.g., OS bases) produce sizable tars; compress with gzip for savings, like docker save image.tar.gz | gzip. Widely used in CI/CD for artifact promotion and DevOps pipelines.

CAVEATS

Produces large files for multi-layer images; does not include container runtime data or volumes; saved images must match Docker version compatibility for loading.

EXAMPLES

docker save -o ubuntu.tar ubuntu:20.04
docker save alpine nginx -o stack.tar
docker save $(docker images -q) | gzip > all-images.tar.gz

OUTPUT FORMAT

Tar contains <manifest.json>, <config.json>, layer tars; compatible with <docker load> or third-party tools.

HISTORY

Introduced in Docker 0.7.0 (2014) as core CLI for image portability; evolved with multi-platform support in Docker 17.05+; integral to Moby/Docker engine maintenance.

SEE ALSO

docker load(1), docker export(1), docker push(1), docker images(1)

Copied to clipboard