I've set up a java application which acts as a web server and handles http requests. I've tested that it works outside the container (which it does), but when in the container my requests don't seem to get to it.
The server listens on port 3971, and the Dockerfile looks like this:
FROM java:8
ADD VaultServer /
EXPOSE 3971
EXPOSE 3972
ENTRYPOINT ["java", "-jar", "VaultServer.jar"]
Calling to the root address should return something (normally I'd send a GET to http://localhost:3971/).
I've tried replacing 'localhost' with the the ip address of docker-machine, and also with the ip address I get when inspecting the running container for my server, but neither seem to respond. When I call to the ip address of docker-machine, I get ERR_CONNECTION_REFUSED. Is there something else I need to enable?
Are you using Docker Toolbox???
In my case, the normal docker installation didnt work on my Windows 10 so I had to install Docker toolbox; docker toolbox adds a virtual machine where the docker runs all their containers.
For example, to access my dockerized apps I have to use: http://192.168.99.100:8080/app.
Here, 192.168.99.100 is the virtual machine ip.
Hope it helps you!!!!
you are doing EXPOSE 3972 which exposes the port to other linked containers but NOT to the host machine
To expose the port to the host machine you do ...
you can also do ...
which exposes all ports exposed by EXPOSE to the host (this is not the default - you must use the -P flag here)
Use the "action="http://192.168.99.100:8080/rest/data/ingest" in your html to refer to your Docker Container's Rest Path. See the bottom HTML Code, line 4.
http://192.168.99.100:8080/rest/data/ingest Breakdown:
1) 192.168.99.100:8080= Docker's IP Address & Port #.
2) /rest/ = In your web.xml file
3) data/= @Path("/data")
4) /ingest= @Path("/ingest")
HTML CODE:
JAVA CODE:
I can show you how I compose dotnet core project with other containers (MSSQL and Elasticsearch), maybe it will help you.
To docker-compose.yml add dependencies for another container:
And write in docker-compose.override.yml, where you will override your appsetting file, and will get access to another container:
I hope it will be helpful.