Docker Community Forums

Share and learn in the Docker community.

Having issues accessing Spring Boot app container on simple (non-swarm) docker on OSX


(Partyk1d24) #1

I have set up a simple spring boot project that runs as a JAR. I am then using the com.bmuschko:gradle-docker-plugin to then install this jar on an image in docker. This is similar to what is done in many existing tutorials. The problem I am having is, even though is shows as running…

54460fce5d16 b5d87e740633 "java -jar /app/simp…" 17 hours ago Up 17 hours>8080/tcp, 9090/tcp keen_roentgen

And (not executing as a daemon) the log shows Spring boot is running…

Started Application in 8.877 seconds (JVM running for 9.263)

When I try to go to http://localhost:8080 I get an empty response. I get the same thing if I try to go to the ip of the container as well. If I remove the port mapping from the run command I get a timeout at localhost and a empty response from the docker ip.

This leads me to believe that instead of getting the response I would expect from spring I am getting an empty response. Also I do not see the spring app act like it got the request. I am sure I am just missing a simple map or something but can someone help? My run command looks like this…

docker run -p 8080:8080 -t -e DB_PORT=$DB_PORT -e DB_URL=$DB_URL b5d87e740633

Thank you

(Partyk1d24) #2

Just so we are clear with mapping I get…

curl http://localhost:8080

curl: (52) Empty reply from server

With a run command like this

docker run -t -e DB_PORT=$DB_PORT -e DB_URL=$DB_URL b5d87e740633

I get…

curl: (7) Failed to connect to localhost port 8080: Connection refused

(Partyk1d24) #3

NM I got it in the…