0

I am running my play framework application via a docker. The image starts ok but I am not able to connect to the application using localhost:9000 on a web browser. What I might be doing wrong? I have exposed port 9000 in the Dockerfile.

The trace when the application starts

docker run codingjediweb-1.0-snapshot
[debug] p.a.l.c.ActorSystemProvider - Starting application default Akka system: application
[info] play.api.Play - Application started (Prod)
[info] p.c.s.AkkaHttpServer - Listening for HTTP on /0.0.0.0:9000

Dockerfile is

FROM openjdk:8
ENV APP_NAME      my-app
ENV APP_VERSION   1.0-SNAPSHOT
#make a directory deploy in the container
RUN mkdir deploy
#cd to container
WORKDIR deploy
#copy from host (path relative to location of Dockerfile on host) to deploy directory. The deploy directory will have my-app-1.0.zip, logback_prod.xml and application_prod.xml
COPY target/universal/my-app-1.0.zip .
COPY conf/logback_prod.xml .
COPY conf/application_prod.conf .
#unzip deploy/my-app-1.0.zip in container
RUN unzip my-app-1.0.zip
#chmod my-app script in deploy/my-app-1.0/bin/my-app
RUN chmod +x my-app-1.0/bin/my-app
EXPOSE 9000
#entrypoint is deploy/....
ENTRYPOINT my-app-1.0/bin/codingjediweb -Dplay.http.secret.key=changemeplease -Dlogger.file=logback_prod.xml -Dconfig.file=application_prod.conf
Manu Chadha
  • 15,555
  • 19
  • 91
  • 184

1 Answers1

0

I had to use the argument -p 9000:9000. More details in What is the difference between "expose" and "publish" in Docker?

Manu Chadha
  • 15,555
  • 19
  • 91
  • 184