I am experimenting with Docker for the first time and am trying to run a Spring web application to load inside a Docker container. I create an application (which is packaged in a standalone jar) and then add it to the Docker image (this is what I want).
You can find SSCCE in this Bootup repo on GitHub , whose README has all the instructions for reproducing what I see. But basically:
- I am creating a web application in a bank
- Run
docker build -t bootup . that succeeds - Run
docker run -it -p 9200:9200 -d --name bootup bootup and then the container seems to start working fine, as docker ps output shows below - However, when I point the browser to
http://localhost:9200 , I get nothing
docker ps output:
CONTAINER ID IMAGE COMMAND CREATED a8c4ee64a1bc bootup "/bin/sh -c 'java -ja" 2 days ago STATUS PORTS NAMES Up 12 seconds 0.0.0.0:9200->9200/tcp bootup
The web application is configured to work on port 9200 , not the default default is 8080. You can see this for yourself by running the application outside of dockers (for example, only locally on your host computer) by running ./gradlew clean build && java -jar build/libs/bootup.jar .
As far as I know, my host does not have a firewall to block ports (I am on Mac 10.11.5 and checked that System Preferences >> Security & Privacy >> Firewall turned off).
Can anyone see where I will be wrong?
Update:
I ran curl , netstat and lsof on the host:
HOST: curl http://localhost:9200 curl: (52) Empty reply from server netstat -an | grep 9200 tcp6 0 0 ::1.9200 *.* LISTEN tcp4 0 0 *.9200 *.* LISTEN lsof -n -i4TCP:9200 | grep LISTEN com.docke 2578 myuser 19u IPv4 <someHexNumber> 0t0 TCP *:wap-wsp (LISTEN)
And then docker exec in the container and ran another netstat :
CONTAINER: netstat -an | grep 9200 bash: netstat: command not found
Update from photo:
The image of my browser (Chrome) is indicated at http://localhost:9200 :

Image of source code at http://localhost:9200 :

Image of the Chrome developer tools checking the page at http://localhost:9200 :

Image of the Network tab in Chrome Developer Tools:

What the hell is going on here?!?!? According to the source, the browser should show me hi from Dockerland! the message is only good. According to the actual browser page, there seems to be a network error. And according to Chrome Developer Tools, my application returns all kinds of HTML / CSS / JS content that are not even removed from my application (check the source code, see for yourself) !!!