Oracle已实施OTN许可证来下载和安装JDK。我的查询是,我们如何在Dockerfile中实现此OTN机制以下载JDK?
以前,我们曾经提到过here中提到的“接受许可证”的内容。
现在,我找不到如何在dockerfile中添加新的OTN许可证信息?
这是我得到的错误:
-2019-06-11 12:30:58-- http://download.oracle.com/otn/java/jdk/8u211-b12/jdk-8u211-linux-x64.rpm 正在解析download.oracle.com(download.oracle.com)... 23.208.140.200 连接到download.oracle.com (download.oracle.com)| 23.208.140.200 |:80 ...已连接。 HTTP请求 已发送,正在等待响应... 302临时移动位置: https://edelivery.oracle.com/akam/otn/java/jdk/8u211-b12/jdk-8u211-linux-x64.rpm
[关注中] --2019-06-11 12:30:58-- https://edelivery.oracle.com/akam/otn/java/jdk/8u211-b12/jdk-8u211-linux-x64.rpm 正在解析edelivery.oracle.com(edelivery.oracle.com)... 23.205.198.52,2600:1404:23:189 :: 366,2600:1404:23:19b :: 366连接到edelivery.oracle.com(edelivery.oracle.com)| 23.205.198.52 |:443 ... 连接的。 HTTP请求已发送,正在等待响应... 302已移动 临时位置: 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 [以下] --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 正在解析login.oracle.com(login.oracle.com)... 156.151.58.18 连接到login.oracle.com (login.oracle.com)| 156.151.58.18 |:443 ...已连接。
dockerfile是:
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}/
答案 0 :(得分:1)
您应该考虑运行另一个OpenJDK发行版。 Oracle已经更改了其运行OracleJDK的条款,您将需要在其中附带付费的OTN订阅才能在商业用例中运行OracleJDK:
https://java.com/en/download/release_notice.jsp
使用AdoptOpenJDK之类的OpenJDK发行版本可以更好地长期服务,这不会迫使您经历处理OTN恶作剧的这些技巧。从功能上讲,AdoptOpenJDK与OracleJDK等效,因为它们是从相同的代码库构建的。我们已经开始使用AdoptOpenJDK,它几乎是一个替代品。