展开

apptainer

最后发布时间 : 2023-02-24 17:03:24 浏览量 :

与image文件进行交互

apptainer pull docker://ghcr.io/apptainer/lolcow
apptainer shell lolcow_latest.sif

查看缓存

singularity cache list -v
singularity cache clean

~/.apptainer/cache缓存的位置

$ echo "Hello from inside the container" > $HOME/hostfile.txt
$ apptainer exec lolcow_latest.sif cat $HOME/hostfile.tx
Hello from inside the container

This example works because hostfile.txt exists in the user’s home directory. By default Apptainer bind mounts /home/$USER, /tmp, and $PWD into your container at runtime.

$ echo "Drink milk (and never eat hamburgers)." > /data/cow_advice.txt
$ apptainer exec --bind /data:/mnt lolcow_latest.sif cat /mnt/cow_advice.txt
Drink milk (and never eat hamburgers).
 cat /data/cow_advice.txt | apptainer exec lolcow_latest.sif cowsay

apptainer pull

Pull an image from a URI

Synopsis
The ‘pull’ command allows you to download or build a container from a given URI. Supported URIs include:

library: Pull an image from the currently configured library
library://user/collection/container[:tag]

docker: Pull a Docker/OCI image from Docker Hub, or another OCI registry.
docker://user/image:tag

shub: Pull an image from Singularity Hub
shub://user/image:tag

oras: Pull a SIF image from an OCI registry that supports ORAS.
oras://registry/namespace/image:tag

http, https: Pull an image using the http(s?) protocol
https://library.sylabs.io/v1/imagefile/library/default/alpine:latest

apptainer pull [pull options...] [output file]

Definition Files
Each bootstrap agent enables its own options and keywords. You can read about them and see examples in the appendix section

bootstrap agents

Preferred bootstrap agents

docker (images hosted on Docker Hub)
oras (images from supporting OCI registries)
library (images hosted on Library API Registries)
scratch (a flexible option for building a container from scratch)

Other bootstrap agents

shub (images hosted on Singularity Hub)
localimage (images saved on your machine)
yum (yum based systems such as CentOS and Scientific Linux)
debootstrap (apt based systems such as Debian and Ubuntu)
oci (bundle compliant with OCI Image Specification)
oci-archive (tar files obeying the OCI Image Layout Specification)
docker-daemon (images managed by the locally running docker daemon)
docker-archive (archived docker images)
arch (Arch Linux)
busybox (BusyBox)
zypper (zypper based systems such as Suse and OpenSuse)