如何避免在 Docker 构建过程中出现问题?

Ole*_*leg 4 ubuntu docker dockerfile

我正在构建一个基于 Ubuntu 18.04 的 Docker 镜像。它正在构建,但在完成之前我在 Powershell 控制台中收到:

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)

据我了解,它在等待我的回答,但我无法输入任何数字,即键盘上没有反应。如何避免这个问题?可能是在我可以在 dockerfile 中添加一个 CMD 吗?

dev*_*jbh 18

这对我有用。

ENV TZ=Asia/Kolkata \
    DEBIAN_FRONTEND=noninteractive

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


Par*_*hah 8

我在 中遇到了同样的问题Dockerfile,然后我ARG DEBIAN_FRONTEND=noninteractive在基本图像之后使用了它,它对我有用 :

示例 Dockerfile:

FROM ubuntu
ARG DEBIAN_FRONTEND=noninteractive
Run Code Online (Sandbox Code Playgroud)