【问题标题】:How to fill user input for interactive command for "RUN" command?如何为“RUN”命令填充交互式命令的用户输入?
【发布时间】:2020-04-28 18:14:33
【问题描述】:

我只是在 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

我有两个问题:

(1) 如果我在 Docker 文件中为“RUN”编写此命令,在此处输入一个数字后,“docker build”。似乎被它挂了。

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

【问题讨论】:

    标签: docker command dockerfile interactive


    【解决方案1】:

    这对我有用。

    ENV TZ=Asia/Kolkata \
        DEBIAN_FRONTEND=noninteractive
    
    RUN apt-get update && \
        apt-get install tzdata
    

    【讨论】:

      【解决方案2】:

      您是否尝试禁用它?

      FROM ubuntu:19.04
      
      ENV DEBIAN_FRONTEND noninteractive
      
      RUN apt update && apt install -y tcl
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2020-05-16
        • 1970-01-01
        • 2014-08-26
        • 2014-05-08
        • 2021-09-16
        • 1970-01-01
        • 2013-12-20
        • 1970-01-01
        相关资源
        最近更新 更多