How to install oracle-java8-installer on docker debian: jessie

I am trying to install java 8 via oracle-java8-installer on a debian container: jessie docker. Below is my Docker file:

FROM debian:jessie ENV JAVA_VERSION 1.8.0 RUN echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" > /etc/apt/sources.list.d/webupd8team-java.list RUN echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" >> /etc/apt/sources.list.d/webupd8team-java.list RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886 RUN echo "debconf shared/accepted-oracle-license-v1-1 select true" | /usr/bin/debconf-set-selections RUN apt-get update RUN apt-get install -y --force-yes vim RUN apt-get install -y --force-yes oracle-java8-installer 

However, this gives:

 Connecting to download.oracle.com (download.oracle.com)|23.63.224.171|:80... connected. HTTP request sent, awaiting response... 404 Not Found 2018-01-17 12:31:05 ERROR 404: Not Found. download failed Oracle JDK 8 is NOT installed. dpkg: error processing package oracle-java8-installer (--configure): subprocess installed post-installation script returned error exit status 1 Errors were encountered while processing: oracle-java8-installer E: Sub-process /usr/bin/dpkg returned an error code (1) The command '/bin/sh -c apt-get install -y --force-yes oracle-java8-installer' returned a non-zero code: 100 

I found many similar problems described online, but none of the suggested solutions worked for me. Any idea?

+11
source share
5 answers

Found a solution at https://hub.docker.com/r/anapsix/docker-oracle-java8/~/dockerfile/ :

 ## JAVA INSTALLATION RUN echo "oracle-java8-installer shared/accepted-oracle-license-v1-1 select true" | debconf-set-selections RUN echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" > /etc/apt/sources.list.d/webupd8team-java-trusty.list RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EEA14886 RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --force-yes --no-install-recommends oracle-java8-installer && apt-get clean all 

The "secret sauce" you were looking for is the first line:

 RUN echo "oracle-java8-installer shared/accepted-oracle-license-v1-1 select true" | debconf-set-selections 
+8
source

Repeat the answer and your question: you need to replace the lines in the installer file, instead of your last command:

 apt-get install -y --force-yes oracle-java8-installer 

run the following commands:

 apt-get -y install oracle-java8-installer || true cd /var/lib/dpkg/info sed -i 's|JAVA_VERSION=8u151|JAVA_VERSION=8u162|' oracle-java8-installer.* sed -i 's|PARTNER_URL=http://download.oracle.com/otn-pub/java/jdk/8u151-b12/e758a0de34e24606bca991d704f6dcbf/|PARTNER_URL=http://download.oracle.com/otn-pub/java/jdk/8u162-b12/0da788060d494f5095bf8624735fa2f1/|' oracle-java8-installer.* sed -i 's|SHA256SUM_TGZ="c78200ce409367b296ec39be4427f020e2c585470c4eed01021feada576f027f"|SHA256SUM_TGZ="68ec82d47fd9c2b8eb84225b6db398a72008285fafc98631b1ff8d2229680257"|' oracle-java8-installer.* sed -i 's|J_DIR=jdk1.8.0_151|J_DIR=jdk1.8.0_162|' oracle-java8-installer.* apt-get install -f -y apt-get install -y oracle-java8-set-default 

I have them in a separate script and run it as

 RUN /bin/sh /path/to/script.sh 

or you can run them directly from your Docker file, what you need.

+7
source

You are installing from the PPP repository webupd8. If you notice, the Java 8 package in this repo points to Java 8 version 151 . This package pulls the binary for 151 from Oracle servers (since the Oracle Java license does not allow anyone else to host binary files). Oracle released version 161 couple of days ago and apparently moved or removed 151 from its servers. So basically the package in the webupd8 PPA repository tries to download the binary 151 , which no longer exists in the location that the webupd8 package is waiting for (therefore, you have 404). The webupd8 PPA repository developer will have to release a new package pointing to Oracle's new 161 binaries. Docker or Debian do not play any role in this matter, it is simply a problem with broken communication.

Until then, you can apply the "workaround" as mentioned here: JDK 8 NOT installed - ERROR 404: Not found

Here is a list of Java packages in the webupd8 repository:

https://launchpad.net/~webupd8team/+archive/ubuntu/java/+packages

+5
source

See dpkg oracle Jdk when installing cassandra on Ubuntu 16.04 . This problem occurs for anyone who uses installation scripts of any type.

+2
source

** Java 11:

 RUN apt-get install wget java-common gnupg2 -y 

RUN echo "oracle-java11-installer shared / accept-oracle-license-v1-2 select true" | debconf-set-selections RUN echo "deb http://ppa.launchpad.net/linuxuprising/java/ubuntu bionic main" | tee / etc / apt / sources.list.d / linuxuprising-java.list RUN apt-key adv --keyserver hkp: //keyserver.ubuntu.com: 80 --recv-keys 73C3DB2A RUN apt-get update && DEBIAN_FRONTEND = non-interactive apt-get install -y --no-install-recommends oracle-java11-installer && apt-get clean all

0
source

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


All Articles