在Docker容器上无声安装Ubuntu 20.04上的Erlang/Elixir

5

我正在尝试在Ubuntu 20.04 docker镜像上安装Erlang/Elixir,但是我卡在了一个要求选择地理区域的esl-erlang提示框上。我该如何静音或将默认值设置为US

这是我的Docker镜像:

FROM ubuntu:20.04
ENV LANG=en_US.UTF-8

RUN apt-get update -y
RUN apt-get install -y wget gnupg2 inotify-tools locales && \
  locale-gen en_US.UTF-8

RUN wget https://packages.erlang-solutions.com/erlang-solutions_2.0_all.deb && dpkg -i erlang-solutions_2.0_all.deb

RUN apt-get update -y
RUN apt-get install -y esl-erlang 
RUN apt-get install -y elixir


CMD ["/bin/bash"]

这是Docker卡住的提示:

cjsMBP15:ubunutu-elixir cj1$     docker build -t ubuntu-elixir .                           
[+] Building 124.8s (9/11)                                                                                                                                                               
 => [internal] load build definition from Dockerfile                                                                                                                                0.0s
 => => transferring dockerfile: 532B                                                                                                                                                0.0s
 => [internal] load .dockerignore                                                                                                                                                   0.0s
 => => transferring context: 2B                                                                                                                                                     0.0s
 => [internal] load metadata for docker.io/library/ubuntu:20.04                                                                                                                     0.7s
 => [auth] library/ubuntu:pull token for registry-1.docker.io                                                                                                                       0.0s
 => CACHED [1/7] FROM docker.io/library/ubuntu:20.04@sha256:cf31af331f38d1d7158470e095b132acd126a7180a54f263d386da88eb681d93                                                        0.0s
 => CACHED [2/7] RUN apt-get update -y                                                                                                                                              0.0s
 => CACHED [3/7] RUN apt-get install -y wget gnupg2 inotify-tools locales &&   locale-gen en_US.UTF-8                                                                               0.0s
 => CACHED [4/7] RUN wget https://packages.erlang-solutions.com/erlang-solutions_2.0_all.deb && dpkg -i erlang-solutions_2.0_all.deb                                                0.0s
 => CACHED [5/7] RUN apt-get update -y                                                                                                                                              0.0s
 => [6/7] RUN apt-get install -y esl-erlang                                                                                                                                       124.1s
 => => #   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:                                                                                                                                                               

如何关闭 esl-erlang 提示?

1个回答

6
在运行 apt-get install 命令之前,先设置 DEBIAN_FRONTEND=noninteractive
RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install -y ...

或者
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y ...

更新1: 为了增加更多的上下文说明,不是esl-erlang引起的这个问题,而是安装tzdata时出现的提示。

更新2: 如果你不喜欢UTC时间,你可以手动设置你的时区,像这样

sudo ln -s /usr/share/zoneinfo/America/<CITY> /etc/localtime

其中 CITY 是 ls /usr/share/zoneinfo/America/ 中的城市之一。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接