Wednesday, October 23, 2019

MySQL docker volumes on Docker Desktop Windows 10

Using MySQL docker image is a quick and easy way to spin up an MySQL database for your application development and testing. However, if you are running on Windows Docker Desktop on Windows 10, if you do not have a correct volume setup, then the MySQL data volume will be embbed in the HyperV virual disk and is is very hard to reset/clean up. To mitigate the aforementioned problem, you can setup the correct volume on your host and share it with the Docker Desktop, this gives you full control for the MySQL data volume running in the Docker. Here are the steps:

  • create a local folder to hold the MySQL data volume:
    • mkdir c:\tmp\mysql
  • In your Docker Desktop via Settings -> Shared Drives mark your c: drive shared with Docker Desktop
  • Start your MySQL docker container:
    • docker run --net=mysql-network --name mysql -v c:/tmp/mysql:/var/lib/mysql -p 3306:3306 -e MYSQL_ROOT_PASSWORD=***** -d mysql:latest
  • Start MySQL client docker container:
    • docker run -it --network mysql-network --rm mysql:latest mysql -hmysql -uroot -p*****
  • If you do want to blow away the MySQL data volume, now you can easily do it on your host machine.

No comments:

Full Guide for using Bitnami Prometheus Operator Helm Chart with Additional Scrape Configuration

"The Prometheus Operator for Kubernetes provides easy monitoring definitions for Kubernetes services and deployment and management of...