title: akka http: docker container is not connecting to the server
body: <p>i have an akka htpp app here is how i am binding it</p>
  <pre><code>val host = &quot;0.0.0.0&quot;
      val port = 8080
  
      val bindingFuture = Http().bindAndHandle(MainRouter.routes, host, port)
  log.info(&quot;Server online &quot;)
      StdIn.readLine()
      bindingFuture
        .flatMap(_.unbind()) // trigger unbinding from the port
        .onComplete(_ =&gt; system.terminate()) // and shutdown when done
  </code></pre>
  <p>i am using <a href="https://www.scala-sbt.org/sbt-native-packager/formats/docker.html#custom-dockerfile" rel="nofollow noreferrer">sbt native packager</a> to create my app docker image</p>
  <p>i have also added</p>
  <pre><code>dockerExposedPorts:= Seq(8080)
  </code></pre>
  <p>in my <code>build.sbt</code></p>
  <p>i am running my container as
  <code>docker run -p 8080:8080 testapp:0.0.1 --bind 0.0.0.0</code></p>
  <p><code>docker ps</code> shows</p>
  <pre><code>CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                    NAMES
  2e8e7ae35b10        testapp:0.0.1     &quot;/opt/docker/bin/tes…&quot;   13 minutes ago      Up 13 minutes       0.0.0.0:8080-&gt;8080/tcp   recursing_hellman
  </code></pre>
  <p>when i hit 0.0.0.0:8080 from browser i got</p>
  <pre><code>This site can’t be reached The connection was reset.
  Try:
  
  Checking the connection
  Checking the proxy and the firewall
  ERR_CONNECTION_RESET 
  </code></pre>
  <p>or from <code>postman</code></p>
  <pre><code>Could not get any response
  There was an error connecting to 0.0.0.0:8080/event-id?id=132
  </code></pre>
  <p>while docker container is running on my machine
  nc -zv 0.0.0.0 8080
  returns</p>
  <pre><code>Connection to 0.0.0.0 8080 port [tcp/http-alt] succeeded!
  </code></pre>
  <p>inside the container</p>
  <pre><code>docker exec -it 2e8e7ae35b10 bash
  </code></pre>
  <p>i have tried</p>
  <pre><code>curl 'http://0.0.0.0:8080/health'
  curl: (7) Failed to connect to 0.0.0.0 port 8080: Connection refused
  </code></pre>
  <p>my app works fine outside of docker</p>