Docker Config Reference (docker load)
We go over many examples of using the docker load command
Difference Between docker run and docker load
The docker run command is designed to create and initiate a container from a specified Docker image, effectively bridging the transition from a static image to a dynamic runtime instance. It handles the full lifecycle of container deployment, including optional image pulling from a registry if the image is not locally available, configuration of runtime parameters such as environment variables, port mappings, volume mounts, and resource constraints, and execution of the image's default command or a user-specified override. This command supports both interactive and detached modes, making it suitable for tasks ranging from one-off computations to long-running services. Its primary focus is on operational execution, ensuring the container performs its intended function within an isolated environment while integrating with host resources as configured.
In contrast, the docker load command is solely responsible for importing Docker images from a tar archive file—typically generated by docker save—into the local Docker image store. It does not involve container creation, execution, or any runtime configuration; instead, it restores images that may have been exported for offline distribution, backup, or transfer in environments without registry access. This makes docker load a preparatory tool for populating the local repository, particularly in air-gapped networks or when handling large images manually. Unlike docker run, which actively deploys and runs containers, docker load emphasizes image ingestion and availability, preparing artifacts for subsequent use without initiating any processes.
Examples of the docker load Command
Example 1
docker load -i image.tar
This command loads an image from the tar file "image.tar" using the input flag (-i), which is standard for importing single or multi-image archives in basic offline transfer scenarios.
Example 2
docker load --input backup.tar
This command imports images from "backup.tar" with the --input flag, facilitating restoration from backups in recovery operations after system failures.
Example 3
docker load -q < compressed.tar
This command quietly (-q) loads images from "compressed.tar" via stdin redirection, suppressing output for silent integration in automated scripts.
Example 4
cat multiimage.tar | docker load
This command pipes the contents of "multiimage.tar" to load multiple images, enabling chained operations in pipelines without explicit input flags.
Example 5
docker load --input /path/to/remote.tar
This command loads from a specified path "/path/to/remote.tar", useful for importing from mounted network storage in distributed environments.
Example 6
docker load -i baseimage.tar
This command imports a base image from "baseimage.tar", preparing foundational layers for custom builds in air-gapped networks.
Example 7
docker load --quiet < devimage.tar
This command quietly loads from "devimage.tar" via redirection, minimizing console noise in development CI/CD pipelines.
Example 8
zcat gzipped.tar.gz | docker load
This command decompresses and loads from "gzipped.tar.gz", handling compressed archives for bandwidth-efficient transfers.
Example 9
docker load -i prodapp.tar
This command loads a production application image from "prodapp.tar", ensuring availability in secure, registry-isolated production hosts.
Example 10
docker load --input testenv.tar
This command imports a test environment image from "testenv.tar", supporting isolated testing setups without internet access.
Example 11
xzcat compressed.xz | docker load -q
This command decompresses XZ archives and quietly loads images, optimizing for highly compressed files in storage-constrained scenarios.
Example 12
docker load < legacyimage.tar
This command loads a legacy image from "legacyimage.tar" via stdin, facilitating migrations from older Docker versions.
Example 13
docker load -i multiplatform.tar
This command imports a multi-platform image manifest from "multiplatform.tar", enabling cross-architecture support in heterogeneous clusters.
Example 14
bzip2 -dc bzipped.tar.bz2 | docker load
This command decompresses BZip2 archives and loads images, handling alternative compression formats for compatibility.
Example 15
docker load --input /mnt/usb/export.tar
This command loads from a USB-mounted "export.tar", useful in offline or field deployment situations without network connectivity.
Example 16
docker load -q -i secureimage.tar
This command quietly loads a secure image from "secureimage.tar", minimizing logs in high-security environments.
Example 17
gunzip -c gzip.tar.gz | docker load
This command decompresses GZip and loads images, standard for handling common compressed exports.
Example 18
docker load < mlmodel.tar
This command loads a machine learning model image from "mlmodel.tar" via redirection, preparing for inference in isolated compute nodes.
Example 19
docker load -i dbimage.tar
This command imports a database image from "dbimage.tar", ensuring data services availability in disconnected databases.
Example 20
7z x archive.7z -so | docker load
This command extracts and loads from a 7z archive, accommodating diverse compression tools in varied workflows.
Example 21
docker load --input /shared/nfs/app.tar
This command loads from an NFS-mounted "app.tar", supporting shared storage in clustered or virtualized infrastructures.
Example 22
docker load -q < ciartifact.tar
This command quietly loads from a CI artifact "ciartifact.tar", integrating with build pipelines for artifact deployment.
Example 23
tar -xOf layered.tar | docker load
This command extracts and loads from a layered tar, handling nested archives in complex export formats.
Example 24
docker load < edgeimage.tar
This command loads an edge computing image from "edgeimage.tar", for IoT or remote device setups without registries.
Example 25
docker load -i complianceimage.tar
This command imports a compliance-tested image from "complianceimage.tar", ensuring regulatory adherence in secure sectors.
Example 26
lzip -dc lzipped.tar.lz | docker load
This command decompresses LZip and loads images, for less common compression handling.
Example 27
docker load --input /backup/daily.tar
This command loads from a daily backup "daily.tar", supporting routine restoration in backup strategies.
Example 28
docker load < custombase.tar
This command loads a custom base image from "custombase.tar", for proprietary or modified base layers.
Example 29
rar x rararchive.rar -so | docker load
This command extracts from RAR and loads images, accommodating proprietary compression formats.
Example 30
docker load -i hybridimage.tar
This command imports a hybrid multi-tool image from "hybridimage.tar", for versatile utility in mixed environments.