Skip to content
Latchkey

Docker "load: open ...: no such file" / "invalid tar header" on docker load

A docker load could not read the image archive produced by docker save. The tar stream is truncated, was passed incorrectly, or was corrupted in transit between jobs - so load cannot reconstruct the image.

What this error means

A docker load fails with invalid tar header, unexpected EOF, or open <file>: no such file or directory. The save side appeared to work, but the archive that reached the load step is missing or malformed.

docker load output
open /var/lib/.../layer.tar: no such file or directory
# or a corrupt/truncated archive:
ERROR: invalid tar header
# or piping that lost the stream:
docker load < image.tar  ->  unexpected EOF

Common causes

The archive was truncated or partially uploaded

An artifact upload/download that was cut short, or a docker save interrupted by disk-full, leaves an incomplete tar that load cannot parse.

Wrong input redirection or piping

docker load reads from stdin or -i. A missing </-i, or piping through a command that altered the bytes (text-mode transfer, recompression), corrupts the stream.

Compression mismatch

Saving with docker save | gzip but loading the raw .gz without decompressing (or vice versa) yields an invalid tar header.

How to fix it

Save and load with explicit files and matching compression

Write to a file with -o, transfer it as a binary artifact, and load with -i.

Terminal
docker save -o image.tar myorg/api:1.4.2
# transfer image.tar as a binary artifact, then:
docker load -i image.tar

Verify the archive integrity between jobs

Check the file is non-empty and a valid tar before loading.

Terminal
ls -l image.tar && tar -tf image.tar >/dev/null && echo "archive ok"

How to prevent it

  • Use -o/-i with a file rather than fragile stdin pipes across steps.
  • Transfer image tarballs as binary artifacts, not text.
  • Prefer a registry round-trip over save/load for large images in CI.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →