Skip to content
Latchkey

docker export: Export a Container Filesystem

Flatten a container filesystem to a single tar - no layers, no history.

docker export serializes a container filesystem (not an image) to a tar archive. It pairs with docker import. This page covers when to use it versus docker save.

What it does

docker export writes the current filesystem of a container as a flat tar. It drops layer history, image metadata, ENTRYPOINT/CMD, and environment - those live in image config, not the filesystem.

Common usage

Terminal
docker export -o rootfs.tar mycontainer
docker export mycontainer | gzip > rootfs.tar.gz
docker create --name tmp myapp:latest && docker export -o fs.tar tmp

Common errors in CI

A frequent surprise: an image built from docker export | docker import "loses" its CMD/ENTRYPOINT and starts nothing, because export discards image config. If you need a runnable image with metadata, use docker save/load instead. export needs a container ID, not an image name - create one first with docker create.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →