...
Accessing singularity
You need to set up Spack first. Once that is done, here is how you access Singularity in an interactive session:
...
In docker, you can bind host volumes during runtime with the -v
flag. In Singularity, the equivalent flag is -B
:
Code Block |
---|
singularity -B /host/one:/one,/host/two/file.txt:/file.txt example.simg |
This will bind the folder /host/one
to /one
within the container, and the file /host/two/file.txt
to /file.txt
within the container.
...
Singularity, by default, mirrors the host environment, so you can set the environment there. Alternatively, you can set environment variables by prepending them with SINGULARITYENV
. In this example, we set SINGULARITYENV_HELLO
, which is accessible within the container as HELLO
:
Code Block |
---|
SINGULARITYENV_HELLO=world singularity exec centos7.img env | grep HELLO
> HELLO=world |
This will overwrite any host environment variables with the same name. If you need to clear the host environment data, use --cleanenv
.
...