First I run
docker run -it --rm -p 8888:8080 tomcat:8.0
then I can able to see my html code
curl localhost:8888
bu when i am accessing from browser
<container-id>:8888
it showing This site can’t be reached took too long to respond.
First I run
docker run -it --rm -p 8888:8080 tomcat:8.0
then I can able to see my html code
curl localhost:8888
bu when i am accessing from browser
<container-id>:8888
it showing This site can’t be reached took too long to respond.
2
Answers
from your browser you need to try as
localhost:8888
You can not access the container application from the browser using
container_id
, container_id is work for service to service communication when both service in same network or link with each other.Also if you want to access the container using container IP,
then you should not use
8888
, you should use a container port that is8080
if you want to access from host then you can use
8888
as this the publish port.