docker java7安装失败

威尔·洛佩兹(Will Lopez):

我正在尝试通过docker映像中的ppa(RUN add-apt-repository ppa:webupd8team / java -y)安装java7,但是由于以下错误而失败:

returned a non-zero code: 127

以下是建议的正确安装方式,但无法正常工作。我也尝试过两种ppas。

RUN  apt-get install python-software-properties -y
RUN  add-apt-repository ppa:webupd8team/java -y
#RUN add-apt-repository ppa:eugenesan/java -y
RUN apt-get update
RUN  apt-get install oracle-java7-installer -y

这是日志输出:

Step 28 : RUN  add-apt-repository ppa:webupd8team/java -y
 ---> Running in b278761a4209
 [91m/bin/sh: 1: add-apt-repository: not found
 [0m 

所以...我需要找出此命令在辅助库中的位置/是否存在:

add-apt-repository

add-apt-repository似乎是python-software-properties安装的一部分。除了在构建的其他区域中弹出的这些消息之外,我在该步骤中没有看到任何实际错误。因此,我假设如果我能解决此问题,则上述python步骤将根据需要安装:

    [91mdebconf: unable to initialize frontend: Dialog
     debconf: (TERM is not set, so the dialog frontend is not usable.)
     debconf: falling back to frontend: Readline
     [0m[91mdebconf: unable to initialize frontend: Readline
     debconf: (This frontend requires a controlling tty.)
     debconf: falling back to frontend: Teletype
     [0m[91mdpkg-preconfigure: unable to re-open stdin: 

所以。如何设置术语或对话框?我以为-y允许这样做

克里斯·麦金尼尔(Chris McKinnel):

-y你的apt-get install命令告诉apt-get“承担起是”,这是不一样的非交互模式下运行。

您会看到“无法初始化前端:对话框”消息,因为Debian apt-get在交互模式下运行要告诉它以非交互方式运行,请将此行添加到Dockerfile的开头:

ENV DEBIAN_FRONTEND noninteractive

现在,您的命令将以非交互模式运行,因此apt-get不会尝试弹出任何对话框。

至于您的实际错误,您是对的,它add-apt-respository是的一部分python-software-properties尝试将apt-get update -y命令放在命令上方apt-get install python-software-properties

RUN apt-get update -y                             && \
    apt-get install python-software-properties -y && \
    add-apt-repository ppa:webupd8team/java -y    && \
    apt-get update -y                             && \
    apt-get install oracle-java7-installer -y     && \
    oracle-java7-set-default

请注意,您需要执行两个apt-get update -y命令,一个在开始之前(总是养成良好的习惯),另一个在添加oracle java PPA之后。

易于使用的手册

Docker ENV文档

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章