Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

docker image running but can't access rest endpoint in spring boot application

I have created a spring-boot application, when build and run it using maven it was working success full. But when i ran docker of my app it was running in the console but i can't access any REST endpoint browser is giving page not found error.

here is the content of my Dockerfile

FROM java:8
EXPOSE 5555:5555
ADD /hotline-api/target/hotline-api.jar hotline-api.jar
ENTRYPOINT ["java","-jar","hotline-api.jar","--spring.profiles.active=test"]
like image 411
sudeera harshanath Avatar asked Jan 28 '23 15:01

sudeera harshanath


1 Answers

You also need to publish the port while running your image

docker run -p 5555:5555 IMAGE_NAME

Make sure you also expose the same port from your properties file based on your profile (default/dev/test).

like image 53
Mehraj Malik Avatar answered Jan 31 '23 09:01

Mehraj Malik