There are 3 ways to start a Singularity container , each one serving a different purpose.
Shell: If you want to get into a shell-interface (e.g. bash )
singularity shell lent_latest.sif
Run: If you want some predifined commands to be executed and don’t care about interactivity. For example, in many projects OpenFOAM must be ‘ sourced ’ to expose some commands and environment variables before running a simulation.
# Here the container will not run interactively, but will only print the version of OpenFOAM.
# Note that this command is not available in general unless the bashrc file is sourced.
# The 'source /.../etc/bashrc' command have to exist in the '%runscript' section of the 'Definition' file otherwise we get an error.
singularity run lent_latest.sif foamVersion
Exec: If you want to avoid the scripted commands from the run
command above or want to execute any other command instead (e.g. open a shell-interface):
singularity exec lent_latest.sif python ./hello_world.py
singularity exec lent_latest.sif /bin/bash