如何为“RUN”命令填写交互式命令的用户输入?

Tro*_*yvs 2 command interactive docker dockerfile

我只是在 docker 映像上尝试 ubuntu:19.04,我希望在映像中安装 tcl,所以我有:

RUN apt update && apt install tcl
Run Code Online (Sandbox Code Playgroud)

然后它会给出一些交互命令:

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   3. Antarctica  5. Arctic  7. Atlantic  9. Indian    11. SystemV  13. Etc
2. America  4. Australia   6. Asia    8. Europe    10. Pacific  12. US
Run Code Online (Sandbox Code Playgroud)

我在这里有两个问题:

(1)如果我在Docker文件中为“RUN”写这个命令,在这里输入一个数字后,“docker build”。似乎被它所吸引。

(2) 我希望我不必手动输入选择,我有什么方法可以在“运行”中输入选择,使其自动化?

dev*_*jbh 25

这对我有用。

ENV TZ=Asia/Kolkata \
    DEBIAN_FRONTEND=noninteractive

RUN apt-get update && \
    apt-get install tzdata
Run Code Online (Sandbox Code Playgroud)


BMW*_*BMW 10

您是否尝试禁用它?

FROM ubuntu:19.04

ENV DEBIAN_FRONTEND noninteractive

RUN apt update && apt install -y tcl
Run Code Online (Sandbox Code Playgroud)

  • _不应该_使用 `ENV` 来设置该值。使用“ARG”执行此操作或将其设置为内联“DEBIAN_FRONTEND=noninteractive apt install -y ...”。请参阅[此问题](https://github.com/moby/moby/issues/4032) (3认同)