I'm a newbie to docker and I'm facing a strange error.
When I run
docker run --name some-mysql-5 -d -p 3306:3306 -e MYSQL_ROOT_PASSWORD=secret mysql:latest
followed by
docker exec -ti containerid bash
mysql -uroot -psecret
mysql works fine and I can create and populate databases.
But when I try to create a persistent host volume in order to create a shared db like this:
docker run --name some-mysql-4 -v C:\Users\User\Desktop\shared_vol_test:/var/lib/mysql/data -d -p 3306:3306 -e MYSQL_ROOT_PASSWORD=secret mysql:latest
followed by
docker exec -ti containerid bash
mysql -uroot -psecret
I get the following error
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
I've also tried to run it as an admin but the results are the same.
What am I doing wrong?
Am I creating a shared and persistent volume in the right way?