如何在docker debian上安装oracle-java8-installer:jessie [英] How to install oracle-java8-installer on docker debian:jessie

查看:243
本文介绍了如何在docker debian上安装oracle-java8-installer:jessie的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过oracle-java8-installer在debian:jessie docker容器上安装java 8。以下是我的Dockerfile:

I am trying to install java 8 through oracle-java8-installer on a debian:jessie docker container. The following is my Dockerfile:

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

然而这给出了:

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 have found many similar issues described online, but none of the proposed solutions worked for me. Any idea?

推荐答案

请回复donhector的回答和你的问题:你需要替换安装程序文件中的字符串,相反你的最后一个命令:

Re to donhector's response and your question: you need to replace the strings in the installer file, instead of yours last command:

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

运行以下命令:

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

我将它们放在一个单独的脚本中并运行它as

I have them in a separate script and run it as

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

或者您可以直接从Dockerfile运行它们,这取决于您。

or you can run them directly from your Dockerfile, that's up to you.

这篇关于如何在docker debian上安装oracle-java8-installer:jessie的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆