LinuxCommandLibrary

docker-load

Load Docker images from a tar archive

TLDR

Load a Docker image from stdin

$ docker load < [path/to/image_file.tar]
copy

Load a Docker image from a specific file
$ docker load [[-i|--input]] [path/to/image_file.tar]
copy

Load a Docker image from a specific file in quiet mode
$ docker load [[-q|--quiet]] [[-i|--input]] [path/to/image_file.tar]
copy

SYNOPSIS

docker load [OPTIONS]

PARAMETERS

--help
    Show help for the command

-i, --input
    Read from tar archive file, instead of STDIN

-q, --quiet
    Suppress the load output, only show image IDs

DESCRIPTION

The docker load command is used to load images and their associated metadata (like layers and tags) from a tar archive into the Docker image store. This archive is typically created using the docker save command. It's a crucial tool for transferring Docker images between environments, especially in offline or air-gapped scenarios, as it encapsulates the entire image filesystem and configuration into a single portable file.

Unlike docker import, which creates a new image from a tarball of a filesystem (without history or layers), docker load preserves the full image history, layers, and multiple tags. This ensures that the loaded image is identical to the one that was saved, making it suitable for disaster recovery, versioning, and distribution without relying on a remote registry.

CAVEATS

The input must be a tar archive containing Docker images, typically created by docker save.

If an image with the same name and tag already exists in the local Docker image store, docker load will overwrite it. Be cautious when loading images that might conflict with existing ones.

docker load does not verify the integrity or security of the loaded images; it simply imports them as provided.

It loads images into the local Docker daemon's image store; it does not automatically run or push these images to a registry.

INPUT SOURCE

By default, docker load expects the tar archive to be piped to its standard input (e.g., cat image.tar | docker load). Alternatively, the --input or -i option can specify a file path (e.g., docker load -i image.tar).

IMAGE IDENTITY

docker load preserves the image's full identity, including its layers, history, and all associated tags. This is in contrast to docker import, which creates a new image from a container's filesystem without its layered history.

USE CASES

Ideal for distributing Docker images to environments without internet access or direct access to a Docker registry (air-gapped systems), backing up Docker images, or migrating images between Docker daemons on different hosts without relying on a registry.

HISTORY

The docker load command has been a fundamental part of the Docker CLI since its early versions. It was introduced alongside docker save to provide a mechanism for offline image management, distribution, and backup, complementing the registry-based docker pull and docker push commands. Its core functionality has remained consistent, serving as a reliable method for transporting complete Docker images with their full layer history.

SEE ALSO

docker save(1), docker import(1), docker export(1), docker images(1), docker push(1), docker pull(1)

Copied to clipboard