I have to build single docker image for two independent programs, one is in java and one in c++. Now i have written dependencies in my dockerfile for c++ program and its working fine but when i checked for java , in all examples it was said to use base image of java (FROM openjdk:8-jre-alpine) but my problem is that i have to build image from a certain customised image only. I’m using ubuntu and i have run my simple java program by installing openjdk but i don’t know how can i add dependencies for java correctly and run it in docker container along with c++.
I tried adding RUN apt-get install -y default-jdk but it returns non-zero code . I also tried RUN apt-get install oracle-java8-installer but it didn’t worked either. Following is my Dockerfile.
RUN apt-get update -y RUN apt-get install -y g++ RUN apt-get install -y make RUN apt-get install -y build-essential RUN apt-get install -y default-jdk #C++ program ADD ./cppProgram /cppProgram #java program ADD ./javaProgram /javaProgram WORKDIR /cppProgram WORKDIR /javaProgram COPY abcserver.json /etc/ RUN make