I have written a very simple demo project, you can download it by clicking here.
The above java project will be containerized as an docker image. But it needs to connect to the local mysql database which is not containerized.
I tried changing the value of spring.datasource.url
from jdbc:mysql://localhost:3306/db?characterEncoding=utf8&useSSL=false
to jdbc:mysql://192.168.1.105:3306/db?characterEncoding=utf8&useSSL=false
in the application.yaml
. This change seems to bring success.
so I Change the value of spring.datasource.url
back to the original and tried docker run --network=host .....
,but this didn't success.. why?
Thanks a lot.