如何使Singularity在构建过程中接受命令行输入



我使用奇点从NVIDIA NGC检索到以下Docker映像:https://ngc.nvidia.com/catalog/containers/nvidia:cuda.
我已经提取了标签"11.1-cudnn8-devel-ubuntu18.04",如下所示:

singularity pull docker://nvcr.io/nvidia/cuda:11.1-cudnn8-devel-ubuntu18.04

然后,此图像在本地以"cuda_11.1-cudnn8-devel-ubuntu18.04.sif"的形式提供。
然后,我尝试根据以下定义文件,使用一些构建工具和一些Python来增强此图像:

Bootstrap: localimage
From: cuda_11.1-cudnn8-devel-ubuntu18.04.sif
%post
apt-get update && apt-get install -y libopenmpi-dev make gcc pkg-config g++ python3 python3-sklearn python3-requests python3-bs4 python3-urllib3

如下:

singularity build --force --fakeroot cuda_11.1-cudnn8-python-devel-ubuntu18.04.sif cuda-python.def

在图像中安装tzdata期间,它要求用户输入以确定我的时区:

Setting up tzdata (2020a-0ubuntu0.18.04) ...
debconf: unable to initialize frontend: Dialog
debconf: (No usable dialog-like program is installed, so the dialog based frontend cannot be used. at /usr/share/perl5/Debconf/FrontEnd/Dialog.pm line 76.)
debconf: falling back to frontend: Readline
Configuring tzdata
------------------
Please select the geographic area in which you live. Subsequent configuration
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: 8

这将暂停构建过程,即使我键入8并按ENTER,也不会发生任何事情
似乎奇点没有提供适当的";"穿孔";用于普通命令行输入。我该怎么解决这个问题?

显然,这是经验丰富的Docker/Singularity用户中众所周知的问题。事实证明,我可以通过在%post脚本的开头设置来解决这个问题

export DEBIAN_FRONTEND=noninteractive

并以结尾

unset DEBIAN_FRONTEND

我不确定tzdata最终是如何配置的,但在这种情况下,这对我来说并不那么重要。

最新更新