@@ -5,6 +5,9 @@ In order to build a singularity container you require a **root** environment, su
...
@@ -5,6 +5,9 @@ In order to build a singularity container you require a **root** environment, su
- Virtual Machine (all OS) - VMWare, KVM, VirtualBox - install a recent Linux and install singularity
- Virtual Machine (all OS) - VMWare, KVM, VirtualBox - install a recent Linux and install singularity
- Build Service - [Sylab Cloud](https://cloud.sylabs.io/home) - advanced
- Build Service - [Sylab Cloud](https://cloud.sylabs.io/home) - advanced
[__TOC__]
## IMGW Resources
## IMGW Resources
Singularity is installed on all IMGW servers and on VSC4 via module (`module load singularity`). Most other HPC environments have a version installed as well.
Singularity is installed on all IMGW servers and on VSC4 via module (`module load singularity`). Most other HPC environments have a version installed as well.
...
@@ -20,8 +23,9 @@ and there are example **definition-files** that help to build containers by them
...
@@ -20,8 +23,9 @@ and there are example **definition-files** that help to build containers by them
We are using a VM to build our containers with root privileges.
We are using a VM to build our containers with root privileges.
Steps:
Steps:
- ssh to **jet01**
- Connect to JET: `ssh user@jet01.img.univie.ac.at`
- ssh using **rocky##@192.168.122.230**
- Connect to the VM: `ssh rocky##@192.168.122.230`
- clone this repo into your VMs HOME directory: `git clone https://gitlab.phaidra.org/imgw/singularity.git`
Please note that you will recieve the username and the password in the course.
Please note that you will recieve the username and the password in the course.
...
@@ -37,24 +41,34 @@ has three essential subcommands:
...
@@ -37,24 +41,34 @@ has three essential subcommands:
-**build**: Build your own container from scratch using a Singularity definition file; download and assemble any existing Singularity container; or convert your containers from one format to another (e.g., from Docker to Singularity).
-**build**: Build your own container from scratch using a Singularity definition file; download and assemble any existing Singularity container; or convert your containers from one format to another (e.g., from Docker to Singularity).
-**shell**: Spawn an interactive shell session in your container.
-**shell**: Spawn an interactive shell session in your container.
-**exec**: Execute an arbitrary command within your container.
-**exec**: Execute an arbitrary command within your container.
-**run**: Execute the runscript
### Definition File
### Definition File
Typically a Singularity Recipe or Definition files is made of:
Typically a Singularity Recipe or Definition files is made of different [sections](https://sylabs.io/guides/3.3/user-guide/definition_files.html#sections):
- Bootstrap - start source
-*Bootstrap* - start source
- Files - Files to copy into the container
-*Files* - Files to copy into the container
- Post - install instructions
-*Post* - install instructions
- Labels - Information for the User
-*Labels* - Information for the User
- Environment - Runtime environment variables
-*Environment* - Runtime environment variables
- Run - Runtime instructions, script, executable
-*Help* - Runtime help information
- Apps - Special executables defined as apps
-*Run* - Runtime instructions, script, executable
- Setup -
-*Apps* - Special executables defined as apps
- Test - Tests to check if the container runs optimal
-*Setup* - DO not use.
-*Test* - Tests to check if the container runs optimal
Please note that the *Bootstrap* can be changed for example, if you build the ubuntu container already, e.g. ubuntu.sif, then downloading that container image again might be not efficient. Therefore, replacing the Bootstrap is a nice option.
```bash
#Bootstrap: library
#From: mblaschek/imgw/ubuntu:18.04
Bootstrap: localimage
From: ubuntu.sif
```
Please have a look at the other options - [Other bootstrap agents @ sylab](https://sylabs.io/guides/3.3/user-guide/definition_files.html#other-bootstrap-agents)
Let's take for example the[miniconda3](../definition-files/miniconda/Singularity.miniconda3-py39-4.9.2-ubuntu-18.04) Recipe and investigate what it does.
On Servers you might be limited (file size, quota, ...) by the definition of your `SINGULARITY_CACHEDIR` (`singularity cache clean`) or your `SINGULARITY_TMPDIR` directory.
In order to include host paths into your container use the `SINGULARITY_BIND` variable defined in the host system or provide the runtime command the option `-b paths` or `--bind paths`
e.g.
```bash
# Binding /data on host to /mnt inside
singularity exec--bind /data:/mnt my_container.sif ls /mnt