# docker save: Export Images to a Tar Archive

> How docker save works: serializing one or more images to a tar archive with layers and metadata, for caching or air-gapped transfer in CI.

Source: https://latchkey.dev/learn/command-reference/docker-save-command  
Updated: 2026-06-25

Serialize images (with history and tags) to a portable tar file.

docker save writes one or more images, including all layers and metadata, to a tar archive. It pairs with docker load. This page covers the flags and how it differs from docker export.

## What it does

docker save serializes images - not containers - preserving layers, tags, and history. The output can be loaded on another host with docker load. Contrast with docker export, which flattens a container filesystem.

## Common usage

```Terminal
docker save -o myapp.tar myapp:1.2.3
docker save myapp:1.2.3 | gzip > myapp.tar.gz
docker save -o images.tar nginx:1.27 redis:7
```

## Common errors in CI

Caching the daemon image store with docker save/load was a common CI pattern but is large and slow; prefer registry-based or BuildKit cache (--cache-to) for layer reuse. "no space left on device" can occur writing a big tar - write to a path with room and gzip the stream. Saving by image ID loses tags; save by name:tag to keep them.

## FAQ

### docker save: Export Images to a Tar Archive?

docker save writes one or more images, including all layers and metadata, to a tar archive. It pairs with docker load. This page covers the flags and how it differs from docker export.

### What it does?

docker save serializes images - not containers - preserving layers, tags, and history. The output can be loaded on another host with docker load. Contrast with docker export, which flattens a container filesystem.

### Common errors in CI?

Caching the daemon image store with docker save/load was a common CI pattern but is large and slow; prefer registry-based or BuildKit cache (--cache-to) for layer reuse. "no space left on device" can occur writing a big tar - write to a path with room and gzip the stream. Saving by image ID loses tags; save by name:tag to keep them.

---

Latchkey runs CI/CD that repairs its own failures. Agent entry points: https://latchkey.dev/agent.txt, https://latchkey.dev/openapi.json, https://latchkey.dev/llms.txt
