0

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

3
  • can you login to the container and see if you can reach the database manually? this seems like a networking issue to me Commented Jan 26, 2022 at 13:26
  • What's the error? How do you configure the database location? Where is the database actually located? Assuming it's on the same system somewhere, the host name to reach it will be different if the application is running on the host or in a container. Commented Jan 26, 2022 at 14:50
  • You are right guys, docker run needs something similar docker run -p 5432:5432 (it doesnt work but since Im new to Docker I forgot to set anything the open the ports) Commented Jan 26, 2022 at 16:41

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

1 Comment

thanks for your answer, pls see my comment above

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.