Reputation: 59634
I have developed a small Java demo web app, using gradle, which I want to dockerize with WildFly. I have followed instructions from here.
The Dockerfile
is:
FROM jboss/wildfly
MAINTAINER Me <[email protected]>
RUN /opt/jboss/wildfly/bin/add-user.sh admin Admin#70365 --silent
ADD build/libs/my-demo.war /opt/jboss/wildfly/standalone/deployments/
When I start the image with Docker and browse localhost:8080
or localhost:9990
, I get a This site can’t be reached
.
Yet, my application runs successfully on localhost:8080
when I use gradle appRun
.
What is missing?
I am under Windows 10 Home Edition. I have tried on another laptop under Ubuntu 16 and face the same issue.
Upvotes: 1
Views: 8667
Reputation: 221
Three things:
1st
the base image EXPOSE
s only port 8080, so to be able to access port 9990 you need to add EXPOSE 9990
to your Dockerfile or --expose 9990
to your docker run
call.
2nd You didn't post your cmd line call, so I can only guess but you need to map the container port to a host port, example (including the additional exposed port)
docker run --expose 9990 -p 9990:9990 -p 8080:8080 -it my-demo
3rd If your working with docker-machine as it is still the case with Win 10 home as far as I recall, you won't have your application on localhost but at the IP of the docker-machine VM. You can find out which IP that is by calling
docker-machine ip
On linux you will have your app on localhost:PORT once you add the port mapping.
Upvotes: 6