我有 2 个 dockerfile:
FROM ubuntu:20.04
RUN apt-get update && apt-get install -y \
software-properties-common \
python3
FROM ubuntu:20.04
RUN apt-get update
RUN apt-get install -y software-properties-common
RUN apt-get update && apt-get install -y \
python3
问题是:当我运行第一个(使用 docker build
)时,构建过程挂起:software-properties-common
package 询问我关于地理区域的信息 - 我无法提供任何输入,我想在构建图像时是不允许的。但是,当我构建第二个 dockerfile 时,不会出现此问题。我很好奇 - 为什么会这样?
最佳答案
在 Dockerfile 中添加以下行并再次构建。
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y tzdata
关于使用 `apt update` 运行时,Docker 构建在软件属性通用上停止,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62994019/