I have a Spring Boot
application that I'm planning to run on a Docker
container and to test this application I'm connection to MySQL
on my host machine. To do that I have a property in my application.properties
as below
spring.datasource.url = jdbc:mysql://host.docker.internal:3306/flexapp
Now when I do ./mvnw install dockerfile:build
it tried to build the application before building the Docker image
. While it's building it says
Caused by: java.net.UnknownHostException: host.docker.internal: nodename nor servname provided, or not known
Obviously it's not able to resolve host.docker.internal
.
How do I connect my Spring Boot
application in Docker
container to the MySql
Instance in my host machine? I googled and tried a lot of solution but nothing seems to work.