scala - Docker Akka-Http application endpoint not reachable -


i have basic akka-http app not more hello-world setup - have defined endpoint , bound "localhost" , port "8080":

object main extends app routes {   private implicit val system = actorsystem()   protected implicit val executor: executioncontext = system.dispatcher   protected implicit val materializer: actormaterializer = actormaterializer()   protected val log: loggingadapter = logging( system, getclass )    log.info( "starting server" )   http().bindandhandle( logrequestresult("log",logging.infolevel)( allroutes ), "localhost", 8080 )   log.info( "server started, awaiting requests.." ) } 

(allroutes mixed in via routes, dummy endpoint serialises simple case class json response)

if start using sbt endpoints works fine (http://localhost:8080/colour/red example).

i trying package docker container run - have read things http://yeghishe.github.io/2015/06/24/running-akka-applications.html , have added sbt-native-package plugin (http://www.scala-sbt.org/sbt-native-packager/formats/docker.html#customize).

now run sbt docker:publishlocal

and can see docker image has been created:

repository             tag                 image id            created             size sample-rest-api        0.0.1               3c6ee44985b4        9 hours ago         714.4 mb 

if start image, mapping 8080 port follows:

docker run -p 8080:8080 sample-rest-api:0.0.1 

i see log output see on startup, looks has started ok, however, if attempt access same url response

"problem loading page: connection reset"

if check docker ps see image running, , ports mapped expected:

container id        image                   command                 created              status              ports                    names 27848729a425        sample-rest-api:0.0.1   "bin/sample-rest-api"   minute ago   minute   0.0.0.0:8080->8080/tcp   furious_heisenberg 

i running on ubuntu 16.04 - have ideas?

try changing 'localhost' 0.0.0.0 in http.bindandhandle


Comments

Popular posts from this blog

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

Using django-mptt to get only the categories that have items -