Skip to content

Singularity on Iris

Mamie Wang edited this page Jul 24, 2024 · 1 revision

Shared singularity containers are available at /usersoftware/chanj3/singularity/.

Basic commands

Getting help

singularity help
singularity help <command>

Shell access to an image

singularity shell <image-name>.sif

Running an image

singularity run <image-name>.sif

Executing a command in an image

singularity exec <image-name>.sif <command>

Pull an image

singularity pull <image-name>.sif <source>

Build an image

singularity build <image-name>.sif <definition-file>

Advanced commands

Building a host directory to the container

singularity exec --bind <host-dir>:<container-dir> <image-name>.sif <command>

Running an image with GPU support

singularity exec --nv <image-name>.sif <command>

Register an image with Jupyter kernel

  • Create a directory for the new kernel, e.g. ~/.local/share/jupyter/kernels/my_kernel/.
  • Inside this directory, create a kernel.json file with contents similar to the following:
{
  "argv": [
    "singularity",
    "exec",
    "/path/to/my_container.sif",
    "python",
    "-m",
    "ipykernel_launcher",
    "-f",
    "{connection_file}"
  ],
  "display_name": "My Singularity Kernel",
  "language": "python"
}
  • Verify kernel installation: start Jupyter Notebook, you should see display_name as an available kernel.

Clone this wiki locally