Unable to Connect Mysql container from a spring-boot application

Hello. I’d recently got stuck at this. I try everything regarding network settings with my containers, but eventually I noticed that the problem wasn’t with the containers or docker, but with my spring application. I wasn’t using the properly profile on the Java -jar command. Whithout it, the Default was used, and the app was trying to connect in the localhost.
So basically I got over this using the properly command in the app container, which was something like this:

java -Dspring.profiles.active=dockerembbed,oauth-security -jar myapp.jar

1 Like