使用容器环境变量绑定奇异性的路径
我有一个用 Scientific Filesystem )应用程序。 我以奇异性运行-App MyApp image.sif
运行容器,因此,我有环境变量scif_appdata =/scif/scif/data/myapp
在容器中设置。
我想使用此环境变量绑定路径。类似:
singularity run -B /my/path/on/host/:$SCIF_APPDATA/input/
不幸的是这不起作用。我没有设法将奇点用作安装路径,其“内部”值的环境变量。
我必须明确传递环境变量的值:
singularity run -B /my/path/on/host/:/scif/data/myapp/input
是否有人知道如何在绑定路径中使用容器环境变量?
I have a singularity container built with a scientific filesystem app.
I run the container with singularity run --app myapp image.sif
and, accordingly, I have the environment variable SCIF_APPDATA=/scif/data/myapp
set inside the container.
I'd like to bind a path using this environment variable. Something like:
singularity run -B /my/path/on/host/:$SCIF_APPDATA/input/
Unfortunately this does not work. I didn't manage to make singularity use as a mount path the environment variable with its "internal" value.
I have to explicitly pass the value of the environment variable:
singularity run -B /my/path/on/host/:/scif/data/myapp/input
Does anybody know how to use container environment variables in bind paths?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为不可能在绑定语句中直接使用来自容器内部的环境变量。但是,您可以分两个步骤执行此操作,首先调用
singularity exec
以获取变量的值,然后将其与sickularity Run
不要忘记后斜手逃避回声命令中的$。
注意:不确定为什么,但是当我直接使用
echo
时,它对我不起作用,因此用bash -c
包装。I don't think it is possible to directly use environment variables from inside the container in the bind statement. However, you can do it in two steps, first a call to
singularity exec
to get the value of the variable, then use it withsingularity run
:Don't forget the backslash to escape the $ in the echo command.
Note: Not sure why but it doesn't work for me when I directly use
echo
, hence the wrapping withbash -c
.