概要
我正在尝试构建 Docker 映像,但它失败了,因为我尝试使用的其中一个软件包apt install
在安装过程中提示用户。我想回复这个提示,但我不知道如何以非交互方式进行。
描述
我正在构建一个 Docker 映像,并且我的 Dockerfile 具有以下行:
RUN apt install -y texlive-latex-extra
(这个包有一些我需要的 LaTeX 库。)
在安装过程中,这会停止:
Setting up tzdata (2018d-1) ...
debconf: unable to initialize frontend: Dialog
debconf: (TERM is not set, so the dialog frontend is not usable.)
debconf: falling back to frontend: Readline
Configuring tzdata
------------------
Please select the geographic area in which you live. Subsequent configuration
questions will narrow this down by presenting a list of cities, representing
the time zones in which they are located.
1. Africa 6. Asia 11. System V timezones
2. America 7. Atlantic Ocean 12. US
3. Antarctica 8. Europe 13. None of the above
4. Australia 9. Indian Ocean
5. Arctic Ocean 10. Pacific Ocean
Geographic area:
此时,它正在等待一些输入。(在此之后还有另一个选择时区的提示——我认为这对于\today
LaTeX 文件中的指令很重要。¯\_(ツ)_/¯)
我如何以非交互方式回答这个问题?
到目前为止我尝试过的
我试过这样做:
apt install -y texlive-latex-extra <(echo 12 && echo 2)
和这个:
echo 12 && echo 2 | apt install -y texlive-latex-extra
第一个死于此错误:
apt install -y texlive-latex-extra <(echo 12 && echo 9)
第二个似乎没有效果。
作为参考,到目前为止,这是我的 Dockerfile:
FROM ubuntu:latest
RUN apt update && apt upgrade -y && apt install -y curl bzip2 tar make gcc wget gnupg unzip
RUN apt install -y texlive
RUN apt install -y nodejs npm git
RUN npm install -g bower
RUN apt install -y texlive-latex-extra
更新
我在这里找到了一些建议apt install
使用DEBIAN_FRONTEND=noninteractive
. 这充分解决了我的问题。:)但是,我仍然想知道如何响应提示,因为那里提供的解决方案只提供了如何抑制它们。