4

我正在尝试在 debian jessie docker container 中安装 jdk-8。下面是docker文件

FROM debian:jessie
ENV DEBIAN_FRONTEND noninteractive

RUN \
  echo deb http://http.debian.net/debian jessie-backports main >> /etc/apt/sources.list &&\
apt-get update && apt-get install openjdk-8-jdk &&\
update-alternatives --config java

我收到以下错误

 The following packages have unmet dependencies:openjdk-8-jdk : Depends: openjdk-8-jre (= 8u131-b11-1~bpo8+1) but it is not going to be installed.Depends: openjdk-8-jdk-headless (= 8u131-b11-1~bpo8+1) but it is not going to be installed E: Unable to correct problems, you have held broken packages.The command '/bin/sh -c echo deb http://http.debian.net/debian jessie-backports main >> /etc/apt/sources.list &&  apt-get update && apt-get install openjdk-8-jdk &&  update-alternatives --config java' returned a non-zero code: 100

请让我知道如何解决这个问题。

4

2 回答 2

5

你应该使用下面来安装 jdk

apt-get install -t jessie-backports openjdk-8-jdk
于 2018-07-20T07:09:53.580 回答
0

以下更改对我有用

apt-get -y  update && apt-get install -y -t jessie-backports ca-certificates-java && apt-get -y install openjdk-8-jdk && update-alternatives --config java
于 2018-01-20T08:02:48.817 回答