title: How do I access a spring app running in a docker container?
body: <p>I have the following for a docker file...</p>
  
  <pre><code>FROM openjdk:11-jdk-slim
  VOLUME /tmp
  ARG JAR_FILE
  COPY ${JAR_FILE} app.jar
  ENTRYPOINT ["java","-Dexternal.config.active='false'","-jar","/app.jar"]
  </code></pre>
  
  <p>And spring config...</p>
  
  <pre><code>docker {
    springBootApplication {
      baseImage = 'openjdk:11-jdk-slim'
      ports = [9090, 8080]
      tag = 'app:0.2'
    }
  }
  </code></pre>
  
  <p>Everything seems to start file and I see</p>
  
  <p><code>Started Application in 8.743 seconds (JVM running for 9.153)</code></p>
  
  <p>and I see...</p>
  
  <pre><code>f46b4cbfa799        646eced45077        "java -jar /app/simp…"   15 minutes ago      Up 15 minutes                 8080/tcp, 9090/tcp   mystifying_kirch
  </code></pre>
  
  <p>But when I run <code>docker inspect &lt;imageId&gt; | grep "IPAddress"</code> and enter that address in the browser like this <code>http://&lt;IP&gt;:8080</code> I get a timeout error. I know I can use the port mapping on run but is there a way I can do it without mapping to my localhost?</p>
  
  <p>Also I tried this... </p>
  
  <pre><code>curl 172.17.0.2:8080
  curl: (7) Failed to connect to 172.17.0.2 port 8080: Operation timed out
  </code></pre>
  
  <p>So it isn't the browser.</p>
  
  <p>Also tried to map it like this...</p>
  
  <p>0.0.0.0:8080->8080/tcp, 9090/tcp</p>
  
  <p>But localhost:8080 (or the ip address) sends an empty response " didn’t send any data."</p>