Search code examples
javadockerdebiandebian-jessie

Docker: How to install OpenJDK JRE 12 on top of Debian jessie-slim?


I am trying to install OpenJDK JRE 12 on top of debian:jessie-slim image.

In the end, I need to install the openjdk-12-jre-headless package. However, I am getting:

E: The value 'openjdk-12-jre-headless' is invalid for APT::Default-Release as such a release is not available in the sources

I have tried different options, but it looks like I am doing something wrong.

My Dockerfile is quite complex, but the issue is reproducible with this one:

FROM debian:jessie-slim
RUN apt-get install -y --target-release openjdk-12-jre-headless

Solution

  • Okay I managed to install this jre distribution on image that you provided with given Dockerfile :

    FROM debian:jessie-slim
    RUN apt-get update && \
     apt-get -y upgrade && \
     echo 'deb http://ftp.de.debian.org/debian sid main' >> '/etc/apt/sources.list' && \
     apt-get -y update && \
     mkdir -p /usr/share/man/man1 && \
     apt-get -y install openjdk-12-jre-headless
    
    

    I had to add repository from here to /etc/apt/sources.list file. This is for amd64 jre distribution so if you want a different one just check the bottom of this page and add mirror for the version you want, like I did in my Dockerfile. Additionaly I had to create folder /usr/share/man/man1 because of this bug.

    Finally I run the container with this image and checked java version :

    openjdk version "12.0.1" 2019-04-16
    OpenJDK Runtime Environment (build 12.0.1+12-Debian-1)
    OpenJDK 64-Bit Server VM (build 12.0.1+12-Debian-1, mixed mode, sharing)
    

    Hope this helps :)