Docker Export Command
# Docker export Command
[Docker Command Manual](#)
* * *
The `docker export` command is used to export the file system of a Docker container as a tar archive file.
The `docker export` command is primarily used for backing up or migrating a container's file system, without including all the layers and metadata of the Docker image.
### Syntax
docker export CONTAINER
OPTIONS Description:
* **`-o, --output`**: Write to a file, instead of STDOUT.
Export container file system:
docker export my_container
Export the file system of the container named my_container to standard output.
Save the exported file as a tar file:
docker export my_container > my_container_backup.tar
Export the file system of container my_container and save it to the my_container_backup.tar file.
Save the exported file using the --output option:
sh docker export -o my_container_backup.tar my_container
Export the file system of container my_container and save it to the my_container_backup.tar file.
### Examples
Start a container:
docker run -d --name my_container ubuntu bash -c "echo hello > /hello.txt && sleep 3600"
Export the container's file system:
docker export my_container > my_container_backup.tar
View the contents of the exported tar file:
tar -tf my_container_backup.tar
Output:
hello.txt
Import the file system into a new container:
cat my_container_backup.tar | docker import - my_new_image
### Notes
* `docker export` only exports the container's file system, not including the Docker image's layers, metadata, or runtime information.
* If the container is running, the exported file system will be a snapshot of the container's current state.
* The exported tar file may be large, depending on the size of the container's file system.
The `docker export` command is a useful tool for exporting a container's file system as a tar archive file. This is very useful for backing up, migrating, and analyzing a container's file system. By using the `--output` option, users can save the exported content to a specified file, making it easy to manage and use.
* * Docker Command Manual](#)
YouTip