From a2a27bf8fc25e3a64f163c585b0d82aed15a57f3 Mon Sep 17 00:00:00 2001 From: Michael Blaschek <michael.blaschek@univie.ac.at> Date: Wed, 24 Nov 2021 13:26:31 +0000 Subject: [PATCH] Update HandsOn.md --- workshop/HandsOn.md | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/workshop/HandsOn.md b/workshop/HandsOn.md index 14b990c..2df380b 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. -- GitLab