隐藏页面特效

Singularity容器

"""参考文档 https://apptainer.org/user-docs/master/build_a_container.html """ # 通过文件构建容器,相当于docker的Dockerfile ## 创建一个Singularity文件 >>> vim Singularity Bootstrap: docker """ 其中Bootstrap可以是: shub(images hosted on Singularity Hub). docker(images hosted on Docker Hub). localimage(images saved on your machine). yum(yum based systemd such as Centos and Scientific Linux)等 """ From: ubuntu:18.04 Stage: build %setup """ 在构建过程中,该%setup部分中的命令首先在安装基本操作系统后在容器外的主机系统上执行,可以在该部分中使用$SINGULARITY_ROOTFS环境变量引用容器文件系统 """ touch /file1 touch ${SINGULARITY_ROOTFS}/file2 %files """ 允许您将文件复制到容器中,比使用该%setup部分更安全 """ /file1 /file1 /opt %environment """ 允许您定义将在运行时设置的环境变量 """ export LISTEN_PORT=12345 export LC_ALL=C %post """ 你可以使用git和wget等工具从互联网上下载文件,安装新的软件和库,编写配置文件,创建新的目录等。类似于dockerfile中的Run """ apt-get update && apt-get install -y netcat NOW=`date` echo "export NOW=\"${NOW}\"" >> $SINGULARITY_ENVIRONMENT %runscript """ 容器运行时执行命令 """ echo "Container was created $NOW" echo "Arguments received: $*" exec echo "$@" %startscript """ 容器启动时运行的命令 """ nc -lp $LISTEN_PORT %test """ 在构建过程的最后运行,以使用您选择的方法验证容器 """ grep -q NAME=\"Ubuntu\" /etc/os-release if [ $? -eq 0 ]; then echo "Container base is Ubuntu as expected." else echo "Container base is not Ubuntu." exit 1 fi %labels """ 用于将元数据添加到/.singularity.d/labels.json容器内的文件中。 """ Author d@sylabs.io Version v0.0.1 %help """ 该部分中的任何文本%help都会被转录到容器中的元数据文件中。然后可以使用run-help命令显示此文本 """ This is a demo container used to illustrate a def file that uses all supported sections. # 构建镜像 >>> singularity build ubuntu-test.image Singularity # 运行容器 >>> singularity run ubuntu-test.image

__EOF__

本文作者404 Not Found
本文链接https://www.cnblogs.com/weiweivip666/p/15899897.html
关于博主:可能又在睡觉
版权声明:转载请注明出处
声援博主:如果看到我睡觉请喊我去学习
posted @   我在路上回头看  阅读(511)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· winform 绘制太阳,地球,月球 运作规律
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 上周热点回顾(3.3-3.9)
· 超详细:普通电脑也行Windows部署deepseek R1训练数据并当服务器共享给他人
点击右上角即可分享
微信分享提示