Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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

If you need to clear the host environment data, use --cleanenv.

...