Docker 构建等待用户输入

Ore*_*lom 0 python docker dockerfile ubuntu-20.04

我正在尝试从 docker 上的源代码构建 python。我正在从这里准备依赖项1

$ type .\Dockerfile_07_python.txt
##############
#            #
# image name #
#            #
##############
FROM ubuntu:20.04

#################
#               #
# apt-get stuff #
#               #
#################
RUN \
apt-get update -y && \
apt-get install build-essential -y && \
apt-get install gdb -y
Run Code Online (Sandbox Code Playgroud)

显然,docker 构建被卡住了,因为它等待一些关于我的位置的奇怪(?)用户输入(??):

$ docker build --tag host --file .\Dockerfile_07_python.txt .
 => [2/2] RUN apt-get update -y && apt-get install build-essential -y && apt-get install gdb -y         225.5s
 => => # questions will narrow this down by presenting a list of cities, representing
 => => # the time zones in which they are located.
 => => #   1. Africa      4. Australia  7. Atlantic  10. Pacific  13. Etc
 => => #   2. America     5. Arctic     8. Europe    11. SystemV
 => => #   3. Antarctica  6. Asia       9. Indian    12. US
 => => # Geographic area:
Run Code Online (Sandbox Code Playgroud)

1请注意,实际的依赖项列表要长得多,这是触发此行为的最小依赖项列表

Han*_*ian 5

您可以将环境变量 DEBIAN_FRONTEND 设置为“noninteractive”,apt-get 不会提示您。像这样

##############
#            #
# image name #
#            #
##############
FROM ubuntu:20.04

#################
#               #
# apt-get stuff #
#               #
#################
RUN \
apt-get update -y && \
apt-get install build-essential -y && \
DEBIAN_FRONTEND=noninteractive apt-get install gdb -y
Run Code Online (Sandbox Code Playgroud)