← 返回命令列表

Linux command

apptainer-build 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Example

apptainer build [path/to/image.sif] [path/to/definition.def]

Example

apptainer build [path/to/image.sif] docker://[image]:[tag]

Example

apptainer build [path/to/image.sif] library://[user/collection/container]:[tag]

Example

apptainer build -s [path/to/directory] docker://[image]:[tag]

Example

apptainer build --disable-cache [path/to/image.sif] docker://[image]:[tag]

Force overwrite

apptainer build -F [path/to/image.sif] [path/to/definition.def]

Example

apptainer build -f [path/to/image.sif] [path/to/definition.def]

说明

apptainer build creates Apptainer container images from various sources including definition files, Docker Hub, OCI registries, and the Sylabs Container Library. The resulting SIF (Singularity Image Format) file is a portable, immutable container image. Definition files (.def) provide a reproducible way to specify base images, software installation steps, environment variables, and runscripts. The sandbox mode creates a writable directory structure useful for development and testing.

参数

-s, --sandbox
Build a writable directory instead of an immutable SIF image
-F, --force
Overwrite an existing image file without prompting
-f, --fakeroot
Build using fakeroot for unprivileged container builds
--disable-cache
Do not use cached images during the build process
--no-cleanup
Do not clean up the build environment on failure
--update
Run the %post script on an existing sandbox container

FAQ

What is the apptainer-build command used for?

apptainer build creates Apptainer container images from various sources including definition files, Docker Hub, OCI registries, and the Sylabs Container Library. The resulting SIF (Singularity Image Format) file is a portable, immutable container image. Definition files (.def) provide a reproducible way to specify base images, software installation steps, environment variables, and runscripts. The sandbox mode creates a writable directory structure useful for development and testing.

How do I run a basic apptainer-build example?

Run `apptainer build [path/to/image.sif] [path/to/definition.def]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -s, --sandbox do in apptainer-build?

Build a writable directory instead of an immutable SIF image