How to access Docker outside the host

I configured tomcat image with port 8080 and wanted to access it from lan. I expose the port 8080 but still not able to access tomcat. Also once expose the port how do I get the IP address of docker image (172.17.0.26) to 192.168.99.100.

Please help.

Hi.

You should be able to access it by the host ip, and port 8080, if you run it locally you can use: http://localhost:8080

Regarding your other question, im not sure what it is you want to do?

Hi Martin,

Thank you for your prompt reply.

I am new in docker.

Actually what I want is I have configured tomcat on docker image and that image I wanted to access from our LAN by exposing port 8080. I tried to expose the port using the command mentioned on this site https://docs.docker.com/engine/reference/builder/#expose

the main point is I wanted to access the tomcat from my LAN (other lan machines). How can I do that. Could you please explain?

Regards,

Vikas

If you have run a container, via docker run -p 8080… you should be able to just access it via the HOST ip, that is the host you installed docker on.
So if your server has ip: 192.168.0.67, you should be able to see the tomcat pages on: http://192.168.0.67:8080

My docker Ip is 172.17.0.26 and I am able to access it via localhost. But If I want to access it from Host or from other machines from LAN so how can I do that? Because from host machine I am able to ping to docker image i.e. 172.17.0.26. So how can I access it from other LAN machines?

Don’t worry about ‘Docker IPs’. Take the second example from ‘How to use this image’ in Tomcat on Dockerhub as a starting point. If your machine has (as you write) IP 192.168.99.100 you can now find Tomcat at http://192.168.99.100:8888.

My LAN ip address is 192.168.1.XXX. I deployed new tomcat image and then also I am not able to access tomcat from other machine. How can I expose the tomcat port 8080 and how can I get the docker IP in 192.168.X.XXX range after expose the port.I mean where should I find the docker IP address in 192.168.1.XXX.