To export the files of a container, use the command "docker container export".
Let's create a container and export its contents:
$ docker container export $(docker container create hello-world) | tar -tv
-rwxr-xr-x 0/0 0 .dockerenv
drwxr-xr-x 0/0 0 dev/
-rwxr-xr-x 0/0 0 dev/console
drwxr-xr-x 0/0 0 dev/pts/
drwxr-xr-x 0/0 0 dev/shm/
drwxr-xr-x 0/0 0 etc/
-rwxr-xr-x 0/0 0 etc/hostname
-rwxr-xr-x 0/0 0 etc/hosts
lrwxrwxrwx 0/0 0 etc/mtab -> /proc/mounts
-rwxr-xr-x 0/0 0 etc/resolv.conf
-rwxrwxr-x 0/0 13336 hello
drwxr-xr-x 0/0 0 proc/
drwxr-xr-x 0/0 0 sys/
If you check at the Dockerfile of the "hello-world" image,
you will notice that it only copy the "hello" file which is the only non-empty file in the container:
FROM scratch
COPY hello /
CMD ["/hello"]
The other files and directories in the container are mandatory (required by the kernel).
They all show zero bytes in length and Docker will automatically bind-mount them from the Docker host into the container when it's created.