首页 > 解决方案 > 命令“/bin/sh -c apt-get install dnsutils”返回非零代码:1

问题描述

尝试在 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

解决方案


添加-y它以自动接受并保持非交互 -

RUN apt-get install -y dnsutils

推荐阅读