Docker and Java 9 Modules

Are there Docker files for specific Java 9 modules?

I assume that FROM java:9basic images should appear for, but how additional modules will be delivered if my base is from a minimal Java 9 kernel.

+4
source share
2 answers

Here is one example:

 FROM java:9
 COPY /target/myswarmproject-swarm.jar /home/myswarm-swarm.jar
 EXPOSE 8080
 CMD java -jar /home/myswarmproject-swarm.jar

The previous dockerfile example is a swarm wildfly project that deploys as a .jar to a container.

0
source

Here is my implementation also found in adenix / java: 9u181 :

FROM ubuntu:16.04

RUN \
  apt update && \
  apt install -y curl && \
  curl -jkL -H "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/9+181/jdk-9_linux-x64_bin.tar.gz -o jdk-9_linux-x64_bin.tar.gz && \
  apt remove -y curl && \
  apt clean && \
  apt -y autoremove && \
  rm -rf /var/lib/apt/lists/* && \
  tar xvzf jdk-9_linux-x64_bin.tar.gz -C /opt/ && \
  rm -rf jdk-9_linux-x64_bin.tar.gz && \
  update-alternatives --install /usr/bin/java java /opt/jdk-9/bin/java 100 && \
  update-alternatives --install /usr/bin/javac javac /opt/jdk-9/bin/javac 100 && \
  update-alternatives --install /usr/bin/jshell jshell /opt/jdk-9/bin/jshell 100

CMD ["jshell"]

You can implement this by either duplicating this Docker file or using it FROM adenix/java:9u181in your Docker file.

0

Source: https://habr.com/ru/post/1671532/


All Articles