Docker Offline Deployment: 7-Step Save/Load Pipeline for Air-Gapped Servers
This guide details a seven-step pipeline for transferring Docker images to air-gapped servers using docker save and docker load, covering image inventory, fixed tagging, export, rsync transfer with SHA256 verification, import, and validation of names, tags, and architecture to prevent common offline deployment failures.
Reading font

1. Define the Image Inventory: Which Images Must Move
Before starting, list every image: name, tag, purpose, and whether it is used at build time or runtime. Missing one means a stuck Pulling on the target machine.
A typical multi-service project needs these base images:
eclipse-temurin:17-jre-jammy — Backend Java runtime; used at build time when building backend image
nginx:1.30.6-alpine — Static hosting + reverse proxy; used at container startup
mysql:8.0 — Database; used at container startup
redis:7.2 — Cache; used at container startup
minio/minio:RELEASE.2025-04-22T22-12-26Z — Object storage; used at container startup
Distinguishing build-time (e.g., JDK base image, read only during docker compose build) from runtime (e.g., myapp-backend:latest) is critical — both sets must be present.
Three Volume Numbers, Don't Confuse Them
The same image shows three different sizes:
93.8 MB — Compressed layer total; actual download size from registry
371 MB — On-disk footprint (what docker images shows as SIZE)
89.5 MB — docker save exported tar size
Modern Docker uses containerd storage / OCI format; layers stay compressed locally, so the tar is smaller than the on-disk size. Conclusion: do not gzip the tar — extra compression yields negligible gain and wastes time. Estimate transfer by tar size (~560 MB for five base images) and target disk by on-disk size (~2 GB after load).
Floating Tags Are the Biggest Trap
Almost every project trips here: compose specifies redis:7-alpine but the offline bundle contains redis:7.2. Names don't match, so docker compose up -d thinks the image is missing and attempts a network pull, which times out.
Examples of mismatches:
Redis: compose has redis:7-alpine, offline bundle has redis:7.2 → attempts network pull, fails
MinIO: compose has minio/minio:latest, offline bundle has minio/minio:RELEASE.2025-04-22T22-12-26Z → attempts network pull, fails
Two fixes, pick one:
# Option 1 (recommended): change compose image to the exact fixed tag in the bundle
# Option 2: after import, add an alias tag
docker tag redis:7.2 redis:7-alpineOption 1 is recommended — fixed tags make every save/load predictable and avoid drift like "offline bundle is 7.2 but production runs 7.4". Note: redis:7-alpine (Alpine-based, smaller) and redis:7.2 (Debian-based) are not the same image; renaming doesn't make them equivalent.
2. Pull: On an Internet-Connected Machine
docker pull eclipse-temurin:17-jre-jammy
docker pull nginx:1.30.6-alpine
docker pull mysql:8.0
docker pull redis:7.2Verify each image works immediately after pull:
docker run --rm eclipse-temurin:17-jre-jammy java -version
docker run --rm nginx:1.30.6-alpine nginx -vPull happens on the machine where you run the command . If you develop on Windows but deploy to Linux, pull on Linux (or pull then transfer).
If pulls fail, configure a registry mirror in /etc/docker/daemon.json under registry-mirrors. Mirrors may work today but not tomorrow; offline bundles are the only reliable solution for air-gapped networks.
3. Export: docker save
On the machine that already has the images:
docker save eclipse-temurin:17-jre-jammy -o /opt/images/temurin17.tar
docker save nginx:1.30.6-alpine -o /opt/images/nginx-alpine.tar
docker save mysql:8.0 -o /opt/images/mysql8.tarKey points:
Always use absolute paths with -o; relative paths land in the current directory and get lost.
Run df -h before export — insufficient space creates a truncated, corrupt tar.
Do not gzip, do not unpack — feed the tar directly to docker load -i.
Combine into One Bundle
Multiple images can go into a single tar to reduce transfer count:
docker save -o /opt/images/base.tar \
eclipse-temurin:17-jre-jammy \
nginx:1.30.6-alpine \
mysql:8.0 \
redis:7.2One tar holds any number of images; load imports all at once. Downside: updating one image requires re-transferring the whole bundle. Best practice: split into "base images bundle" + "business images bundle" for flexibility.
Never Confuse save with export
Comparison:
docker save — operates on Image (all layers, tags, history); docker load restores original names and tags
docker export — operates on Container (filesystem snapshot); docker import yields a tagless image showing <none> Offline deployment only uses save / load . Using export flattens the image to a single layer, discards tags, and forces manual docker tag — unnecessary work.
4. Transfer & Verification
Direct push when machines can reach each other: scp -r /opt/images root@targetIP:/opt/ For large files or unstable links, prefer rsync with resume support:
rsync -avP --partial /opt/images/ root@targetIP:/opt/images/Re-run the same command after interruption to resume.
If old and new servers cannot reach each other but both reach your local machine, use local hop (old → local → new). Critical: must use binary transfer mode . FTP ASCII mode or opening the tar in a text editor corrupts the file; docker load then fails with invalid tar header. WinSCP defaults to binary; scp is inherently safe.
SHA256 Is Mandatory
Large transfers can truncate silently. Verify both ends:
# Source machine
cd /opt/images && sha256sum *.tar > SHA256SUMS.txt
# Target machine
cd /opt/images && sha256sum -c SHA256SUMS.txtAll OK → proceed. Any FAILED → re-transfer that file. Thirty seconds here saves an hour of debugging "image loaded but won't run".
5. Import & Validation
# One by one
docker load -i /opt/images/temurin17.tar
# Or batch entire directory
cd /opt/images && for f in *.tar; do docker load -i "$f"; doneSeeing Loaded image: nginx:1.30.6-alpine means success; order doesn't matter.
Three Mandatory Checks
# 1. Names and tags match
docker images | grep -E "temurin|nginx|mysql|redis"
# 2. Architecture matches
docker image inspect nginx:1.30.6-alpine --format '{{.Os}}/{{.Architecture}}'
# Expected: linux/amd64
# 3. Image ID matches source (optional)
docker image inspect nginx:1.30.6-alpine --format '{{.Id}}'Architecture mismatch is the most common migration failure: an image saved on ARM (e.g., M-series Mac) loaded on x86_64 yields exec format error.
Verify Image Integrity Without Network
Before starting services, run version commands on each image:
docker run --rm eclipse-temurin:17-jre-jammy java -version
docker run --rm nginx:1.30.6-alpine nginx -v
docker run --rm mysql:8.0 mysql --versionAll output version numbers → images are complete and fully offline. This catches 90% of transfer issues early.
Confirm No Hidden Network Pulls at Startup
docker compose up -d 2>&1 | tee /tmp/up.log
grep -iE "pull|error" /tmp/up.logNo Pulling lines and containers start cleanly → truly self-contained. Any Pulling → go back to step 1 and reconcile tags.
6. Extra Care When Migrating Servers
"First offline deploy" and "server migration" share the same pipeline; only two differences:
Whether to move business images. Moving them (e.g., myapp-backend:latest) avoids rebuild on the new machine — the image already contains the JAR and static assets. Not moving means copying JAR and dist directories and rebuilding, provided the new machine already has JDK and Nginx base images. Usually moving is simpler.
Keep data and images separate. MySQL via mysqldump, MinIO via mc mirror, upload directories via tar — that's a separate track. Loading data before images are ready only blurs whether failures are config or data issues.
For migration, export as "base bundle + business bundle":
docker save -o images-base.tar nginx:1.30.6-alpine mysql:8.0 eclipse-temurin:17-jre-jammy
docker save -o images-backend.tar myapp-backend:latest
sha256sum *.tar > SHA256SUMS.txtReserve at least 2 GB disk space on target.
Seven Most Common Pitfalls
Offline up still shows Pulling : tag mismatch — fix compose or docker tag alias.
invalid tar header : incomplete transfer or text-mode corruption — verify SHA256 and re-transfer.
Imported image shows <none> : used docker import instead of docker load.
exec format error : architecture mismatch — re-export on x86_64.
no space left on device : disk full — run df -h before export.
Container time stays UTC : Alpine lacks tzdata — add -e TZ=Asia/Shanghai.
Image accidentally deleted : docker image prune -a — restore from backup tar with load.
Summary
Inventory first: build-time and runtime base images — none missing.
Fix tags: floating tags are the #1 offline deployment killer.
Only save / load : export loses tags, import becomes <none>.
Skip gzip: layers are already compressed.
Verify transfer: sha256sum both ends.
Validate after load: name, tag, architecture, version — all four before starting business.
Once the pipeline runs smoothly, air-gapped deployment and server migration become the same operation. The real difficulty isn't typing commands — it's a missing tag in the inventory or a half-transferred file nobody noticed.
Next article covers the final piece: why carefully migrated containers all die after a server reboot.
About this article
For attribution, corrections or content rights, contact