skip to Main Content

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


  1. from your browser you need to try as localhost:8888

    Login or Signup to reply.
  2. 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,

    docker inspect <container id> | grep "IPAddress"
    

    then you should not use 8888, you should use a container port that is 8080

    if you want to access from host then you can use 8888 as this the publish port.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search