How to find IP address of a Docker container


On my windows laptop I have created a Play application which runs fine if I execute its scripts directly. On the local machine, I access the application using localhost:9000 URL.

I have now created a Docker image of the application and have exposed port 9000

#this docker file copies prod specific files to container, eg logback_prod.xml and application_prod.conf

    FROM openjdk:8
    #ENV APP_NAME      myapp
    #entrypoint is deploy/....
    EXPOSE 9000

But I can’t access the application on localhost:9000. I suspect that the image might be running on some other IP created by docker itself.

Am I correct? How can I access my application through the container? I don’t need Kubernetes Services etc. as I already have that setup on another machine. My specific question is how to access the docker container directly.

I also tried running the docker image using --network="host" but that doesn’t work either


Based on the suggestions below, I executed the following commands but still can’t access the application.

docker run -p 9000:9000 --env-file env.txt imagename

I see the trace

[debug] a.i.TcpListener - Successfully bound to /
[info] p.c.s.AkkaHttpServer - Listening for HTTP on /

docker ps -a shows application is up with port binding>9000/tcp

docker inspect shows IP"IPAddress": ""

but on Chrome doesn’t work This site can’t be reached172.17.0.2

Source: Docker Questions