使用 `apt update` 运行时,Docker 构建在软件属性通用上停止

标签 docker dockerfile

我有 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 )时,构建过程挂起:
enter image description heresoftware-properties-common package 询问我关于地理区域的信息 - 我无法提供任何输入,我想在构建图像时是不允许的。
但是,当我构建第二个 dockerfile 时,不会出现此问题。我很好奇 - 为什么会这样?

最佳答案

在 Dockerfile 中添加以下行并再次构建。

RUN DEBIAN_FRONTEND=noninteractive apt-get install -y tzdata

关于使用 `apt update` 运行时,Docker 构建在软件属性通用上停止,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62994019/

相关文章:

docker - 为什么Docker中会出现 "none"镜像以及我们如何避免它

在 Dockerfile 中使用 SSH 进行 Git 克隆

docker - 如何显示在 Docker 容器中运行的 Python 应用程序的输出?

linux - Docker ENTRYPOINT在卷挂载后运行

dockerfile - wget : unable to resolve host address 'github.com'

docker - 在Kubernetes中使用容器存储/共享数据

docker - 在Docker容器中启动系统服务

docker - 如何在 Azure Devops 发布定义中的 Dockerized Web 应用程序中设置环境变量

docker - 将 xserver 添加到 Docker 容器中(主机是 headless (headless)的)

jenkins - Docker- Jenkins 图像