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

How to fill user input for interactive command for "RUN" command?

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

RUN apt update && apt install tcl

然后会给出一些交互指令:

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

我这里有 2 个问题:

(1) 如果我在 Docker 文件中为 "RUN" 编写此命令,在此处输入数字后,"docker build ." 似乎被挂起。

(2) 我希望我不必手动输入选择,我有什么办法可以在 "RUN" 中提供选择以便它自动进行吗?

您尝试过禁用它吗?

FROM ubuntu:19.04

ENV DEBIAN_FRONTEND noninteractive

RUN apt update && apt install -y tcl

这对我有用。

ENV TZ=Asia/Kolkata \
    DEBIAN_FRONTEND=noninteractive

RUN apt-get update && \
    apt-get install tzdata