Launch a docker mysql official container to mount an existing database folder. You can choose the mysql version.
Then use mysqldump inside the container to save it into a sql.gz file.
Note: tmp dir, data dir and output dir will be all the same: the database folder.