From 85f5af3643b30e076f6c705c39bc9fcc0990abe5 Mon Sep 17 00:00:00 2001 From: Enrico Glerean Date: Tue, 19 Mar 2024 00:03:59 +0200 Subject: [PATCH] example on how to build singularity container --- content/environments.md | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/content/environments.md b/content/environments.md index e36045f..b2d7424 100644 --- a/content/environments.md +++ b/content/environments.md @@ -246,7 +246,45 @@ package repositories. ````` `````` -````{exercise} (optional) Containers-2: Explore two really useful Docker images + +````{exercise} (optional) Containers-2: Installing the impossible. + +When you are missing privileges for installing certain software tools, containers can come handy. +Here we build a Singularity/Apptainer container for installing `cowsay` and `lolcat` Linux programs. + +1. Make sure you have apptainer installed: + ```console + $ apptainer --version + ``` + +2. Make sure you set the apptainer cache and temporary folders. + ```console + $ mkdir ./cache/ + $ mkdir ./temp/ + $ export APPTAINER_CACHEDIR="./cache/" + $ export APPTAINER_TMPDIR="./temp/" + ``` + +3. Build the container from the following definition file above. + ```console + apptainer build cowsay.sif cowsay.def + ``` + +4. Let's test the container by entering into it with a shell terminal + ```console + $ apptainer shell cowsay.sif + ``` + +5. We can verify the installation. + ```console + $ cowsay "Hello world!"|lolcat + ``` + +```` + + + +````{exercise} (optional) Containers-3: Explore two really useful Docker images You can try the below if you have Docker installed. If you have Singularity/Apptainer and not Docker, the goal of the exercise can be to run the Docker containers through Singularity/Apptainer.