如何修复构建 Docker 镜像时 'Configuring tzdata' 交互式输入
通常,在 Dockerfile 中安装 deb 包时,某些包会将 tzdata 作为依赖安装。
tzdata 安装程序会尝试使用以下内容交互式提示你输入位置
tzdata_docker_fix.txt
Configuring tzdata
------------------
请选择你居住的地理区域。后续配置
问题将通过显示城市列表来缩小范围,这些城市代表
它们所在的时区。
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
地理区域:这将使你的镜像构建停滞。
为了修复此问题,我们需要使 tzdata 提示非交互式。
首选方法是添加
dockerfile_env_debian_frontend.sh
ENV DEBIAN_FRONTEND=noninteractive在 Dockerfile 中第一个 RUN 语句之前。
或者你可以仅使用 DEBIAN_FRONTEND=noninteractive 运行 apt install 或 apt-get install 命令:
dockerfile_run_tzdata.sh
RUN DEBIAN_FRONTEND=noninteractive apt install -y tzdata这将自动为 tzdata 选择默认配置。
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow