Container export versus image import
Container export writes a filesystem archive from a container. Image import creates a new filesystem image from archive content. This differs from saving and loading an existing image with its original image metadata and layers.
Worked example
Use this worksheet offline. Names and values are fictional; no live registry, credentials, Docker daemon or external requests are needed. Commands are illustrations, not observed results. Before separately authorized verification, identify the effective Docker endpoint, client credential configuration, builder and registry destination as applicable. Never disclose credential files or private context details.
Offline comparison (not executed)docker container export -o bm-rootfs.tar bm-labdocker image import bm-rootfs.tar bm-imported:1Original image: CMD defined, 3 layersContainer: changed /app/note.txt; volume mounted at /dataThe export includes the container filesystem view with writable-layer changes, excluding mounted volume contents. If a volume covers a directory, the underlying directory is exported rather than the volume data. Import makes a new filesystem image, not a reconstruction of the original layer history, tags, startup configuration or container settings. A new command or supported metadata change may be needed before running it; review all metadata and platform compatibility. Use save/load to distribute a built image and a database-aware backup for persistent application data. An exported filesystem can contain confidential files, so only consider this with synthetic approved lab data and trusted archives. In this scenario changed /app/note.txt may be represented in the export, while mounted /data records are not. Export of a changing application is not a transaction-consistent snapshot. The imported image requires independent identity and configuration checks.
Common mistake
Export/import is not a full container snapshot, volume backup or reproducible build recipe.
Manual practice
Choose save/load, export/import or an application-aware backup for three goals: distributing a release, inspecting a disposable modified filesystem and recovering database records. Explain your choices.
Worksheet: lab-fixtures/docker-registries-and-delivery/08-export-import/scenario.txt.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Container export versus image import — Knowledge check
Reason about image distribution and safe delivery.
Does export include mounted volume contents?
Does import reconstruct original layer history?
Which pair preserves the built image and tags for transfer?