我想在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
但是给我这个错误```正在阅读包装 list ...
正在建立依存关系树...
正在读取状态信息...
软件包oracle-java8-installer不可用,但由另一个软件包引用。
这可能意味着包裹丢失,已被废弃或
仅可从其他来源获得
E:软件包'oracle-java8-installer'没有安装候选对象```
最佳答案
Docker Hub中有一个Ubuntu + java8的镜像。
因此可以使用此存储库(enter link description here)
关于java - E:软件包 'oracle-java8-installer'在Docker Ubuntu中没有安装候选对象,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/55887686/