apptainer
БесплатноБез исполняемых скриптовНе проверенApptainer: run OCI images as rootless batch jobs with --nv GPU passthrough and digest-pinned SIFs. Use when running a CUDA tool without Docker, podman lacks…
от laurigates★ 61 звезда на GitHubОб этом скилле
Apptainer
Run a container image as one batch command — a CUDA tool that reads files,
writes files and exits — on a Linux host, without a daemon and without root.
Apptainer pulls any OCI/Docker image, converts it to a single read-only .sif
file, and runs it as you, on the host network, with your home directory
mounted.
When to Use This Skill
| Use Apptainer when... | Use Docker/Podman/OrbStack instead when... |
|---|---|
| A GPU tool (COLMAP, OpenMVS, a trainer) must run from a pinned image on a Linux box | The container is a long-running service needing port mapping, compose or networks |
| There is no root, or the distro's podman predates CDI GPU support (< 4.1) | You need isolation from the host — Apptainer shares network, PIDs and $HOME by default |
| The job is "crunch this directory and exit" | The host is macOS — Apptainer is Linux-only; OrbStack/Docker run there |
Images stay OCI, so the same @sha256: image runs under Apptainer on the GPU
box, Docker on a laptop and Kubernetes in CI.
Install
Ubuntu / Pop!_OS, maintained path (apt updates it; needs sudo once):
sudo add-apt-repository -y ppa:apptainer/ppa && sudo apt update && sudo apt install -y apptainer
Use the apptainer-suid package instead only if you need the setuid variant.
On Ubuntu 24.04+, unprivileged user namespaces are restricted by AppArmor and
must be allowed on the host — see the Apptainer admin guide, User Namespace
Requirements.
No root at all: the official install-unprivileged.sh builds a relocatable
install from EPEL RPMs. It needs rpm2cpio, which Debian/Ubuntu lack — see
REFERENCE.md for the stand-in and the full command. Check user
namespaces first: unshare -Ur true && echo ok.
The Root-Disk Trap: Cache Under $HOME, Temp Under /tmp
A pull downloads the OCI layers into $APPTAINER_CACHEDIR (default
~/.apptainer/cache) and assembles the SIF under $APPTAINER_TMPDIR (default
/tmp). A 3.4 GB CUDA image therefore needs ~3.4 GB of layers plus the
3.2 GB SIF on the root disk unless both are redirected. Point them at the big
disk, persistently, before the first pull:
export APPTAINER_CACHEDIR=/big/disk/apptainer/cache APPTAINER_TMPDIR=/big/disk/apptainer/tmp
mkdir -p "$APPTAINER_CACHEDIR" "$APPTAINER_TMPDIR"
The cache directory must be per-user; do not share one between accounts.
Pull by Digest Into a Named File
A tag can move; a digest cannot. Resolve the digest once, then pull into a file
named for what it is. Docker Hub's digest already carries the sha256:
prefix, so it follows the @ as-is:
curl -fsSL "https://hub.docker.com/v2/repositories/colmap/colmap/tags?page_size=5&ordering=last_updated" | jq -r '.results[] | "\(.name) \(.digest)"'
apptainer pull /big/disk/images/colmap-20260929.8466.sif docker://colmap/colmap@<digest>
warn rootless{…} ignoring (usually) harmless EPERM on setxattr "security.capability" during an unprivileged pull is expected: file
capabilities cannot be set without root, and batch tools do not use them.
GPU: --nv
--nv binds the host NVIDIA driver libraries and device nodes into the
container. No nvidia-container-toolkit, no CDI spec. Verify before a long run:
apptainer exec --nv image.sif nvidia-smi -L
The image's CUDA runtime must be supported by the host driver. Read the tool's
own banner too — e.g. colmap help prints with CUDA for a GPU build.
Binds: Only Home, the Working Directory and /tmp Appear
By default Apptainer mounts $HOME, the current directory and /tmp (plus
/proc, /sys, /dev, /etc/hosts and /etc/localtime — the mount * and
bind path lines of apptainer.conf). Data on any other mount is absent inside the
container, and the tool reports a plain "No such file or directory" — it
looks like a wrong path, not a missing bind. Bind data disks explicitly:
apptainer exec --nv --bind /mnt/data image.sif colmap feature_extractor --image_path /mnt/data/images ...
Not a Sandbox
exec runs as your UID with your environment, your network and write access to
everything bound — including $HOME. That is what makes it convenient for batch
tools, and why it is no isolation boundary. For a cleaner run, add --cleanenv
(drop host environment) and --containall (no automatic home/tmp mounts, own
PID/IPC namespaces); then bind exactly what the job needs.
Scripting It
Wrap the call in a shell function, not a string variable:
colmap() { apptainer exec --nv --bind "$DATA" "$SIF" colmap "$@"; }
colmap feature_extractor --database_path "$W/db.db" --image_path "$IMG"
A string such as C="apptainer exec … colmap" followed by $C args fails in
zsh with exit 127, because zsh does not word-split unquoted parameters (see
tools-plugin:zsh-gotchas). This bites over ssh host '…' whenever the remote
login shell is zsh. Run multi-line remote scripts as
ssh host bash -s <<'EOF' … EOF.
For an overnight job, det
Установить apptainer в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Bash(apptainer pull *)Bash(mkdir *)Bash(curl *)Bash(jq *)Bash(ls *)ReadВложенные файлы
FAQ
Что делает скилл apptainer?
Apptainer: run OCI images as rootless batch jobs with --nv GPU passthrough and digest-pinned SIFs. Use when running a CUDA tool without Docker, podman lacks GPU support, or a pull fills root.
Как установить скилл apptainer?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл apptainer запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
ci-review
The scan that the plugin's GitHub Action runs.
от Anthropicazure-static-web-apps
Helps create, configure, and deploy Azure Static Web Apps using the SWA CLI. Use when deploying static sites to Azure, setting up SWA local development…
от GitHubai-ready
Make any repo AI-ready — analyzes your codebase and generates AGENTS.md, copilot-instructions.md, CI workflows, issue templates, and more. Mines your PR…
от GitHubaws-cdk-python-setup
Setup and initialization guide for developing AWS CDK (Cloud Development Kit) applications in Python. This skill enables users to configure environment…
от GitHub