1
votes

Oracle has implemented the OTN license to download and install the JDK. my query is , how we can implement this OTN mechanism in Dockerfile to download the JDK ?

previously, we used to have the "accept license" stuff mentioned here .

now, i am not able to find , how to add new OTN license info in dockerfile ?

this is the error i am getting :

--2019-06-11 12:30:58-- http://download.oracle.com/otn/java/jdk/8u211-b12/jdk-8u211-linux-x64.rpm Resolving download.oracle.com (download.oracle.com)... 23.208.140.200 Connecting to download.oracle.com (download.oracle.com)|23.208.140.200|:80... connected. HTTP request sent, awaiting response... 302 Moved Temporarily Location: https://edelivery.oracle.com/akam/otn/java/jdk/8u211-b12/jdk-8u211-linux-x64.rpm

[following] --2019-06-11 12:30:58-- https://edelivery.oracle.com/akam/otn/java/jdk/8u211-b12/jdk-8u211-linux-x64.rpm Resolving edelivery.oracle.com (edelivery.oracle.com)... 23.205.198.52, 2600:1404:23:189::366, 2600:1404:23:19b::366 Connecting to edelivery.oracle.com (edelivery.oracle.com)|23.205.198.52|:443... connected. HTTP request sent, awaiting response... 302 Moved Temporarily Location: https://login.oracle.com:443/oam/server/obrareq.cgi?encquery%3DnUf9lWZl8SXSVIuOAyrI0TMo%2FOmAILRpxAofH%2BuBpv9eLV8YAdmEENk4cpEEIImSh7%2Bz224paFAZbie%2Fs1G8v1157ZE%2Bu2uxUGSWVspQAhHciZMHwa14qSBmDSwNil7kYFwExQGzckmavRmezYC6TLpvGEkhNVmXvyYgOc7swj29yTyU%2BdsfeP8BKM0jYDvIA4v93DLoqDgUWZf0TmJCBpQwF8yS%2Bgd3tCm0YZrPlv4xIxbyYKGoTuv%2BOfF8NGCd2wUjmBHLjWG%2B65tXWryc3ybPI1tRbeZWOpPSeW%2BYlqv4s0HMSU8JBWLJBWY6lxP43E6EtI7JfkK%2BEAx%2FmawJtSWhpV8d%2BfekFMirQeOGe8QnFZWeozekGSOHmZmr3yYQOd3SAc3KTDk6SnJFl9p9E3a2BXK64EOIwdL7uYi%2FGzo08wiyBEncFiN5lVCpf4BX%20agentid%3Dedelivery-extprod%20ver%3D1%20crmethod%3D2%26cksum%3Dc92be7b91c2e259453c6fbf83efbd92c66fa451a&ECID-Context=1.005Ykhs7qOT7a6KaETu1US0004sd00063H%3BkXjE [following] --2019-06-11 12:30:58-- https://login.oracle.com/oam/server/obrareq.cgi?encquery%3DnUf9lWZl8SXSVIuOAyrI0TMo%2FOmAILRpxAofH%2BuBpv9eLV8YAdmEENk4cpEEIImSh7%2Bz224paFAZbie%2Fs1G8v1157ZE%2Bu2uxUGSWVspQAhHciZMHwa14qSBmDSwNil7kYFwExQGzckmavRmezYC6TLpvGEkhNVmXvyYgOc7swj29yTyU%2BdsfeP8BKM0jYDvIA4v93DLoqDgUWZf0TmJCBpQwF8yS%2Bgd3tCm0YZrPlv4xIxbyYKGoTuv%2BOfF8NGCd2wUjmBHLjWG%2B65tXWryc3ybPI1tRbeZWOpPSeW%2BYlqv4s0HMSU8JBWLJBWY6lxP43E6EtI7JfkK%2BEAx%2FmawJtSWhpV8d%2BfekFMirQeOGe8QnFZWeozekGSOHmZmr3yYQOd3SAc3KTDk6SnJFl9p9E3a2BXK64EOIwdL7uYi%2FGzo08wiyBEncFiN5lVCpf4BX%20agentid%3Dedelivery-extprod%20ver%3D1%20crmethod%3D2%26cksum%3Dc92be7b91c2e259453c6fbf83efbd92c66fa451a&ECID-Context=1.005Ykhs7qOT7a6KaETu1US0004sd00063H%3BkXjE Resolving login.oracle.com (login.oracle.com)... 156.151.58.18 Connecting to login.oracle.com (login.oracle.com)|156.151.58.18|:443... connected.

dockerfile is :

FROM    centos

ENV UPDATE_VERSION=8u73
ENV JAVA_VERSION=1.8.0_73
ENV BUILD=b02

RUN yum -y update && \
    yum -y install wget && \
    wget -c --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/${UPDATE_VERSION}-${BUILD}/jdk-${UPDATE_VERSION}-linux-x64.rpm" --output-document="jdk-${UPDATE_VERSION}-linux-x64.rpm" && \
    rpm -i jdk-${UPDATE_VERSION}-linux-x64.rpm && \
    alternatives --install /usr/bin/java java /usr/java/jdk${JAVA_VERSION}/bin/java 1 && \
    alternatives --set java /usr/java/jdk${JAVA_VERSION}/bin/java && \
    export JAVA_HOME=/usr/java/jdk${JAVA_VERSION}/ && \
    echo "export JAVA_HOME=/usr/java/jdk${JAVA_VERSION}/" | tee /etc/environment && \
    source /etc/environment && \
    rm jdk-${UPDATE_VERSION}-linux-x64.rpm

ENV JAVA_HOME=/usr/java/jdk${JAVA_VERSION}/
1
The simplest option, and what I've seen done, is to download the JDK manually and upload it to a server / service you control.Augusto

1 Answers

1
votes

You should consider running another OpenJDK distribution instead. Oracle has changed its terms on running OracleJDK and you will need a paid OTN subscription in place with them in order to run OracleJDK for commercial use cases:

https://java.com/en/download/release_notice.jsp

You'd be better served long term using an OpenJDK distribution like AdoptOpenJDK, which doesn't force you to go through these gymnastics of dealing with the OTN shenanigans. Functionally, AdoptOpenJDK is equivalent to OracleJDK as they are built from the same codebase. We have started using AdoptOpenJDK and it's been pretty much a drop-in replacement.