diff --git a/workshop/HandsOn.md b/workshop/HandsOn.md index 14b990c26034e12daf3cbff1bebe0a293cdc3a44..2df380ba4574d55a7f2e0851002beab36755a0c0 100644 --- a/workshop/HandsOn.md +++ b/workshop/HandsOn.md @@ -311,4 +311,35 @@ singularity exec my_container.sif ls /data log.txt ``` +#### PATH +Of course it is possible to modify the `PATH` that is accessible from the container. + +```bash +export SINGULARITYENV_PREPEND_PATH=/opt/important/bin +export SINGULARITYENV_APPEND_PATH=/opt/fallback/bin +export SINGULARITYENV_PATH=/only/bin +``` + +#### Clean Environment +Singularity by default exposes all environment variables from the host inside the container. Use the `--cleanenv` argument to prevent this: +```bash +singularity run --cleanenv <image.sif> <arg-1> <arg-2> ... <arg-N> +``` + +#### Setting Environment variables +One can define an environment variable within the container as follows: +```bash +export SINGULARITYENV_MYVAR=Overridden +``` +With the above definition, `MYVAR` will have the value "Overridden". + +### Inspect + +One can sometimes learn a lot about the image by inspecting its definition file: + +```bash +singularity inspect --deffile <image.sif> +``` + +The definition file is the recipe by which the image was made (see below). If the image was taken from Docker Hub then a definition file will not be available.