backup data from mongodb dockercontainer 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