When trying to add a volume to a container for a MySQL Docker on Mac OSX, I had permission issues to create the database files. I create a new image based on the MySQL Docker image to fix the issue before running the server. Got the idea from this comment and this other one
docker run -d --name mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=somepassword4R00T \ -v $HOME/data/mysql:/var/lib/mysql \ vhugo/mysql
If you already have data, you might not need
-e MYSQL_ROOT_PASSWORD=somepassword4R00T as part of the command.