I am facing one issue where I am trying to connect localhost:3306 from a microservice which is running in docker container. I have multiple microservices hence written docker-conpose file. My issue is: one microservice is trying to connect mysql which is running in my machine, means its available on 'localhost:3306' however, when microservice is trying to connect its throwing message connection refused.
There are couple of solutions I have found
- Trying to connect with 172.17.0.1 in instead of localhost
- Since my sercices are running in ubuntu i tried using 'host.docker.internal'
Nothing worked for me. I am looking for solution here how I can access
I already tried solution mentioned in below thread.
From inside of a Docker container, how do I connect to the localhost of the machine?