docker - 如何在 docker debian :jessie 上安装 oracle-java8-installer

标签 docker java-8 debian debian-jessie

我正在尝试通过 oracle-java8-installer 在 debian:jessie docker 容器上安装 java 8。以下是我的 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

我发现网上描述了许多类似的问题,但没有一个建议的解决方案对我有用。有什么想法吗?

最佳答案

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

你要找的“秘方”是第一行:

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

关于docker - 如何在 docker debian :jessie 上安装 oracle-java8-installer,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48301257/

相关文章:

mysql - 建立数据库连接时出错

linux - linux终端中的随机文本

docker - 在 Visual Studio Code devcontainer 上重建 : keep VSC plugins?

java - 如何在 anyMatch() java 8 流中应用复合 BiPredicate

java 8 获取最大出现次数相等的元素

java - 并行处理多个任务(在 java-8 中)

windows - 如何从现有 WSL bash 窗口启动新的 WSL bash 窗口

python - 带有 aiocache 和 Redis 的 FastAPI 无法设置 databases.backends.postgres.Record 对象

mysql - Apache Mesos、MESOS-DNS、MARATHON 和 Docker

python - 无法通过 Jenkins 声明管道在 Docker 镜像中作为代理进行 pip 安装