Export Docker images as .tar files for backups, offline transfers, or air-gapped deployments.

What you'll need

  • Docker installed on your system (Docker Desktop for Windows/macOS, Docker Engine on Linux)
  • An image available locally (use docker images to list images)

Step 1 — Identify the image

List local images and note the REPOSITORY:TAG you want to export:

docker images

Example output:

REPOSITORY     TAG       IMAGE ID       CREATED         SIZE
ubuntu         22.04     2b4f4a6a4a82   2 weeks ago     77MB

Step 2 — Save the Docker image as a .tar

Use docker save and the -o flag to write a tar file:

docker save -o ubuntu_22.04.tar ubuntu:22.04

Notes:

  • The -o flag specifies the output file. You can also use redirection: docker save ubuntu:22.04 > ubuntu_22.04.tar
  • You can save multiple images into one tar: docker save -o my_images.tar image1:tag image2:tag

Step 3 — Verify the .tar file

Check your current directory for the generated tar file:

Windows (PowerShell):

Get-ChildItem

macOS / Linux:

ls -lh

Step 4 — Load the TAR file on another system

Import the saved image with docker load:

docker load -i ubuntu_22.04.tar

Expected output:

Loaded image: ubuntu:22.04

Optional — Compress the TAR to save space

Compress the tar to gzip:

tar -czvf ubuntu_22.04.tar.gz ubuntu_22.04.tar

Load directly from gzipped stream without creating intermediate tar on the target:

gunzip -c ubuntu_22.04.tar.gz | docker load

Quick commands reference

ActionCommand
Save image to tardocker save -o image.tar image:tag
Load image from tardocker load -i image.tar
Compress tartar -czvf image.tar.gz image.tar
Load from gzip streamgunzip -c image.tar.gz | docker load

Troubleshooting tips

  • If you get permission errors when saving or loading, try running the command in an elevated shell (Administrator / root) or ensure Docker is running.
  • Large images may take time — compressing helps for transfers but requires extra CPU/time to compress/decompress.
  • For private registry images, ensure you docker login first if you intend to push the same image later to a registry.

Exporting images with docker save is ideal for offline transfers, backups, or moving images into air-gapped environments. If you want, you can also automate saving and compressing in a script — tell me which OS you use, and I can generate it for you.