Ash*_*orf 5 apt tex-live dockerfile
我正在尝试构建一个 Docker 映像,但它失败了,因为我试图获取的包之一apt install在安装过程中提示用户。我想回复此提示,但我不知道如何以非交互方式进行回复。
我正在构建一个 Docker 映像,我的 Dockerfile 具有以下行:
RUN apt install -y texlive-latex-extra
Run Code Online (Sandbox Code Playgroud)
(这个包有一些我需要的 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:
Run Code Online (Sandbox Code Playgroud)
此时,它正在等待一些输入。(在此之后还有另一个选择时区的提示——我认为这对于\todayLaTeX 文件中的指令很重要。¯\_(?)_/¯)
我如何以非交互方式回答这个问题?
我试过这样做:
apt install -y texlive-latex-extra <(echo 12 && echo 2)
Run Code Online (Sandbox Code Playgroud)
和这个:
echo 12 && echo 2 | apt install -y texlive-latex-extra
Run Code Online (Sandbox Code Playgroud)
第一个死于此错误:
apt install -y texlive-latex-extra <(echo 12 && echo 9)
Run Code Online (Sandbox Code Playgroud)
而第二个似乎没有效果。
作为参考,这是我的 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
Run Code Online (Sandbox Code Playgroud)
我在这里找到了一些接近的东西,它建议apt install使用DEBIAN_FRONTEND=noninteractive. 这足以解决我的问题。:)但是,我还是想知道如何响应提示,因为那里提供的解决方案只提供了如何抑制它们。
如果您想编写终端交互脚本,您可以在 Linux 上使用Expect(这可能不是很容易;您需要预测交互)。
请记住,终端仿真器是复杂且神秘的东西(因为像VT100这样的终端非常复杂)。请参阅termios(3)、pty(7)并阅读The Tty demystified。
| 归档时间: |
|
| 查看次数: |
3461 次 |
| 最近记录: |