mongo db restore databases from volume docker code example
Example: auto backup mongodb in docker-compose
docker-compose exec -T <name_of_the_mongodb_container> mongodump --archive --gzip --db mydb > dump.gz
docker-compose exec -T <name_of_the_mongodb_container> mongodump --archive --gzip --db mydb > dump.gz