Singularity使用

基本命令:

  • 帮助命令:

    • singularity --help 显示帮助信息
    • singularity help <command> 查看具体命令的帮助
  • 容器管理命令:

    • singularity build <image-name> 构建镜像
    • singularity pull <image-name> 从Singularity Hub或Docker Hub拉取镜像
    • singularity inspect <image-name> 查看镜像元数据

容器使用:

  • shell :启动容器的交互式 shell
    singularity shell <image-name>
  • exec :在容器内执行指定命令
    singularity exec <image-name> <command>
  • run :启动镜像中的默认运行命令
    singularity run <image-name>

镜像格式:

  • 默认格式 :.simg (SquashFS),不允许修改
  • 可写格式 :--writable 或 Sandbox 目录,允许修改镜像中的内容

从头构建镜像:

  • singularity build --sandbox <dir-name> <source> 用于构建一个可写的目录镜像
  • singularity build <image-name>.simg <source> 用于构建不可修改的 .simg 格式镜像

格式转换:

  • singularity build <new-image>.simg <sandbox-dir> 用于将 sandbox 转换为 .simg 格式。

使用 Singularity Hub/Docker Hub:

  • singularity pull shub://<container-name> 从 Singularity Hub 拉取镜像
  • singularity pull docker://<container-name> 从 Docker Hub 拉取镜像

Singularity 配置文件 (Singularity Recipes):

类似 Dockerfile,可以通过指定构建步骤创建镜像。包含以下部分:

  • %runscript:容器启动时执行的命令
  • %files:复制文件到容器
  • %environment:定义环境变量
  • %post:构建后的安装步骤

常用格式:

  • SquashFS (.simg): 默认的、不可写的格式
  • Sandbox :可读写的目录,修改后会丢失,除非加上 --writable
  • Writable Image (.img): 类似于 Sandbox,但作为 .img 格式保存
相关推荐
海宇AI3 小时前
零信任架构实战:基于海宇个人风险报告构建自动化分期商城信用额度初审网关
运维·人工智能·架构·自动化
IMPYLH4 小时前
Linux 的时间为什么会被拨回去
linux·运维·服务器
2601_963282774 小时前
寒地窄带通信工程实践:黑龙江哈尔滨对讲机选型、组网与合规运维总结
运维·服务器·网络
叼烟扛炮5 小时前
[Git 实战] 学习笔记:从生成 SSH 密钥到解决 TortoiseGit 推送报错全指南
linux·运维·笔记·git·学习
我要见SA姐16 小时前
GitHub Actions 自动化:5 个真实运维提效案例
运维·数据库·机器学习·oracle·回归
Android系统攻城狮7 小时前
Linux FFmpeg深度解析之avcodec_flush_buffers调用流程与实战(十九)
linux·运维·服务器·ffmpeg·车载音视频·ffmpeg音视频进阶
Y3815326628 小时前
用 httpx 写 SerpBase 异步客户端:连接池与超时配置
运维·服务器·数据库
倔强的石头1068 小时前
【Linux指南】进程通信系列(七):System V 信号量 —— 同步互斥的内核原语
linux·运维·服务器
HZZD_HZZD10 小时前
大口径摄像水表白皮书拆解:DN40加装改造与字轮识别实测
运维·物联网·腾讯云
PellyKoo11 小时前
【Ubuntu】GTX 1080 Ti 显卡占用为0但功率高达60W的排查与解决
linux·运维·ubuntu