NOTE: make sure you export containers and images in separate directories or it's very likely there will be issues when importing or loading your backups using the following snippets
$ while read image container_id; do
docker export $container_id > ${image////_}-${container_id}.tar
done < <(docker ps -a -f status=exited | tail -n +2 | awk '{ print $2 " " $1 }')