E:软件包“ oracle-java8-installer”在Docker Ubuntu中没有安装候选对象

时间:2019-04-28 06:39:10

标签: java docker ubuntu dockerfile

我想在docker上的Ubuntu映像中安装java8。所以我在dockerfile中插入了以下代码:

FROM ubuntu:latest
RUN  apt-get update 
CMD ["echo", "apt-get update done ..."]
RUN apt-get -qq install -y wget
CMD ["echo", "wget Done ..."]
RUN apt-get install -y software-properties-common 
CMD ["echo","apt-get install -y software-properties-common"]
RUN add-apt-repository -y ppa:webupd8team/java 
CMD ["echo","add-apt-repository. ..."]
RUN  apt-get update 
RUN  apt-get -qq upgrade
CMD ["echo", "apt-get update done ..."]
# add webupd8 repository
RUN \
    wget https://download.docker.com/linux/ubuntu/gpg && \
    apt-key add gpg &&\
    apt-get update  &&\
    echo "===> add webupd8 repository..."  && \
    echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" | tee /etc/apt/sources.list.d/webupd8team-java.list  && \
    echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" | tee -a /etc/apt/sources.list.d/webupd8team-java.list  && \
    apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886  && \
    apt-get update
RUN echo "===> install Java"  && \
  apt-get -qq upgrade && \
  echo debconf shared/accepted-oracle-license-v1-1 select true | debconf-set-selections  && \
  echo debconf shared/accepted-oracle-license-v1-1 seen true | debconf-set-selections  && \
   apt-get update &&\
  DEBIAN_FRONTEND=noninteractive  apt-get install -f oracle-java8-installer


但是给我这个错误```正在阅读软件包清单... 正在建立依存关系树... 正在读取状态信息... 软件包oracle-java8-installer不可用,但由另一个软件包引用。 这可能意味着包裹丢失,已被废弃或 只能从其他来源获得

E:软件包“ oracle-java8-installer”没有安装候选对象“''

1 个答案:

答案 0 :(得分:0)

在Docker Hub中有一个Ubuntu + java8的映像。 因此可以使用此存储库(enter link description here