title: Cannot access a running spring boot application docker container
body: <p>I'm running a <a href="https://stackoverflow.com/q/53084886/5265472">spring boot application</a> in the background as an API server, but I cannot access it from <code>localhost:8080</code>.</p>
  <p><strong>Container status</strong></p>
  <pre><code>CONTAINER ID        IMAGE                         COMMAND                  CREATED             STATUS              PORTS                                              NAMES
  2c494c8304e0        corpobids.com/server:latest   &quot;java -jar server.jar&quot;   5 seconds ago       Up 4 seconds        0.0.0.0:8080-&gt;8080/tcp, 0.0.0.0:18080-&gt;18080/tcp   server_api-server_1
  8d1883ebcb0b        postgres:9.6                  &quot;docker-entrypoint.s…&quot;   5 seconds ago       Up 4 seconds        0.0.0.0:5432-&gt;5432/tcp                             server_database-server_1
  </code></pre>
  <p>The ports are already exposed and mapped. The application is running fine in the container.</p>
  <blockquote>
  <p>2018-10-31 15:25:21.255  INFO 1 --- [           main]
  o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s):
  8080 (http) with context path ''</p>
  <p>2018-10-31 15:25:21.256  INFO 1 --- [           main]
  com.api.server.Application         : Started Application in
  13.861 seconds (JVM running for 14.25)</p>
  </blockquote>
  <p>How do I call the API of the application from my host computer?</p>