Need help making docker file for playframework image, even I am ready pay

Hi
I am finding problem to make playframework image/container working. Here is my version of Dockerfile. But it gives error. Some of the available images in docker hub is not helping me out. I will be ready to pay someone who can help completing my dockerfile to build image and running container from it.

here is my dockerfile based on ingins/jdk


FROM ubuntu:15.04
RUN apt-get update
RUN apt-get install -y
wget
alien
unzip
RUN wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie” http://download.oracle.com/otn-pub/java/jdk/8u11-b12/jdk-8u11-linux-x64.rpm
RUN alien -i jdk-8u11-linux-x64.rpm
RUN wget https://downloads.typesafe.com/typesafe-activator/1.3.6/typesafe-activator-1.3.6.zip
RUN unzip typesafe-activator-1.3.6.zip

Below line gets error…message like…activator directory is not found
RUN chmod a+x /activator-1.3.6/activator

( I am not sure where activator is!!! to set the ENV )
ENV PATH=PATH: /activator-1.3.6/activator
EXPOSE 9000 8888
RUN mkdir /app
WORKDIR /app

(at the end this command does not run)
CMD [“activator”, “run”]

Hi,

The below Dockerfile will work for you.

FROM ingensi/oracle-jdk
RUN yum -y install unzip && yum clean all
RUN cd /opt && wget https://downloads.typesafe.com/typesafe-activator/1.3.6/typesafe-activator-1.3.6.zip && unzip typesafe-activator-1.3.6.zip && rm typesafe-activator-1.3.6.zip
ENV PATH=$PATH:/opt/activator-dist-1.3.6/
EXPOSE 9000 8888
RUN chmod +x /opt/activator-dist-1.3.6/activator
RUN mkdir /app
WORKDIR /app

CMD ["activator", "run"]

There are some problems in what you have done.

  • You mentioned that your Dockerfile is based on ingensi/jdk but you have started from ubuntu:15.04
  • I tried the alien method of installing jdk on a ubuntu:15.04 container but the java installation has some problem and was not working
  • In your chmod step you are point to the wrong directory, please refer to the right directory name in my Dockerfile
  • Your PATH variable is also not correct, refer to my Dockerfile
  • Finally the activator run command will fail because you have messed up the PATH variable.

Just a note, in my Dockerfile the activator run wont work unless you have mounted the /app with a proper application.

You can override the cmd and test the working as shown below.

# first build the docker image
docker build -t play .
# now run the container from the image
docker run -it --rm -p 8888:8888 play activator ui -Dhttp.address=0.0.0.0

Now if you point your browser to port 8888 of your containers ip address you can find the we console of activator.

Regards

Thanks Ranjan
I know its not a good question… do I need to save the dockerfile in any particular directory before building image? of course it’s not root!!!

Why I am asking if again commands do not run prompting directory not found.

Thanks

HI Ranjandas
I have got the app folder for play framework which includes all below file. When I am mounting this app folder creating a container it exits in 10 sec. Could you please advise the requirement of app folder. And how connected to postgres database container from this app.

Please see there is a config file for database connectivity. I can edit it. But where this config file has to be.

Please help I am in real trouble!!!

root@ip-172-31-30-123:/home/ubuntu/app# ls -l
total 1228
-rwxr-xr-x 1 ubuntu ubuntu 591 Oct 14 04:21 LICENSE
-rwxr-xr-x 1 ubuntu ubuntu 148 Oct 14 04:38 README
-rwxr-xr-x 1 ubuntu ubuntu 1574 Oct 14 04:38 README.md
-rwxr-xr-x 1 ubuntu ubuntu 9507 Oct 14 04:20 activator
-rwxr-xr-x 1 ubuntu ubuntu 1188338 Oct 14 04:20 activator-launch-1.2.12.jar
-rwxr-xr-x 1 ubuntu ubuntu 7110 Oct 14 04:20 activator.bat
drwxr-xr-x 11 ubuntu ubuntu 4096 Oct 14 05:20 app
-rwxr-xr-x 1 ubuntu ubuntu 729 Oct 14 04:21 build.sbt
drwxr-xr-x 4 ubuntu ubuntu 4096 Oct 14 04:21 conf
drwxr-xr-x 2 ubuntu ubuntu 4096 Oct 15 05:30 logs
drwxr-xr-x 4 ubuntu ubuntu 4096 Oct 14 04:21 project
drwxr-xr-x 5 ubuntu ubuntu 4096 Oct 14 04:38 public
drwxr-xr-x 7 ubuntu ubuntu 4096 Oct 14 04:53 target
drwxr-xr-x 4 ubuntu ubuntu 4096 Oct 14 04:53 test

Hi,

Please share the updated Dockerfile. Is your java working properly? Can you give the output of

java -version

Regards

Its seems it does not work.

root@ip-172-31-30-123:/home/ubuntu/app# java -version
The program ‘java’ can be found in the following packages:

  • default-jre
  • gcj-4.8-jre-headless
  • openjdk-7-jre-headless
  • gcj-4.6-jre-headless
  • openjdk-6-jre-headless
    Try: apt-get install
    root@ip-172-31-30-123:/home/ubuntu/app# javac -version
    The program ‘javac’ can be found in the following packages:
  • default-jdk
  • ecj
  • gcj-4.8-jdk
  • openjdk-7-jdk
  • gcj-4.6-jdk
  • openjdk-6-jdk
    Try: apt-get install
    root@ip-172-31-30-123:/home/ubuntu/app#

Its your dockerfile which extends ingensi/oracle-jdk image. It should install java and java compiler!!!

Did you build the docker image using my Dockerfile? Then how come your prompt in error message is showing /home/ubuntu/app ??

its your docker which created the image. I dont know why java is not running!!!

could you please see output when I run ‘java -version’? does it mean i have to do something else?

Ranjan, I dont know underlying tech. Does it mean creating this image from Dockerfile would install java and javac in host os (ubuntu here) on top of where docker engine is running? My understanding is java and javac would run inside container once we create from the image!!!

please correct me.

Hi Ranjan
Is it the case for which this image is not working that we are extending FROM ingensi/oracle-jdk which is based on redhat commands such as yum. my base image is ubuntu. even your this dockerfile is also includes yum.