在 Dockerfile 中如何回答选项
In Dockerfile how to answer option
我需要从 Dockerfile 创建一个 docker 图像。我的 Dockerfile 示例如下。
FROM ubuntu:20.04
......
..........
..............
RUN apt install -y aptitude
RUN sh -c '/bin/echo -e "n\ny\ny" | aptitude -f install python-dev'
错误:
Do you want to continue? [Y/n/?] Abort.
The command '/bin/sh -c sh -c '/bin/echo -e "n\ny\ny" | aptitude -f install python-dev'' returned a non-zero code: 1
通过 docker 文件,我什至尝试了以下内容。但是还是没有成功。
ARG DEBIAN_FRONTEND=noninteractive
RUN apt update && DEBIAN_FRONTEND=noninteractive aptitude -f install python-dev
错误:
Do you want to continue? [Y/n/?] n (stdin unavailable)
Abort.
The command '/bin/sh -c apt update && DEBIAN_FRONTEND=noninteractive aptitude -f install python-dev' returned a non-zero code: 1
我的应用程序代码编译有各种依赖性,在 docker 容器中手动安装,我可以使用 aptitude -f install python-dev
包安装,没有任何问题。在安装过程中,我需要回答如下安装问题。
aptitude -f install python-dev
no
yes
yes
请给我通过docker文件回答yes and No
个问题的解决方案。提前致谢。
您可以使用 -y
选项静默接受安装程序提示:
RUN sh -c '/bin/echo -e "n\ny\ny" | aptitude -y -f install python-dev'
来自aptitude --help
:
-y Assume that the answer to simple yes/no questions is 'yes'.
我需要从 Dockerfile 创建一个 docker 图像。我的 Dockerfile 示例如下。
FROM ubuntu:20.04
......
..........
..............
RUN apt install -y aptitude
RUN sh -c '/bin/echo -e "n\ny\ny" | aptitude -f install python-dev'
错误:
Do you want to continue? [Y/n/?] Abort.
The command '/bin/sh -c sh -c '/bin/echo -e "n\ny\ny" | aptitude -f install python-dev'' returned a non-zero code: 1
通过 docker 文件,我什至尝试了以下内容。但是还是没有成功。
ARG DEBIAN_FRONTEND=noninteractive
RUN apt update && DEBIAN_FRONTEND=noninteractive aptitude -f install python-dev
错误:
Do you want to continue? [Y/n/?] n (stdin unavailable)
Abort.
The command '/bin/sh -c apt update && DEBIAN_FRONTEND=noninteractive aptitude -f install python-dev' returned a non-zero code: 1
我的应用程序代码编译有各种依赖性,在 docker 容器中手动安装,我可以使用 aptitude -f install python-dev
包安装,没有任何问题。在安装过程中,我需要回答如下安装问题。
aptitude -f install python-dev
no
yes
yes
请给我通过docker文件回答yes and No
个问题的解决方案。提前致谢。
您可以使用 -y
选项静默接受安装程序提示:
RUN sh -c '/bin/echo -e "n\ny\ny" | aptitude -y -f install python-dev'
来自aptitude --help
:
-y Assume that the answer to simple yes/no questions is 'yes'.