Docker构建等待用户输入



我正在尝试从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

显然,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:

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

您可以将环境变量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

最新更新