
Learn how to build a Docker image from scratch on Ubuntu 24.04 with step-by-step instructions and optimization tips for security, performance, and minimalism. Table of
Learn how to save and load Docker and Podman containers and images, with clear CLI examples, comparisons, and best practices for offline, backup, and migration workflows.
Containerized workflows are everywhere—from local development to CI pipelines and air-gapped production environments. While registries like Docker Hub or Quay.io are the most common way to move container images around, there are many situations where you need to save containers or images to disk and load them later. Examples include offline transfers, backups, audits, or sharing artifacts across restricted networks.
This guide explains how to save and load containers and images using Docker and Podman, when to use each approach, and the common pitfalls to avoid. It’s written to be practical, search-friendly, and easy to follow, with CLI examples and comparison tables along the way.
Before diving into commands, it helps to clarify why you might do this instead of pushing to a registry.
Common scenarios include:
|
|
|
|
|
Depending on the goal, you may want to save:
|
|
Docker and Podman support both approaches, but with different commands and tradeoffs.
Understanding the distinction helps you choose the right command.
| Term | Description |
|---|---|
| Image | A read-only template built from a Dockerfile or OCI layers |
| Container | A running (or stopped) instance of an image with a writable layer |
| Registry | A remote store for images (Docker Hub, Quay, private registries) |
| Archive (tar) | A local file containing image layers or container data |
In most workflows, saving and loading images is preferred because images are portable, versionable, and reproducible.
🔄 Saving a Docker Image to a File |
Use docker save to export one or more images into a tar archive.
docker save -o myapp-image.tar myapp:latest
You can also save multiple images at once:
docker save -o images.tar ubuntu:22.04 nginx:alpine
This creates a portable archive containing all layers and metadata.
To load the image on another system:
docker load -i myapp-image.tar
Once loaded, verify it:
docker images
The image name and tag are preserved unless retagged manually.
Sometimes you want the filesystem state of a container, not the original image.
🔄 Export a Container |
docker export my_container > my_container_fs.tar
This captures the container’s filesystem only—no history, metadata, or environment variables.
🔄 Import a Container as an Image |
cat my_container_fs.tar | docker import - myapp:imported
⚠️ Important limitation |
|
|
|
Use this method only when you explicitly need the container’s modified state.
Podman follows OCI standards and is daemonless, making it popular for rootless and secure environments.
🔄 Save a Podman Image |
podman save -o myapp-image.tar myapp:latest
Podman also supports compression:
podman save myapp:latest | gzip > myapp-image.tar.gz
🔄 Load a Podman Image |
podman load -i myapp-image.tar
Or with decompression:
gunzip -c myapp-image.tar.gz | podman load
Loaded images behave exactly like locally built ones.
Podman mirrors Docker’s behavior closely.
🔄 Export a Container |
podman export my_container > my_container_fs.tar
🔄 Import as an Image |
podman import my_container_fs.tar myapp:imported
As with Docker, this loses metadata and should be used cautiously.
| Task | Docker | Podman |
|---|---|---|
| Save image | docker save | podman save |
| Load image | docker load | podman load |
| Export container | docker export | podman export |
| Import container | docker import | podman import |
| Daemon required | Yes | No |
| Rootless support | Limited | Native |
Both tools produce OCI-compatible images, meaning archives saved with Docker usually load fine in Podman, and vice versa.
⚠️ NOTE: One common misunderstanding is that saving or exporting containers includes volumes. It does not. |
Volumes are stored outside the container filesystem and must be handled separately.
🔄 Backup a Docker Volume |
docker run --rm \
-v my_volume:/data \
-v $(pwd):/backup \
alpine tar czf /backup/my_volume.tar.gz /data
🔄 Restore the Volume |
docker run --rm \
-v my_volume:/data \
-v $(pwd):/backup \
alpine tar xzf /backup/my_volume.tar.gz -C /
The same pattern works with Podman by replacing docker with podman.
Podman’s rootless mode is a major advantage, but it affects save/load workflows:
|
|
|
Example:
podman unshare podman save myapp:latest -o myapp.tar
This ensures consistent ownership when loading on other systems.
If you work with ARM and x86 systems, image architecture matters.
🔄 Inspect Image Architectures |
docker manifest inspect myapp:latest
When saving images, all referenced architectures are included if the image is a manifest list. However, older Docker versions may flatten images, so verify compatibility on the target host.
| Scenario | Recommended Approach |
|---|---|
| CI/CD pipelines | Push to registry |
| Offline transfer | Save / load |
| Backup snapshots | Save images + volumes |
| Auditing builds | Save with checksums |
| Team sharing | Registry (preferred) |
Registries remain the best default, but save/load workflows are invaluable in constrained environments.
For repeatable workflows, scripting helps.
Example backup script:
#!/bin/bash
IMAGE="myapp:latest"
DATE=$(date +%Y%m%d)
docker save "$IMAGE" | gzip > "${IMAGE//:/_}_$DATE.tar.gz"
Restore script:
gunzip -c myapp_latest_20260101.tar.gz | docker load
Podman users can drop in podman with no other changes.
To keep your workflows safe and maintainable:
|
|
|
|
|
Saving and loading images preserves known-good artifacts and helps prevent configuration drift.
🔄 “No such image” after load |
|
|
🔄 Permission errors on load |
|
|
🔄 Missing data after restore |
|
|
Saving and loading containers and images is a powerful technique that complements registry-based workflows. Whether you use Docker or Podman, the core concepts are the same:
|
|
|
|
By understanding these patterns, you can confidently move containerized workloads across systems, networks, and environments—without surprises.
Did you find this article helpful? Your feedback is invaluable to us! Feel free to share this post with those who may benefit, and let us know your thoughts in the comments section below.

Learn how to build a Docker image from scratch on Ubuntu 24.04 with step-by-step instructions and optimization tips for security, performance, and minimalism. Table of

Learn how to configure Minikube with Podman on CentOS Stream 10. This guide walks you through installation, configuration, and testing, enabling you to run Kubernetes

Learn how to install Podman on AlmaLinux 9.5 with a step-by-step guide. Set up Podman containers, use Podman Compose, and manage multi-container applications securely. Table
