我正在尝试基于docker://python:3.7-buster
.
在该%post
部分中,当我运行/usr/bin/env python3
不同版本的 python 时,与我singularity exec
使用相同的东西时不同。
这是我的测试定义文件:
$ cat test.def
Bootstrap:docker
From:python:3.7-buster
%post
/usr/bin/env python3 --version
这是我尝试构建它时发生的情况:
$ sudo singularity build test.sif test.def
INFO: Starting build...
Getting image source signatures
Skipping fetch of repeat blob sha256:4a56a430b2bac33260d6449e162017e2b23076c6411a17b46db67f5b84dde2bd
Skipping fetch of repeat blob sha256:4b5cacb629f5c5323a32103e665756e5d50fe133b3db72d444f370566b713a6a
Skipping fetch of repeat blob sha256:14408c8d4f9a59a5da8f4cc40650be9a8d0991fa1ce1b2fb2767f289a9cc410d
Skipping fetch of repeat blob sha256:ea67eaa7dd42136287337f879ef20b4ee73baaa108d833d267ef99dd787cdcbf
Skipping fetch of repeat blob sha256:4d134ac3fe4b8dd8136d9e7acbb2708ead2154185b27c09ae62ca099070cfb27
Skipping fetch of repeat blob sha256:4c55f6f5d7f035e446f063331d9160bb00ed3da4632105ef5adedee3317c902f
Skipping fetch of repeat blob sha256:6ae475e50652d8ee1a2fdeb59ccce81d14c8c20e0fdfe94f22f1c69bd3e3befb
Skipping fetch of repeat blob sha256:6f41526442299286e270923d6cca3a516c3e1850f7e06c3facc0df7da8a5afbc
Skipping fetch of repeat blob sha256:6933d3d4604265f0c8f2a3806222749809c62b6e6a757d1f85720fa81622496d
Copying config sha256:5a5fb77dac35d62c5b062fc35b3b69e61ae68385fb4278ce6076532c3e50e316
7.47 KiB / 7.47 KiB [======================================================] 0s
Writing manifest to image destination
Storing signatures
2019/09/16 11:07:07 info unpack layer: sha256:4a56a430b2bac33260d6449e162017e2b23076c6411a17b46db67f5b84dde2bd
2019/09/16 11:07:09 info unpack layer: sha256:4b5cacb629f5c5323a32103e665756e5d50fe133b3db72d444f370566b713a6a
2019/09/16 11:07:09 info unpack layer: sha256:14408c8d4f9a59a5da8f4cc40650be9a8d0991fa1ce1b2fb2767f289a9cc410d
2019/09/16 11:07:09 info unpack layer: sha256:ea67eaa7dd42136287337f879ef20b4ee73baaa108d833d267ef99dd787cdcbf
2019/09/16 11:07:11 info unpack layer: sha256:4d134ac3fe4b8dd8136d9e7acbb2708ead2154185b27c09ae62ca099070cfb27
2019/09/16 11:07:18 info unpack layer: sha256:4c55f6f5d7f035e446f063331d9160bb00ed3da4632105ef5adedee3317c902f
2019/09/16 11:07:18 info unpack layer: sha256:6ae475e50652d8ee1a2fdeb59ccce81d14c8c20e0fdfe94f22f1c69bd3e3befb
2019/09/16 11:07:19 info unpack layer: sha256:6f41526442299286e270923d6cca3a516c3e1850f7e06c3facc0df7da8a5afbc
2019/09/16 11:07:19 info unpack layer: sha256:6933d3d4604265f0c8f2a3806222749809c62b6e6a757d1f85720fa81622496d
INFO: Running post scriptlet
+ /usr/bin/env python3 --version
Python 3.7.3
INFO: Creating SIF file...
INFO: Build complete: test.sif
使用系统版本而不是 docker 映像提供的版本,这与我exec
使用相同命令时发生的情况形成对比:
$ singularity exec docker://python:3.7-buster /usr/bin/env python3 --version
Python 3.7.4
怎么了?
我尝试使用$(which python3)
代替/usr/bin/env python3
,并且在该部分中它仍然是相同的版本%post
(使用singularity exec
,它是使用的主机系统版本)。
我的目标实际上是能够安装一些我从 git 存储库中提取的个人 python 包,并使用运行的安装脚本进行安装/usr/bin/env python3 -m pip install -e .
我注意到有一个问题,因为 python 3 的系统版本没有包含pip
.