【问题标题】:The command '/bin/sh -c apt-get install dnsutils' returned a non-zero code: 1命令“/bin/sh -c apt-get install dnsutils”返回非零代码:1
【发布时间】:2019-10-09 17:23:05
【问题描述】:

尝试在 docker 构建期间安装 dnsutils。

Dockerfile:

# Dockerfile - this is a comment. Delete me if you want.

FROM python:2.7

COPY . /app

WORKDIR /app

RUN pip install -r requirements.txt

RUN apt-get update

RUN apt-get install dnsutils

CMD ["python","unitTest.py"]

输出:

Do you want to continue? [Y/n] Abort.

The command `/bin/sh -c apt-get install dnsutils` returned a non-zero code: 1

如何在镜像中安装dig而不出现上述错误?

【问题讨论】:

    标签: docker


    【解决方案1】:

    添加 -y 使其自动接受并保持非交互 -

    RUN apt-get install -y dnsutils
    

    【讨论】:

      【解决方案2】:

      有些包在安装时会要求确认。

      这就是为什么你会得到:“你想继续吗?[Y/n] Abort”

      将“-y”添加到apt-get install:

      RUN apt-get install dnsutils -y
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2019-02-02
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2021-03-19
        相关资源
        最近更新 更多