Why not using mysql in docker too? first, I just beginner in this container/docker thing, so I don’t know how reliable docker volumes. For safer/easier way, I use direct sql installation in host. But how if you container want to access your sql, here is how to do it
-
Check your container IP address using
docker inspect your-container-name |grep IPAdress
Check Container IP Address
-
Create sql user in your local sql
Create a New User for Your Container Only
-
Don’t forget to allow container IP Address in your firewall.
Allow IP in UFW
To check sql connection between container & host, you can install mysql-client
at container & try connect to host mysql