简体   繁体   中英

Dockerizing Spring Boot db error : connection refused

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM