为了账号安全,请及时绑定邮箱和手机立即绑定

从现有 docker 镜像扩展 Singularity 镜像的问题

从现有 docker 镜像扩展 Singularity 镜像的问题

30秒到达战场 2023-06-27 16:12:55
我尝试使用我的定义文件扩展pytorch docker 映像nnunet.def:Bootstrap: dockerFrom: pytorch/pytorch:1.4-cuda10.1-cudnn7-runtime%post    git clone https://github.com/NVIDIA/apex    cd apex    pip install -v --no-cache-dir ./%runscript    echo "Running nnunet container..."但是,当我构建此图像(使用sudo singularity build image.sif nnunet.def)时,我收到一条错误消息,指出未找到 pip:...+ pip install -v --no-cache-dir .//.build-script-post: 6: /.build-script-post: pip: not foundFATAL:   failed to execute %post proc: exit status 127FATAL:   While performing build: while running engine: while running /usr/local/libexec/singularity/bin/starter: exit status 255为什么?更令人惊讶的是,当我直接从这张图片进入 shell 时: singularity shell docker://pytorch/pytorch:1.4-cuda10.1-cudnn7-runtime我使用 pip 没有问题:Singularity> pip freezeasn1crypto==1.2.0backcall==0.1.0...为什么我不能在%post定义文件的部分中使用 pip?
查看完整描述

1 回答

?
呼啦一阵风

TA贡献1802条经验 获得超6个赞

$PATH简短的回答: in的值%post与您在 shell 中运行时不同,因此它不知道去哪里查找。

如果您查看 pipwhich pip在 docker 或奇异点映像中的位置 ( ),您会发现它位于/opt/conda/bin/pip。使用的默认路径%post/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin.

当您看到一条错误,指出命令在作为脚本的一部分运行时不可用,但在交互运行时却可用,这几乎总是环境问题,而 、 、 等PATHPYTHONPATH常见PERL5LIB的罪魁祸首。

如果您添加export PATH=/opt/conda/bin:$PATH到块的开头,%post它应该可以解决这个问题。


查看完整回答
反对 回复 2023-06-27
  • 1 回答
  • 0 关注
  • 117 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信