4.4 Run and execution process
Once we have some image files (or directories) ready, we can run or favourite processes.
4.4.1 Singularity shell
The straight-forward exploratory approach, equivalent to docker run -ti myimage /bin/shell
. But with a more handy syntax.
4.4.2 Singularity exec
That is the most common way to execute Singularity (equivalent to docker exec
). That would be the normal approach in HPC environments.
4.4.3 Singularity run
This executes runscript from recipe definition (equivalent to docker run
). Not so common for HPC uses. More for instances (servers).
4.4.4 Environment control
By default Singularity inherits our profile environment (e.g., PATH environment variable). This may be convenient for some circumstances, but it can also lead to unexpected problems if you are not aware, when your own environment clashes with the default one from the image.
singularity shell -e fastqc-multi-bowtie.sif
singularity exec -e fastqc-multi-bowtie.sif fastqc
singularity run -e fastqc-multi-bowtie.sif
Compare env
command with and without -e modifier.
4.4.5 Execute from sandboxed images / directories
singularity exec ./sandbox ls -l /etc/myetc.conf
# We can see file created in the directory before
singularity exec ./sandbox bash -c 'apt-get update && apt-get install python'
# We cannot install python
singularity exec --writable ./sandbox bash -c 'apt-get update && apt-get install python'
# We needed to add writable parameter