How to add Java 11 on Dockerfile

hariszaf :

I am trying to make a Dockerfile where Java11 has to be "loaded".

However, when I try:

RUN add-apt-repository -y ppa:linuxuprising/java 

then I get this error:

/bin/sh: 1: add-apt-repository: not found The command '/bin/sh -c add-apt-repository -y ppa:linuxuprising/java' returned a non-zero code: 127

My question is how could I "install" Java11 on Docker?

Gonzalo Matheu :

Assuming that is not possible to base your image on a OpenJDK official image.

Take a look to how it is installed in the official image Dockerfile.

There are also alternatives images, like AdoptOpenJDK (Dockerfile based on Ubuntu)

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=115006&siteId=1