I have mysql running on my localhost I can connect it by running:
mysql -h 127.0.0.1 -P 3306 -u root -p
I also ran docker container with co
Even if you configure MySQL to listen on all interfaces, and then from your container access MySQL from a non-loopback IP, you may find that Docker’s routing, NAT, and firewall rules do not allow you to access services running on the host. The fast workaround for this is to run your container on the host network stack with:
docker run -tid -v $(pwd):/code -p 3306:3306 -p 5000:5000 \
--name container --net host container
You can also also move MySQL inside a container running on the same Docker network, and then access it via the container name using Docker’s DNS service discovery.