# docker export: Export a Container Filesystem

> How docker export works: flattening a container filesystem to a tar, how it differs from docker save, and CI use cases.

Source: https://latchkey.dev/learn/command-reference/docker-export-command  
Updated: 2026-06-25

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.

## FAQ

### docker export: Export a Container Filesystem?

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 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.

---

Latchkey runs CI/CD that repairs its own failures. Agent entry points: https://latchkey.dev/agent.txt, https://latchkey.dev/openapi.json, https://latchkey.dev/llms.txt
