title: Identify Docker container's IP Address and connect to port
body: <p>On my <code>windows</code> laptop I have created a <code>Play</code> application which runs fine if I execute its scripts directly. On the local machine, I access the application using <code>localhost:9000</code> URL.</p>
  <p>I have now created a <code>Docker</code> image of the application and have exposed port <code>9000</code></p>
  <pre><code>#this docker file copies prod specific files to container, eg logback_prod.xml and application_prod.conf
  
      FROM openjdk:8
      #ENV APP_NAME      myapp
      #ENV APP_VERSION   1.0-SNAPSHOT
  ...
      #entrypoint is deploy/....
      EXPOSE 9000
      ENTRYPOINT ...
  </code></pre>
  <p>But I can't access the application on <code>localhost:9000</code>. I suspect that the image might be running on some other IP created by docker itself.</p>
  <p>Am I correct? How can I access my application through the container? I don't need <code>Kubernetes</code> <code>Services</code> etc. as I already have that setup on another machine. My specific question is how to access the <code>docker</code> container directly.</p>
  <p>UPDATE
  I also tried running the <code>docker</code> <code>image</code> using <code>--network=&quot;host&quot;</code> but that doesn't work either</p>
  <p>UPDATE 2</p>
  <p>Based on the suggestions below, I executed the following commands but still can't access the application.</p>
  <p><code>docker run -p 9000:9000 --env-file env.txt imagename</code></p>
  <p>I see the trace</p>
  <pre><code>[debug] a.i.TcpListener - Successfully bound to /0.0.0.0:9000
  [info] p.c.s.AkkaHttpServer - Listening for HTTP on /0.0.0.0:9000
  </code></pre>
  <p><code>docker ps -a</code> shows application is up with port binding <code>0.0.0.0:9000-&gt;9000/tcp</code></p>
  <p><code>docker inspect</code> shows <code>IP</code> - <code>&quot;IPAddress&quot;: &quot;172.17.0.2&quot;</code></p>
  <p>but <code>http://172.17.0.2:9000/</code> on <code>Chrome</code> doesn't work <code>This site can’t be reached172.17.0.2</code></p>
  <p><code>netstat -ab</code> on <code>cmd</code> shows <code>TCP    0.0.0.0:9000           LAPTOP-788I0GL1:0      LISTENING [com.docker.backend.exe]</code></p>