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

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

问题描述

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

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

解决方案

Found the solution on 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

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

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