Check out example codes for "connect mysql docker". It will help you in understanding the concepts better.

Code Example 1

docker container run -d -p 3306:3306 --name mysql --env MYSQL_ROOT_PASSWORD=123456 mysql

docker container exec -it mysql bash

Learn ReactJs, React Native from akashmittal.com