Persistent Mariadb storage

What is the best way to use mariadb with persistent storage? I want to use a custom location on disk as persistent usage and a custom my.cnf file with the parameter

Just follow the instructions on Dockerhub in the sections “Using a custom MySQL configuration file” and “Where to Store Data”. The example

docker run --name some-mariadb -v /my/own/datadir:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mariadb:tag

mounts the local folder my/own/datadir into the database container. You don’t have to change my.cnf for this.