Disha Shah
Disha Shah

Reputation: 3

Deploying WAR file in Docker container

We have made an user management web application in java with tomcat running on 8085 .

The following is my Dockerfile content:

FROM java:8
EXPOSE 8085
ADD /userman.war userman.war
ENTRYPOINT ["java","-jar","userman.war"]

Please suggest changes .

Upvotes: 0

Views: 3163

Answers (1)

chintan thakar
chintan thakar

Reputation: 1500

You need to start your docker container with physical host/system ip address and also hit physical host ip address in your browser. Sample example :

docker run -it -d -h $hostname -p 8085:8085 javay

Whenever you start your container it will assign ip address from docker0 interface.It will be different from your actual ip address.by default docker container will start with docker0 interface ip address like 172.17.0.1.

Your physical machine/system ip address will be from eth0 interface with ip range may be like 10.0.0.1 or 192.168.0.1. So if you want to access your application running inside your container then you have to visit http://10.0.0.1:8085/userman or if docker container is running on same physical machine than you can use like http://localhost:8085/userman

Hope this will make sense.

Thank you!

Upvotes: 2

Related Questions