CondaTainer Manualο
π¦ CondaTainer is a CLI tool designed to streamline the management of Apptainer (Singularity) containers backed by Conda environments and SquashFS overlays.
Table of Contentsο
Overall Command Structureο
CondaTainer: Use Apptainer/Conda/Overlays/SquashFS to manage tools/data/env for HPC users.
Usage:
condatainer [command]
Available Commands:
avail Check available build scripts (local and remote)
check Check if the dependencies of a script are installed
completion Generate shell completion script
config Manage condatainer configuration
create Create a new SquashFS overlay
e Quick shortcut for executing commands with overlays
exec Execute a command using overlays (explicit -o flag)
helper Manage and run helper scripts
info Show information about a specific overlay
instance Manage Apptainer instances
list List installed overlays matching search terms
o Shortcut for 'overlay create'
overlay Manage persistent overlay images (create, resize, check, info)
remove Remove installed overlays matching search terms
proxy Manage the shared SOCKS5 proxy tunnel for compute nodes
run Run a script and auto-solve the dependencies by #DEP tags
scheduler Display scheduler information
search Search conda packages via anaconda.org API
self-update Update condatainer to the latest version from GitHub
update Update build script metadata cache or the base image
Flags:
--debug Enable debug mode with verbose output
-h, --help help for condatainer
--local Disable job submission (run locally)
-q, --quiet Suppress messages (warnings/errors are still shown)
-v, --version version for condatainer
-y, --yes Automatically answer yes to all prompts
Use "condatainer [command] --help" for more information about a command.
Naming Conventionο
CondaTainer classifies overlays into three distinct categories based on their naming structure.
System Applications (OS)ο
Used for system-level applications that do not follow the standard application or reference naming conventions.
Like text editors, IDEs, build-essential tools, etc.
Format:
nameConstraints:
Must not contain slashes (
/) or double-dash sequences (--).Unless
<distro>/<application>
Example:
rstudio-server,texlive,code-server
You can also create these system apps using the -n, --name flag with the create command.
Custom Environments (Bundle/Workspace)ο
Used when creating a custom environment with a user-defined name (create -p, or overlay action).
Format:
custom_nameConstraints:
Must not contain the double-dash sequence (
--).Should not conflict with common application names (to avoid ambiguity with app overlays).
Example:
my_analysis_env,project_x_utils
[!NOTE] Use
-nto install system apps only (e.g.,nvim). To create an environment.sqf, use-pto specify a prefix/path.
Application Overlays (Module)ο
Used for standard software packages and tools managed by CondaTainer build scripts.
Format:
name/versionStructure:
name: The software package or tool name (e.g.,
bcftools).version: The specific version of the software (e.g.,
1.22).
Example:
cellranger/9.0.1
Reference Overlays (Module)ο
Used for reference datasets, genome assemblies, or indices.
Format:
assembly/data-type/versionStructure:
assembly: The genome assembly or project (e.g.,
grch38).data-type: The type of data (e.g.,
gtf-gencode).version: The release or build version (e.g.,
47).
Example:
grch38/gtf-gencode/47
[!NOTE]
--is reserved for separating components in overlays. For example,bcftools/1.22overlay will be located atimages/bcftools--1.22.sqf.
Rename or not to Rename?ο
TL;DR: Do not rename sqf files. img files can be renamed.
CondaTainer relies on the overlay names to determine mount points and environment variable settings. Renaming .sqf files can lead to inconsistencies and runtime errors.
e.g.
bcftools/1.22is mounted at/cnt/bcftools/1.22grch38/gtf-gencode/47is mounted at/cnt/grch38/gtf-gencode/47my_analysis_env.sqfis mounted at/cnt/my_analysis_env
For .img files, the mount point is always /ext3/env, so renaming is allowed.
Mount Pointsο
CondaTainer uses clear terminology for overlay types and purposes. Read-only overlays use the .sqf extension (SquashFS) and writable overlays use the .img extension (ext3).
Overlay Terminology
Term |
Extension |
R/W |
Content Path |
Purpose |
|---|---|---|---|---|
OS |
|
R/O |
|
System Foundation β minimal system root that can run standalone or serve as a base for Modules/Bundles. |
Module |
|
R/O |
|
Individual tool overlay (single package) mounted under |
Bundle |
|
R/O |
|
Frozen Conda environment (prebuilt collection of packages) mounted under |
Workspace |
|
R/W |
|
Writable Conda environment (ext3 image) for interactive work and runtime package changes. |
Read-only .sqf overlays are ideal for distributing immutable software and reference data. Writable .img overlays are for live development or when packages must be changed at runtime.
Mount points and examples
Read-only overlays (
.sqf) are mounted under/cntfollowing their naming convention.Module example:
bcftools/1.22β mounted at/cnt/bcftools/1.22.Bundle example:
my_project_env.sqfβ mounted at/cnt/my_project_env.OS overlays present system directories (e.g., binaries under
/bin) inside the container filesystem exposed by the overlay.
Writable images (
.img) mount at/ext3/envand expose a full ext3 filesystem where packages may be installed or modified.
Writability: .sqf overlays are read-only. To enable write access for a .img overlay use the -w / --writable flag with exec or run.
Overlayο
Manage overlay writable ext3 images:
create: Create an image with a conda environment inside.
info: Display disk usage and filesystem statistics.
check: Verify filesystem integrity.
chown: Change ownership of files inside the image.
resize: Resize the image file.
export: Export a conda environment spec from an overlay.
Overlay Createο
Create an ext3 .img with a conda environment inside. This is useful for creating writable conda environments.
Usage:
condatainer overlay create [OPTIONS] [NAME]
Options:
-s,--size [SIZE]: Size of the overlay image (default: 10G). Supports units like20G,2048M.-t,--type [TYPE]: Overlay profile:small,balanced, orlarge(default: balanced).-f,--file [FILE]: Initialize with a Conda environment file (.yml or .yaml).--fakeroot: Create image compatible with fakeroot (owned by root, must use with--fakerootlater).--sparse: Create a sparse image file (no pre-allocation). (Short form:-Savailable on theoshortcut only.)--no-tmp: Create the overlay directly at the target path instead of staging at a local tmp directory first. By default CondaTainer creates the image on a fast local filesystem (e.g./tmp) and moves it to the destination once ready β this is significantly faster on HPC network filesystems (LustreFS). Use--no-tmponly when the target is already on local storage.-- [packages...] [-c channel...]: Initialize with inline conda packages instead of a YAML file. Mutually exclusive with-f. Channels passed with-care saved in.condarcinside the overlay for reuse bymm-install,mm-update, andmm-search. Default channels when no-cis given:conda-forge+bioconda.conda-forgeis always appended if not explicitly listed.NAME: Name of the overlay image (
env.imgby default if not specified).
Examples:
# Create a 20GB overlay img with a custom name
condatainer overlay create -s 20G my_analysis_env
# Create with a specific profile (small/balanced/large)
condatainer overlay create -t large data_env.img
# o is a shortcut for 'overlay create'
condatainer o -f environment.yml project_env.img
# Create a fakeroot-compatible sparse overlay
condatainer o --fakeroot --sparse
# Initialize with inline conda packages (faster than writing a YAML)
condatainer o -- python=3.11 numpy pandas
condatainer o myenv.img -- python=3.11
# Specify channels with -c; conda-forge is always appended if not listed
condatainer o -- pytorch torchvision torchaudio pytorch-cuda=12.4 -c pytorch -c nvidia
Then you can use the mm-<operation> helper commands to create/install/update/remove conda packages inside the writable container.
# install more packages (uses channels saved during creation)
mm-install numpy pandas
mm-install pytorch-cuda=12.4 -c pytorch -c nvidia # extra channels merged with saved ones
# manage channels
mm-channels get # show configured channels
mm-channels prepend pytorch # move/add channel to highest priority
mm-channels append bioconda # move/add channel to lowest priority
mm-channels remove nvidia # remove a channel
# search for packages (uses saved channels)
mm-search pytorch-cuda
# pin the package version
mm-pin numpy # after installation
mm-pin -d numpy # to unpin
mm-pin -l # list pinned packages
# update packages
mm-update
# remove packages
mm-remove pandas
# list installed packages
mm-list
# clean all conda cache
mm-clean -ay
# export the env
mm-export --no-builds > my_env.yaml
Overlay Infoο
Alias for condatainer info scoped to ext3 .img overlays. Produces identical output.
condatainer overlay info [image_path]
condatainer overlay info env.img
# same as:
condatainer info env.img
Overlay Checkο
Verify filesystem integrity of an ext3 .img overlay.
Usage:
condatainer overlay check [image_path]
Options:
-f,--force: Force check even if filesystem appears clean.
Example:
condatainer overlay check env.img
condatainer overlay check -f env.img
Overlay Chownο
Change the ownership of files inside an ext3 .img overlay. This is useful when sharing a writable overlay with other users: the recipient can reset ownership to their UID/GID so files are writable with their account.
Usage:
condatainer overlay chown [OPTIONS] [image]
Options:
-u,--uid UID: Set the owner UID (default: current userβs UID).-g,--gid GID: Set the group GID (default: current userβs GID).--root: Set UID/GID to 0 (root); overrides-uand-g.-p,--path PATH: Path inside the overlay to change (can specify multiple, default:/).image: Path to the overlayimgfile.
Examples:
# Set ownership inside env.img to the current user (entire overlay by default)
condatainer overlay chown env.img
# Explicitly set UID and GID
condatainer overlay chown -u 1001 -g 1001 env.img
# Set ownership to root
condatainer overlay chown --root env.img
# Set entire image to root
condatainer overlay chown --root -p / env.img
# Chown only /ext3 path
condatainer overlay chown -p /ext3 env.img
# Chown multiple specific paths
condatainer overlay chown -p /ext3 -p /data env.img
Overlay Resizeο
Resize an ext3 .img overlay to a new size. Supports both expanding and shrinking.
Usage:
condatainer overlay resize -s SIZE [image]
Options:
-s,--size SIZE: New size for the overlay image (e.g.,20G,2048M). Required.image: Path to the overlayimgfile.
Examples:
# Resize env.img to 20GB
condatainer overlay resize -s 20G env.img
Overlay Exportο
Export a Micromamba/Conda environment spec from an overlay. The output is printed to stdout and can be redirected to a YAML or text file.
For
.imgworkspace overlays the environment prefix is/ext3/env.For
.sqfmodule overlays the environment prefix is/cnt/<name>/<version>.
Requires conda-meta to be present at the expected prefix β i.e., the overlay must contain an actual conda environment.
Usage:
condatainer overlay export [OPTIONS] [overlay_path]
Options:
-e,--explicit: Use explicit (URL-pinned) format.--no-md5: Disable MD5 checksums in explicit output.--no-build,--no-builds: Strip build strings from the spec.--channel-subdir: Include channel and subdir in the spec.--from-history: Reconstruct spec from install history only.--json: Output as JSON.
Examples:
# Export environment from a workspace overlay
condatainer overlay export env.img > environment.yml
# Export from a module overlay (sqf)
condatainer overlay export salmon/1.10.2.sqf > environment.yml
# Export without build strings (more portable)
condatainer overlay export env.img --no-builds > environment.yml
# Export as explicit (URL-pinned, fully reproducible)
condatainer overlay export env.img -e > explicit.txt
# Export from history (only user-requested packages)
condatainer overlay export env.img --from-history > minimal.yml
Createο
Initialize and build a new CondaTainer SquashFS overlay. You can build from existing recipes (local/remote), a Conda environment file, or a remote container source.
Usage:
condatainer create [OPTIONS] [packages...]
Aliases: install, i
Options:
-n,--name [NAME]: Custom name for the resulting overlay file. If used, all specified packages are bundled into one overlay.-p,--prefix [PATH]: Custom prefix path for the overlay file. When-fis used, this can be omitted β the prefix is inferred from the file name.-f,--file [FILE]: Path to definition file (.yaml, .sh, .def).-s,--source [URI]: Remote source URI (e.g.,docker://ubuntu:22.04).-c,--channel [CHANNEL]: Conda channel to use, overriding config channels. Repeatable:-c conda-forge -c bioconda. Also accepts channel-annotated packages likebioconda::star=2.7.11bdirectly as package arguments (see below).--temp-size [SIZE]: Size of temporary overlay (default: 20G).--block-size [SIZE]: SquashFS block size for app/env/external overlays (e.g.128k,512k; default:128k). Must be a power of two between4kand1m.--data-block-size [SIZE]: SquashFS block size for data/reference overlays (e.g.512k,1m; default:1m). Must be a power of two between4kand1m.--use-tmp-overlay: Use a temporary ext3 overlay during builds instead of host directories. Equivalent to settingbuild.use_tmp_overlay = truein config.-u,--update: Rebuild overlays even if they already exist (atomic.newswap). Useful for refreshing a package to the latest version.--remote: Remote build scripts take precedence over local.packages: List of packages to install (e.g.,bcftools/1.22orsamtools=1.10orgrch38/genome/gencode). Supports conda channel annotations:bioconda::star=2.7.11b(version required in default mode; optional with-n/-p).
Compression Options:
--lz4: Use LZ4 compression (default).--zstd-fast: Use Zstandard compression level 3.--zstd-medium: Use Zstandard compression level 8.--zstd: Use Zstandard compression level 14.--zstd-high: Use Zstandard compression level 19.--gzip: Use Gzip compression.
Build Modes:
Default: Each package gets its own
.sqfvia the build system. Build script lookup is skipped when a package uses channel annotation (bioconda::star=2.7.11b).--name: Create a single.sqfwith multiple packages bundled together.--prefix+ packages: Create a conda env.sqfat a custom path, likeconda create -p.--fileonly: Create.sqffrom external source file; prefix inferred from file name (e.g.condatainer create -f r-collect.shβr-collect.sqf).--prefix+--file: Create.sqffrom external source file at a custom path.--source: Create.sqffrom a remote container source URI.
System level Examplesο
Conda environment:
# Single package module overlay (conda fallback)
condatainer create bcftools/1.22
# Multiple package module overlays at once
condatainer create samtools/1.16 bcftools/1.15
# Create a conda env sqf with packages at a custom path (like conda create -p)
condatainer create python=3.11 numpy -p /scratch/myenv
# Create from a yaml file (prefix inferred from filename)
condatainer create -f environment.yml
# Create from a yaml file with a custom prefix
condatainer create -p my_analysis_env -f environment.yml
# Create a custom env with multiple packages bundled together
condatainer create -n tools samtools=1.16 bcftools=1.15
# Rebuild an existing conda overlay (force update)
condatainer create -n nvim nvim nodejs -u
# Override channels for this build only
condatainer create python=3.11 -n myenv -c conda-forge -c bioconda
# Channel-annotated package: skips build script lookup, goes direct to conda
# (version required in default mode)
condatainer create bioconda::star=2.7.11b
# Channel annotation in bundled env (version optional with -n/-p)
condatainer create -n rnaseq bioconda::star bioconda::salmon=1.10.0
Build script:
# App overlay via build script
condatainer create cellranger/9.0.1
# Bare package name is expanded using default_distro (e.g. ubuntu24/igv)
condatainer create igv
# Data overlay
condatainer create grch38/gtf-gencode/47
# From a remote container source
condatainer create --source docker://ubuntu:22.04 -n myubuntu
# Template script β prompts for each placeholder interactively
condatainer create grch38/salmon-gencode
# [CNT] Placeholder template: grch38/salmon-gencode
# [CNT] Salmon GRCh38 GENCODE{gencode_version} index for transcript quantification
# Target: grch38/salmon/{salmon_version}/gencode{gencode_version}
# salmon_version [1.0.0-1.11.4] (default: 1.11.4): 1.10.2
# gencode_version [23-49] (default: 49):
# β Creating grch38/salmon/1.10.2/gencode49
# Template script β skip prompts by specifying the resolved target name directly
condatainer create grch38/salmon/1.10.2/gencode49
Features:
Automatic Fetching: If a build script is not found locally, CondaTainer attempts to fetch it from the remote repository.
Conda Fallback: If no build script exists, CondaTainer attempts to create the module by installing the package with the requested name and version from conda-forge or bioconda.
Metadata Parsing: Parses
#ENVand#ENVNOTEtags from build scripts to inject environment variables and help text into the generated modulefile.Template Resolution: If the name matches a template script (
#PL:/#TARGET:), CondaTainer prompts for each placeholder interactively, then builds the resolved concrete overlay. You can also bypass prompts by specifying the resolved target name directly.
Project level Examplesο
Create a read-only overlay with a Conda environment using a Conda YAML file. The prefix can be omitted β it is inferred from the file name.
# Prefix inferred: generates environment.sqf in the current directory
condatainer create -f environment.yml
# Custom prefix: generates my_project_env.sqf
condatainer create -p my_project_env -f environment.yml
Create a read-only overlay using a custom Apptainer definition file. See Custom OS Overlays for more details.
condatainer create -f custom_def.def
Create a read-only overlay using a shell script that installs packages. See Custom Build Script using Build Scripts for more details.
condatainer create -f install_packages.sh
Exit Codes (script and job-submission behavior) β οΈο
CondaTainer uses specific exit codes so automation and downstream tooling can detect special states:
0β Success (all requested builds completed locally or nothing to do)1β Generic error (build failures, runtime errors, or other fatal errors)2β Wrong or missing arguments (misuse of command, invalid flag values)3β Jobs submitted to scheduler β overlays will be created asynchronously by scheduler jobs
Commands that may return exit code 3 when scheduler jobs were submitted include:
condatainer create ...condatainer check -a ...(auto-install missing deps)condatainer avail -i ...(install from search results)
Quick example for shell scripts that detect the job-submitted state:
condatainer create samtools/1.22
if [ $? -eq 3 ]; then
echo "Jobs submitted to scheduler β overlays will be created asynchronously"
# Optionally: exit 0 or wait/monitor jobs here
fi
Note: When exit code 3 is returned, CondaTainer prints a message showing the number of jobs submitted (and can be extended to emit JSON or write job metadata for automation).
Disabling Job Submission:
# Run locally even with scheduler specs
condatainer --local run analysis.sh
# Or set in config
condatainer config set submit_job false
Container Management (Avail, List, Remove, Search)ο
Manage your local library of built containers and available recipes.
Availο
Search for available build scripts (both local scripts in build-scripts/ and remote metadata).
Aliases: av
condatainer avail [search_terms...] [flags]
Options:
--remote: Remote build scripts take precedence over local (on duplicates).-e,--expand: Expand template groups to show individual concrete entries instead of the collapsed template header.-w,--whatis: Show the description (#WHATIS:) for each build script.-i,--install: Install any found packages that are not currently installed.-a,--add: Alias for--install.
Search rules:
Input |
Mode |
|---|---|
Single plain string |
Substring match |
Single term with |
Wildcard (e.g. |
Single term with |
Regex (e.g. |
Multiple terms, first is an exact name |
Each term matched exactly (OR) |
Multiple terms, first not found |
All terms AND substring |
Template display:
Template scripts (#PL: / #TARGET:) are shown collapsed by default as a group header with variant count and placeholder value summaries. Use -e to expand all concrete combinations instead.
grcm39/salmon-gencode [34 variants, remote]
salmon_version (4 values) 1.10.2-1.7.0
gencode_version (8 values) M37-M25, *
Install behavior with -i:
Concrete entry (e.g.
grch38/gtf-gencode/47): queued directly.Template entry (e.g.
grch38/star-gencode): prompts for each placeholder interactively, then queues the resolved concrete name. Default values prefer the latest already-installed version of each dependency, falling back to the latest available.
Examples:
# Substring search
$ condatainer avail cellranger
# Wildcard
$ condatainer avail 'cell*'
# AND search with multiple terms
$ condatainer avail cellranger 9
# Install exact version
$ condatainer avail cellranger/9.0.1 -i
# Search for all resources matching 'grcm' and 'M33'
$ condatainer avail grcm M33
grcm39/gtf-gencode/M33
grcm39/salmon/1.10.2/gencodeM33
grcm39/star-2.7.11b/gencodeM33-101
# Show with descriptions
$ condatainer avail star -w
# Expand all template combinations
$ condatainer avail star -e
Listο
List installed overlays stored in the images/ directory.
Aliases: ls
condatainer list [search_terms...] [flags]
Options:
-d,--delete: Prompt to delete listed overlays after displaying them (requires search terms).-r,--remove: Alias for--delete.-D,--dir: Limit listing (and deletion) to specific image directories. Matching rules: no leading/β substring match (scratchmatches/scratch/user/images); leading/β exact match; leading/with*/?β wildcard where*matches across path separators (/scratch/*matches/scratch/user/images).
Search rules:
Same as avail (single term: substring/wildcard/regex; multiple terms: exact-first or AND substring). Distro-prefix aliases are recognised for exact multi-term matching (e.g. rstudio-server matches ubuntu24/rstudio-server).
Features:
Output is grouped by image directory with a full-width header per directory.
Lists app overlays (with versions), OS overlays, and data overlays.
Missing directories are skipped; existing but empty directories show a
(no overlays)line.Exits with code
1if search terms are given but no overlays match.
Delete mode (-d/-r):
Requires search terms β
list -ralone only lists.If the same overlay name exists in multiple directories,
--diris required to avoid ambiguity.Checks file lock and write permission before each deletion.
Examples:
$ condatainer list # all overlays, grouped by dir
$ condatainer list cellranger # substring match
$ condatainer list 'cell*' # wildcard
$ condatainer list cellranger 9 # AND search
$ condatainer list --dir scratch # only dirs with "scratch" in path
$ condatainer list --dir /scratch/user/images # exact dir match
$ condatainer list --dir '/scratch/*' # wildcard: all dirs under /scratch
$ condatainer list cellranger/9.0.1 -d # show then prompt to delete
$ condatainer list cellranger -r --dir /scratch # delete from /scratch only
Removeο
Deletes specific overlays and their associated .env files.
Aliases: rm, delete, uninstall
condatainer remove [search_terms... | file_paths...]
Options:
-D,--dir: Limit to specific image directories (search mode only). No leading/β substring match; leading/β exact match; leading/with*/?β wildcard.
Modes:
Search mode β args have no overlay extension:
Input |
Mode |
|---|---|
Single plain string |
Exact match (including distro-prefix alias) |
Single term with |
Wildcard |
Single term with |
Regex |
Multiple terms, first is an exact name |
Each term matched exactly (OR), warns if not found |
Multiple terms, first not found |
All terms AND substring |
File mode β args end with .img, .sqf, .sqsh, or .squashfs:
Removes the specified files directly, bypassing the name-based search. Useful for overlays that are not in any configured image directory.
Features:
Overlays to be removed are displayed grouped by directory before confirmation.
If the same overlay name exists in multiple directories,
--diris required to avoid ambiguity.Checks file lock and write permission before each deletion.
Also removes the associated
.envfile if present.Cannot mix file paths and search terms in one invocation.
Examples:
$ condatainer rm cellranger/9.0.1 # exact version
$ condatainer rm cellranger # all cellranger versions (exact)
$ condatainer rm 'cell*' # wildcard
$ condatainer rm cellranger/9.0.1 cellranger/8.0.1 # multiple exact versions
$ condatainer rm cellranger 9 # AND search
$ condatainer rm cellranger --dir scratch # only from dirs with "scratch" in path
$ condatainer rm cellranger --dir '/scratch/*' # wildcard: all dirs under /scratch
$ condatainer rm /path/to/cellranger--9.0.1.sqf # direct file path
$ condatainer rm *.img # all .img files in current dir
Searchο
Search conda packages via the anaconda.org API.
condatainer search <package> [flags]
Options:
--json: Output results in JSON format.-f,--fuzzy: Substring match instead of exact name match.-l,--limit N: Maximum number of fuzzy search results (default: 100).-c,--channel [CHANNEL]: Channel to search, overriding config channels. Repeatable:-c bioconda -c conda-forge.
Notes:
Uses the anaconda.org REST API β no base image or micromamba required.
Exact match (default): queries each configured channelβs package API in order and returns the first hit, matching install behaviour. Versions shown are filtered to the current platform (e.g.
linux-64) andnoarch.Fuzzy match (
-f): queries the anaconda.org search API with two requests β one for the current platform and one fornoarchβ then merges and sorts results alphabetically. Results are capped at--limit; a warning is shown if the limit was hit.Uses channels from the config (
build.channels, default:conda-forge,bioconda).-cfully replaces the config channel list for this invocation.The current platform (e.g.
[linux-64]) is shown in the output header. A warning is printed if the package is not available for the current platform.
Examples:
$ condatainer search samtools
$ condatainer search samtools --json
$ condatainer search -f samtool
$ condatainer search -f samtool -l 200
$ condatainer search star -c bioconda
Execο
Execute a command inside a containerized environment using explicit overlay specifications.
Usage:
condatainer exec [flags] [command...]
Options:
-o,--overlay [OVERLAY]: Overlay file to mount (can be used multiple times).-w,--writable: Mount.imgoverlays as writable (default: read-only).-b,--base-image [PATH]: Base image to use instead of default.-f,--fakeroot: Run container with fakeroot privileges.--env [KEY=VALUE]: Set environment variable inside the container (can be used multiple times).--bind [HOST:CONTAINER]: Bind mount path into the container (can be used multiple times).
Features:
Use
-o/--overlayto explicitly specify overlays.All positional arguments are treated as commands.
Read-only by default for
.imgoverlays (use-wfor writable).Defaults to bash if no command specified.
Environment Variables (inside container):
IN_CONDATAINER=1: Set inside the container.CNT_CONDA_PREFIX: Path to the.imgdefault conda path, if-w/--writableis used.
Examples:
# Run bash with samtools overlay
condatainer exec -o samtools/1.22
# Run samtools command with overlay
condatainer exec -o samtools/1.22 samtools view file.bam
# Use writable .img overlay
condatainer exec -w -o env.img bash
# Multiple overlays
condatainer exec -o samtools/1.22 -o bcftools/1.20 bash
# Set environment variables
condatainer exec --env MYVAR=value -o samtools/1.22 bash
# Bind mount directories
condatainer exec --bind /data:/mnt -o env.img bash
# Run with fakeroot privileges (short flag)
condatainer exec -f -o env.img bash
# Pass apptainer flags (use --flag=value format)
condatainer exec --nv --home=/custom -o samtools/1.22 python gpu_script.py
E (Quick Exec)ο
Quick shortcut for executing commands with overlays using simplified syntax.
Usage:
condatainer e [flags] [overlays...] [--] [command...]
Options:
-r,--read-only: Mount.imgoverlays as read-only (default: writable).-n,--no-autoload: Disable autoloadingenv.imgfrom current directory.-b,--base-image [PATH]: Base image to use instead of default.-f,--fakeroot: Run container with fakeroot privileges.--env [KEY=VALUE]: Set environment variable inside the container (can be used multiple times).--bind [HOST:CONTAINER]: Bind mount path into the container (can be used multiple times).
Key Differences from exec:
Overlays are positional arguments before
--.Commands go after
--.Writable by default (use
-rfor read-only).Auto-loads
env.imgunless-nis specified.Defaults to bash if no command specified.
Environment Variables (inside container):
IN_CONDATAINER=1: Set inside the container.CNT_CONDA_PREFIX: Path to the.imgdefault conda path (writable by default).
Examples:
# Auto-load env.img if present, run bash
condatainer e
# Multiple overlays
condatainer e samtools/1.22 bcftools/1.20
# Run specific command
condatainer e samtools/1.22 -- samtools view file.bam
# Read-only .img overlay
condatainer e -r env.img
# Disable env.img auto-loading
condatainer e -n samtools/1.22
# Set environment variables
condatainer e --env MYVAR=value samtools/1.22
# Bind mount directories
condatainer e --bind /data:/mnt env.img
# Run with fakeroot privileges (short flag)
condatainer e -f env.img
# Pass apptainer flags (use --flag=value format)
condatainer e --home=/custom samtools/1.22
Autoload and Shell Completionο
Autoload local env images: When running
condatainer ein a directory that containsenv.img, CondaTainer will automatically mount it into the container and open an interactive shell. Use-n/--no-autoloadto disable this behavior.Enable shell completion: Generate and install the completion script for your shell. See the Completion section for details.
Instanceο
Manage persistent Apptainer instances that run in the background. Instances are useful for long-running services or when you need to execute multiple commands in the same containerized environment without restarting the container each time.
Key Features:
Persistent background containers
State preservation (environment variables, overlays, bind paths)
Multiple instances with unique names
Pattern-based operations (wildcards supported)
Instance Startο
Start a named instance with specified overlays.
Usage:
condatainer instance start [flags] <name>
Options:
-o,--overlay [OVERLAY]: Overlay file to mount (can be used multiple times)-w,--writable: Mount.imgoverlays as writable (default: read-only)-b,--base-image [PATH]: Base image to use instead of default-f,--fakeroot: Run instance with fakeroot privileges--env [KEY=VALUE]: Set environment variable (can be used multiple times)--bind [HOST:CONTAINER]: Bind mount path (can be used multiple times)
Examples:
# Start instance with multiple overlays
condatainer instance start -o samtools/1.22 -o bcftools/1.22 myinstance
# Start with writable .img overlay
condatainer instance start -w -o env.img data_analysis
# Pass apptainer flags
condatainer instance start --home=/custom -o samtools/1.22 pipeline1
State Preservation:
When you start an instance, CondaTainer saves the instance configuration (overlays, environment variables, bind paths) to a state file. This allows instance exec to automatically apply the same environment when executing commands in the instance.
Instance Stopο
Stop one or more running instances.
Usage:
condatainer instance stop [flags] [name]
Options:
-a,--all: Stop all userβs instances-F,--force: Force kill instance (may corrupt data)-s,--signal [SIGNAL]: Signal to send to instance (e.g., SIGTERM, TERM, 15)-t,--timeout [SECONDS]: Timeout before force kill (seconds; 0 = use apptainer default)
Examples:
# Stop a specific instance
condatainer instance stop myinstance
# Stop all instances matching pattern
condatainer instance stop mysql*
# Stop all instances
condatainer instance stop --all
# Custom timeout before force kill
condatainer instance stop --timeout 30 myinstance
State files are automatically cleaned up for stopped instances.
Instance Listο
List all running instances.
Usage:
condatainer instance list
Shows all active instances with their names and process information.
Instance Statsο
Display resource usage statistics for a running instance.
Usage:
condatainer instance stats <name>
Example:
condatainer instance stats myinstance
Shows CPU, memory, and I/O statistics for the specified instance.
Instance Execο
Execute a command in a running instance.
Usage:
condatainer instance exec [flags] <name> <command> [args...]
Options:
--env [KEY=VALUE]: Set additional environment variables (can be used multiple times)
Features:
Commands run in the same environment as when the instance was started
Automatically applies saved environment variables from instance state
Overlays and bind paths from instance start are preserved
Defaults to bash if no command specified
Unknown apptainer flags can be passed using
--flag=valueformat
Examples:
# Run a command in an instance
condatainer instance exec myinstance samtools view file.bam
# Open interactive shell (default)
condatainer instance exec myinstance
# Set additional environment variables
condatainer instance exec --env VAR1=val1 --env VAR2=val2 myinstance bash
# Pass apptainer flags
condatainer instance exec --home=/custom myinstance bash
State Restoration:
When you use instance exec, CondaTainer automatically loads the saved state from when the instance was started. This includes:
Environment variables (
#ENVtags from overlays)Overlay mount points
Bind paths
Base image configuration
Environment variables set during instance exec are added on top of the saved state, allowing you to override or add variables as needed.
Note: Apptainerβs native apptainer exec instance://name does not preserve environment variables from instance start. CondaTainer solves this by storing instance state and reapplying it during exec.
Instance Workflow Exampleο
Hereβs a complete workflow showing how to use instances:
# 1. Start an instance with your desired overlays and writable env
condatainer instance start -o xfce4 -o igv -o env.img -w desktop
# 2. Run multiple commands in the same instance
condatainer instance exec desktop websockify --web /usr/share/novnc ...
condatainer instance exec desktop vncserver :1 -geometry 1920x1080 -depth 24 ...
condatainer instance exec desktop igv
# 3. Check instance status
condatainer instance stats desktop
# 4. Stop the instance when done
condatainer instance stop desktop
Runtime (Check, Run)ο
Utilities for running scripts with automatic dependency handling via #DEP: tags. Parsing of module load / ml lines is disabled by default and can be enabled with --module or parse_module_load: true in config.
Checkο
Parses scripts for #DEP: tags and checks if the required overlays are installed.
Usage:
condatainer check <script|dir> [script|dir ...] [-a] [--module] [--remote]
Each argument can be:
A local
.shfile pathA directory β all
.shfiles directly inside it are checked (non-recursive)A package name (e.g.,
grch38/salmon/1.10.2/gencode49) resolved from local or remote build scripts
Options:
-a,--auto-install: Automatically attempt to build/install missing dependencies.-i,--install: Alias for--auto-install.--module: Also parsemodule load/mllines as dependencies.--remote: Remote build scripts take precedence over local when resolving package names.
Output:
Dependencies are grouped into two sections:
Module Overlays:
β samtools/1.22
β bcftools/1.21
External Overlays:
β src/overlay/r-env.sqf
β src/overlay/r-collect.sqf (.yml found)
β src/overlay/custom.sqf (.sh found, but has #DEP - create manually)
Auto-install (-a):
Module overlays: resolved via build scripts or conda, same as
condatainer create.External overlays: auto-created from the sibling source file if found and has no
#DEP:tags..yml/.yamlβ conda environment.defβ Apptainer build and extract the squashfs.sh(no#DEP:) β shell build (cannot have#DEP:tags)
Runο
Executes a script inside the CondaTainer environment, mounting dependencies defined in the script. Autosolves dependencies based on #DEP: tags within the script.
condatainer run [OPTIONS] SCRIPT [SCRIPT_ARGS...]
Note: All options (
-a,-o,--afterok, etc.) must appear beforeSCRIPT. Arguments after the script name are forwarded to the script.
Options:
-w,--writable,--writable-img: Make.imgoverlays writable (default: read-only).-b,--base-image [PATH]: Use custom base image.--module: Also parsemodule load/mllines as dependencies.-n,--name NAME: Override the job name shown in the scheduler queue (e.g.squeue). Takes priority over#SBATCH --job-nameand similar directives.-o,--output PATH: Override the job stdout path (creates parent directory if needed). Takes priority over scheduler stdout settings.-e,--error PATH: Override the job stderr path. Takes priority over scheduler stderr settings.--afterok IDS: Submit job that runs only if all listed jobs succeed. Colon-separated IDs:123:456:789.--afternotok IDS: Submit job that runs only if any listed job fails. Colon-separated IDs.--afterany IDS: Submit job that runs after all listed jobs finish regardless of outcome. Colon-separated IDs.-f,--fakeroot: Run with fakeroot privileges.--bind HOST:CONTAINER: Bind mount a path into the container (repeatable).--env KEY=VALUE: Set an environment variable inside the container (repeatable).--dry-run: Preview what would be submitted without executing anything.--array FILE: Input file for an array job β one subjob per line, tokens become positional args.--array-limit N: Max concurrently running subjobs (0 = unlimited).
Resource override flags (apply on top of script scheduler directives; highest priority):
-c,--cpu INT: Override CPUs per task (e.g.4).-m,--mem STRING: Override memory per task (e.g.4G,8192M).-t,--time STRING: Override walltime (e.g.4d12h,2h30m,01:30:00).-g,--gpu SPEC: Override GPUs per node. Formats:N(any type),TYPE:N, orTYPE(count=1). E.g.1,a100:2,a100.
Script Tags:
Scripts can use special comment tags to declare dependencies and configure the container:
Tag |
Description |
|---|---|
|
Declare a dependency overlay |
|
Declare a external overlay (.sqf and .img) |
|
Additional arguments passed to condatainer |
|
SLURM scheduler directives (auto-submit as job) |
|
PBS scheduler directives (auto-submit as job) |
|
LSF scheduler directives (auto-submit as job) |
Available #CNT arguments:
-w,--writable: Make.imgoverlays writable.-b,--base-image PATH: Use custom base image.--env KEY=VALUE: Set environment variable.--bind HOST:CONTAINER: Bind mount path.-f,--fakeroot: Run with fakeroot privileges.
Script Example:
#!/bin/bash
#DEP: bcftools/1.22
#CNT --writable
#CNT --env MYVAR=value
#CNT -f
bcftools view input.vcf | head
Scheduler Integrationο
If your script contains scheduler directives (#SBATCH, #PBS, or #BSUB), condatainer run will automatically submit it as a scheduler job instead of running it locally. HTCondor uses native .sub submit files instead of in-script directives.
Condition |
Behavior |
|---|---|
Already inside a running job or container |
Always runs locally (no nested submission) |
|
Always runs locally |
Script has no scheduler specs |
Runs locally (prints a note) |
Script has |
Submits as a scheduler job |
Script has scheduler specs but scheduler not found/available |
Runs locally (prints a note) |
Scheduler Script Example:
#!/bin/bash
#SBATCH --cpus-per-task=4
#SBATCH --mem=8G
#SBATCH --time=2:00:00
#DEP: samtools/1.22
#DEP: bcftools/1.22
samtools view -@ 4 input.bam | bcftools call -mv -o output.vcf
Install missing dependencies first:
condatainer check -a salmon_quant.sh
After all dependencies are installed, submit as a job:
condatainer run salmon_quant.sh
Log Files:
-o/-eCLI flags take highest priority β they override any#SBATCH --output/--errorin the scriptIf no CLI flag, the path from the script directive (e.g.,
#SBATCH --output=...) is usedOtherwise, logs are written to the global logs directory (
~/logsby default)If only
-ois set (no-e), stderr is merged into the same fileJob scripts are created in the same directory as the log file
Resource Override Examples:
# Override CPU/memory/time on top of script's #SBATCH directives
condatainer run -c 8 -m 32G -t 4h analysis.sh
# Override GPU spec (any GPU type, count 2)
condatainer run -g 2 gpu_job.sh
# Override with specific GPU type and count
condatainer run -g a100:4 gpu_job.sh
# GPU type only (count defaults to 1)
condatainer run -g h100 gpu_job.sh
Script Argumentsο
Anything after the script name is passed into the script as $1, $2, β¦
#!/bin/bash
#SBATCH --cpus-per-task=4
#SBATCH --mem=8G
#SBATCH --time=1:00:00
#DEP: samtools/1.22
# $1 = input BAM, $2 = output directory
mkdir -p "$2"
samtools sort -@ $NCPUS "$1" -o "$2/sorted.bam"
Submit with:
condatainer run sort.sh /data/raw/sample1.bam results/sample1/
# inside sort.sh: $1=/data/raw/sample1.bam $2=results/sample1/
Array Jobsο
Run the same script over a list of inputs with --array. Each non-empty line in the input file becomes one subjob; its space-separated tokens arrive as positional arguments ($1, $2, β¦) inside the script.
# samples.txt β one entry per line; tokens become $1, $2, ...
sample1 condition_A
sample2 condition_B
sample3 condition_C
# quant.sh β $1=sample name, $2=condition
salmon quant -i $SALMON_INDEX_DIR -p $NCPUS -l A \
-r reads/${1}.fq -o quants/${1}_${2}/
condatainer run --array samples.txt quant.sh
condatainer run --array samples.txt --array-limit 4 quant.sh # max 4 concurrent
condatainer run --dry-run --array samples.txt quant.sh # preview args
Mixing array args with extra CLI args:
When extra args are provided after the script name alongside --array, array line tokens are prepended before the CLI args inside the script:
condatainer run --array samples.txt quant.sh genome_version
# line "sample1 treated" β $1=sample1 $2=treated $3=genome_version
Rules:
All non-empty lines must have the same number of shell-split tokens (quoted strings count as one).
Blank lines are flagged on
--dry-runand block submission β remove them before submitting.Per-subjob logs go to
{logsDir}/{jobname}_{idx}_{tag}.logwhere{tag}is all args joined, with non-alphanumeric characters replaced by_, capped at 20 characters.Array jobs always require scheduler submission (cannot run locally).
Job Chainingο
All [CNT] messages go to stderr, only job ID is printed to stdout, so you can capture it for downstream job submission.
TRIM=$(condatainer run trim.sh sample1)
ALIGN=$(condatainer run --afterok "$TRIM" align.sh sample1)
condatainer run --afterok "$ALIGN" quant.sh sample1
Three dependency flags are available:
Flag |
Runs when upstream job⦠|
|---|---|
|
Succeeds |
|
Fails |
|
Finishes (any outcome) |
Multiple job IDs can be passed as a colon-separated list (e.g. --afterok 123:456:789). All three flags can be combined in a single submission.
Array Jobs + Chainingο
--array and --afterok can be combined: each stage submits an array job and waits for the previous stage to succeed before starting. A final single job can collect results after all subjobs complete.
# Stage 1: trim all samples (no dependency)
JOB=$(condatainer run --array samples.txt --array-limit 10 trim.sh)
# Stage 2: align β waits for ALL trim subjobs to finish
JOB=$(condatainer run --array samples.txt --array-limit 10 --afterok "$JOB" align.sh)
# Stage 3: quant β waits for ALL align subjobs to finish
JOB=$(condatainer run --array samples.txt --array-limit 10 --afterok "$JOB" quant.sh)
# Final: single job collecting results β waits for ALL quant subjobs
condatainer run --afterok "$JOB" collect_results.sh samples.txt
Each array stage fans out across all samples in parallel (up to the concurrency limit), and --afterok ensures the next stage only starts once every subjob in the previous stage has succeeded. Use --afterany instead to proceed even if some subjobs failed.
If you donβt like this all-or-nothing behavior, you can chain individual subjobs.
declare -a FINAL_JOBS
while IFS= read -r line; do
if [[ -z "$line" ]]; then continue; fi # skip blank lines
TRIM=$(condatainer run trim.sh $line)
ALIGN=$(condatainer run --afterok "$TRIM" align.sh $line)
QUANT=$(condatainer run --afterok "$ALIGN" quant.sh $line)
FINAL_JOBS+=("$QUANT")
done < samples.txt
JOB_IDS=$(IFS=:; echo "${FINAL_JOBS[*]}")
condatainer run --afterok "$JOB_IDS" collect_results.sh samples.txt
Do not quote the line variable in the loop if you want the tokens to be split into separate arguments.
Usable ENVο
When running scripts with scheduler directives, the following environment variables are automatically available inside the container:
Variable |
Description |
Example |
|---|---|---|
|
Number of compute nodes |
|
|
Number of MPI tasks per node |
|
|
Total number of MPI tasks |
|
|
CPUs per task |
|
|
Memory per task in MB |
|
|
Memory per task in GB |
|
Priority Order (Scheduler ENV > Script > Default):
Environment variables are resolved with the following priority:
Scheduler ENV (highest priority) β Environment variables from the scheduler (e.g.,
$SLURM_CPUS_PER_TASK)Script β Scheduler directives in the script (
#SBATCH,#PBS,#BSUB)Default (lowest priority) β Built-in default values in config (
scheduler.*)
MPI Auto-Detectionο
When a scheduler script requests more than one task (--ntasks-per-node, --ntasks, or PBS/LSF equivalents), condatainer run automatically detects the host MPI and wraps the job command with mpiexec:
Detection: mpiexec must be available in PATH at submission time. If it is not found, condatainer run exits with an error.
Generated job command:
mpiexec condatainer run script.sh
MPI Script Example:
#!/bin/bash
#SBATCH --nodes=2
#SBATCH --ntasks-per-node=3
#SBATCH --mem=1G
#SBATCH --time=00:30:00
#DEP: mpi.img
python my_mpi_script.py
Run with:
# ml openmpi # or other MPI module to ensure mpiexec is in PATH
condatainer run mpi_job.sh
CondaTainer detects ntasks = 6, finds mpiexec, and submits:
mpiexec condatainer run mpi_job.sh
Each MPI rank launches its own container, all sharing the same MPI communicator via SLURMβs process management interface.
Important
You need to have the same major and minor version of OpenMPI installed inside the container as on the host.
ml av openmpi
# openmpi/4.1.5
condatainer e mpi.img -- mm-install mpi4py openmpi=4.1 -y
CondaTainer is compatible with module systemsο
CondaTainer can scan your script for module load or ml commands and mount the corresponding overlays automatically. This is disabled by default; enable it with --module or by setting parse_module_load: true in your config.
Example:
#!/bin/bash
module load bcftools/1.22
bcftools --version
Use --module with check or run to handle these dependencies:
# Install missing dependencies (including module load lines)
condatainer check my_script.sh --module -a
# Run the script with automatic dependency resolution
condatainer run my_script.sh --module
To enable it permanently:
condatainer config set parse_module_load true
Infoο
Display detailed metadata about an installed overlay or an external overlay file. Accepts an installed overlay name (name/version) or a direct file path (.sqf / .img).
Usage:
condatainer info [OVERLAY]
Examples:
condatainer info samtools/1.22
condatainer info env.img
condatainer info ./ubuntu--22.04.sqf
SquashFS (.sqf) outputο
Section |
Fields |
|---|---|
File |
Name, Path, file Size, Type ( |
SquashFS |
Compression algorithm (with level if set), Block Size, Inode count, Fragment count, Deduplication flag |
Mount |
|
Environment |
Variables from the |
ext3 (.img) outputο
Section |
Fields |
|---|---|
File |
Name, Path, file Size, Type ( |
Filesystem |
Format, State, Block Size, Created, Modified, Last Mounted |
Ownership |
Inner UID/GID of files inside the image (or |
Disk Usage |
Used / Total (%), Reserved blocks, Free |
Inode Usage |
Used / Total (%), Free |
Mount |
|
Environment |
Variables from the |
Helperο
Download and manage small helper scripts stored in the helper-scripts/ folder inside the CondaTainer repository.
Note
Helper commands are not available inside a container or a scheduler job (except --path and --list).
Usage:
condatainer helper [FLAGS] [SCRIPT_NAME] [SCRIPT_ARGS...]
Options:
-u,--update: Update helper scripts from remote metadata.-p,--path: Show all helper script search paths and the writable directory. If aSCRIPT_NAMEis given, print the absolute path of that specific helper script and exit.-l,--list: List available helper scripts with their descriptions (from#WHATIStags).SCRIPT_NAME: Name of the helper script to run (optional).SCRIPT_ARGS...: Remaining arguments are passed directly to the helper script when running it.
Examples
# List all available helper scripts with descriptions
condatainer helper --list
# Print helper script search paths
condatainer helper --path
# Print path to a specific helper script
condatainer helper --path code-server
# Download/Update all helper scripts (auto selects sbatch or headless based on availability)
condatainer helper --update
# Force update headless scripts version
condatainer --local helper --update
# Run a helper script with arguments
condatainer helper code-server -p 18230
Configο
Manage CondaTainer configuration settings.
Config Showο
Display current configuration including file paths, settings, and environment variable overrides. (including available distros)
condatainer config show [--path]
--path: Show only the config file path.
Config Getο
Get a specific configuration value.
condatainer config get <key>
Examples:
condatainer config get apptainer_bin
condatainer config get build.ncpus
condatainer config get submit_job
Config Setο
Set a scalar configuration value and save to the active config file. For a full list of supported keys, see the Configuration manual.
condatainer config set <key> <value>
Examples:
condatainer config set apptainer_bin /usr/bin/apptainer
condatainer config set submit_job false
condatainer config set build.ncpus 8
condatainer config set build.time 4h
Time formats: 2h, 30m, 1h30m, 90s, 02:00:00, HH:MM:SS
Config Append / Prepend / Removeο
Manage array config keys (extra_image_dirs, extra_build_dirs, extra_helper_dirs, extra_scripts_links, channels) from the CLI.
condatainer config append <key> <value>
condatainer config prepend <key> <value>
condatainer config remove <key> <value>
appendβ add a value to the end of the array (lower priority).prependβ add a value to the beginning of the array (higher priority).removeβ delete all occurrences of a value from the array.
Examples:
# Explicit image directory (search-only shared store)
condatainer config append extra_image_dirs /shared/lab/images:ro
# Explicit image directory (writable personal store)
condatainer config append extra_image_dirs /fast/scratch/images
# Add an institutional scripts source (takes priority over the default)
condatainer config prepend extra_scripts_links https://raw.githubusercontent.com/MyOrg/my-scripts/main
# Remove entries
condatainer config remove extra_image_dirs /shared/lab/images:ro
# Show result
condatainer config show
condatainer config get extra_image_dirs
Config Initο
Create a config file with auto-detected defaults.
condatainer config init [-l|--location user|root|extra-root|system]
-l,--location: Config location (default: auto-detect).
Auto-detects:
Apptainer binary
Scheduler binary
Compression support (zstd vs lz4)
Config Pathsο
Show data search paths for images, build scripts, and helper scripts.
condatainer config paths
Config Validateο
Validate the current configuration.
condatainer config validate
Checks:
Apptainer binary accessibility
Scheduler binary accessibility
Build configuration (CPUs > 0, Memory > 0)
default_distrois one of the supported distro names
Configuration Priorityο
Configuration is loaded in the following order (highest to lowest priority):
Command-line flags
Environment variables (
CNT_*)User config file (
~/.config/condatainer/config.yaml)Extra-root config (
$CNT_EXTRA_ROOT/config.yaml, group/lab layer)App-root config (
$CNT_ROOT/config.yamlor<install-dir>/config.yaml)System config (
/etc/condatainer/config.yaml)Built-in defaults
Configuration File Exampleο
See the Configuration manual for a full reference of all available keys.
# Binary paths (scheduler type is auto-detected from binary)
apptainer_bin: /usr/bin/apptainer
scheduler_bin: /usr/bin/sbatch
# Submission settings
submit_job: true
# Base OS distro: ubuntu20, ubuntu22, or ubuntu24 (default: ubuntu24)
default_distro: ubuntu24
# Remote build/helper script source (base URL)
scripts_link: https://raw.githubusercontent.com/Justype/cnt-scripts/main
# Additional remote sources (higher priority than scripts_link; first entry wins on conflict)
# extra_scripts_links:
# - https://raw.githubusercontent.com/MyOrg/my-scripts/main
# Days to cache remote metadata (default: 7, set 0 to always fetch live)
metadata_cache_ttl: 7
# Build configuration
build:
ncpus: 8
mem: 16g
time: 4h
# compress_args options (gzip, lz4, zstd, zstd-fast, zstd-medium, zstd-high)
compress_args: "-comp zstd -Xcompression-level 8"
# Explicit image directories (:ro = search-only, :rw = writable default)
extra_image_dirs:
- /shared/lab/images:ro
- /fast/scratch/images
# For a group/lab root with standard layout, set in module file:
# export CNT_EXTRA_ROOT=/project/shared/condatainer
Schedulerο
Display information about the configured job scheduler.
Usage:
condatainer scheduler [FLAGS]
Options:
-p,--partitions: Show per-partition resource limits.-Q,--queue: Show per-queue resource limits (alias for-p).--cpu: Show only CPU-only partitions (no GPUs); automatically enables-p.--gpu: Show only GPU partitions; automatically enables-p.
Output includes:
Scheduler type (SLURM, PBS, LSF, HTCondor)
Binary path
Version
Availability status
Max resource limits across all partitions (CPUs, memory, time)
GPUs (type, total)
Examples:
# Show scheduler information
condatainer scheduler
# Show per-partition/queue resource limits
condatainer scheduler -p
# Show only GPU partitions
condatainer scheduler --gpu
# Show per-partition limits for CPU-only partitions
condatainer scheduler -p --cpu
Updateο
Refreshes the remote build script and helper script metadata caches, or updates the base image.
Usage:
condatainer update [FLAGS]
Options:
--build: Refresh the build script metadata cache.--helper: Refresh the helper script metadata cache.--base: Update the base Apptainer image only.
By default (no flags), both --build and --helper are enabled.
Features:
Prints each remote URL as it fetches metadata.
Downloads and caches metadata locally per remote URL (default TTL: 7 days).
Cached metadata is reused by
availandcreatewithout a network round-trip.Supports multiple remote sources (
extra_scripts_links); each gets its own cache file.Removes cache files for remotes no longer configured (orphan cleanup).
Examples:
# Refresh build + helper metadata (default)
condatainer update
# Build script metadata only
condatainer update --build
# Helper script metadata only
condatainer update --helper
# Update the base image only
condatainer update --base
Self-Updateο
Updates the CondaTainer binary to the latest version from GitHub releases.
Usage:
condatainer self-update [FLAGS]
Options:
-y,--yes: Skip confirmation prompt and auto-update.-f,--force: Force update even if already on the latest version.--dev: Include pre-release versions.--base: Update the base image only, without updating the condatainer binary.
Features:
Downloads latest binary from GitHub releases.
Detects current OS and architecture.
Compares versions before updating.
Automatically updates the base image when the minor or major version changes.
If the base image update fails, prints a warning and suggests running
condatainer self-update --baseto retry later.Supports symlink resolution.
Examples:
# Update to latest stable version
condatainer self-update
# Update without confirmation
condatainer self-update --yes
# Force update even if already on latest version
condatainer self-update -f
# Include pre-release versions
condatainer self-update --dev
# Update the base image only (without updating the binary)
condatainer self-update --base
Proxyο
SSH tunnel + dual-protocol (HTTP CONNECT + SOCKS5) proxy so compute node jobs can reach the internet through the login node.
The daemon automatically selects the best available SSH tunnel method:
Go SSH library β pure Go, uses hostbased auth (no user keys needed), SSH agent, or key files
ssh -DUnix socket β delegates to the systemsshbinaryssh -DTCP port β fallback for older OpenSSH (< 6.7)
condatainer proxy start|stop|status|show
Two modesο
Shared |
Per-job |
|
|---|---|---|
Started on |
Login node |
Compute node (inside job) |
Bind |
|
|
Scope |
All compute nodes |
This node only |
PID file |
|
|
Lifetime |
Until stopped / logout |
Until job ends (tmpdir cleaned by scheduler) |
Start |
|
|
proxy startο
condatainer proxy start [--host HOST] [--via VIA] [--port PORT]
Flag |
Description |
|---|---|
|
Run the daemon on |
|
SSH server to tunnel through. Default: current node (shared mode); required for per-job mode inside a job. |
|
Listen port. Default: OS-assigned. |
Shared mode attempts loginctl enable-linger so the daemon survives logout. A warning is printed if it fails.
condatainer proxy start # shared, OS picks port
condatainer proxy start --port 1080 # shared, fixed port
condatainer proxy start --host login02 # shared, delegate to login02
condatainer proxy start --via gateway # shared, custom SSH gateway
condatainer proxy start --via login01 # per-job (inside a job)
proxy stop / status / showο
condatainer proxy stop # kill shared proxy (SSH to other login node if needed)
condatainer proxy status # check per-job then shared; clean stale PID files
condatainer proxy show # print active URL (per-job first); empty if none
export ALL_PROXY=$(condatainer proxy show)
Automatic injection (inside jobs)ο
When running inside a scheduler job, condatainer auto-injects the proxy URL into:
container env β
http_proxy,https_proxy,HTTP_PROXY,HTTPS_PROXY,all_proxy,ALL_PROXYcondatainerβs HTTP clients β script fetching and metadata downloads use the proxy transport directly
Lookup order: per-job proxy β shared proxy.
The proxy port speaks both HTTP CONNECT (http_proxy) and SOCKS5 (all_proxy) β compatible with all tools (curl, wget, pip, micromamba, etc.).
proxy_perjob config optionο
When proxy_perjob: true, condatainer injects condatainer proxy start --via <login-node> at the top of every generated scheduler script (build, run, helper jobs). The per-job proxy starts automatically on the compute node before the job body runs.
proxy_perjob: true # default: false
CNT_PROXY_PERJOB=1 enables it for a single invocation without changing the config file.
Completionο
Generates shell completion scripts for CondaTainer.
Usage:
condatainer completion [SHELL]
SHELL: Specify the shell type (
bash,zsh, orfish). If not provided, auto-detected from$SHELL.
Bash:
Add the following to your ~/.bashrc:
source <(condatainer completion bash)
Zsh:
Add the following to your ~/.zshrc:
source <(condatainer completion zsh)
# Or generate to fpath:
# condatainer completion zsh > "${fpath[1]}/_condatainer"
Fish:
Run the following command:
condatainer completion fish | source
# Or save to config:
# condatainer completion fish > ~/.config/fish/completions/condatainer.fish