Home > Software design >  Dockerizing Spring Boot db error : connection refused
Dockerizing Spring Boot db error : connection refused

Time:01-27

an spring boot app can run from console A., but I get connection refused when it runs by docker run B.

A. from console it works

java -Dspring.profiles.active=loc -jar app.war

B. Dockerfile

docker run -e "SPRING_PROFILES_ACTIVE=loc" app
ENTRYPOINT java -jar $WDIR/app.war

Why I get this error ?

Thanks in advance.

Csaba

CodePudding user response:

You need to check your application properties/yaml for network access. For example; if you have database connection in properties you need check access of database. If you have container database you need to access via container name or for external remote access you can explore docker network

  •  Tags:  
  • Related