RSH 15: Containers for science


Collaborative notes taken during the session

Icebreaker question

When have you experienced some difficult to install software? How did you solve it?


A question came up whether Singularity images can be made executable and my answer there after a quick test was wrong and one of the watchers has sent a clarification which is amazing:

Got puzzled by that executable singularity container remark someone did.

Tried it out here and I'm amazed that it actually works:

# cat Singularity
BootStrap: docker
From: alpine:edge

    /bin/echo "$@"

and after:

# singularity build singularity.img Singularity
# chmod +x singularity.img

# ./singularity.img Hello world
Hello world

Then something else I found while googling:

# cat Singularity
BootStrap: docker
From: alpine:edge

    apk --no-cache add vim python3

    /usr/bin/$SINGULARITY_NAME "$@"

# l
lrwxrwxrwx   1 root root       15 Nov 19 22:05 python3 -> singularity.img
-rw-r--r--   1 root root      120 Nov 19 22:05 Singularity
-rwxr-xr-x   1 root root 22192128 Nov 19 22:05 singularity.img
lrwxrwxrwx   1 root root       15 Nov 19 22:02 vim -> singularity.img

# ./python3 --version
Python 3.8.6

# ./vim --version | head -n1
VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Nov 19 2020 05:07:05)

So $SINGULARITY_NAME becomes the name of the symlink (or the container).
This is blew my mind, basically drop-in binary replacements.


Ideas for next week

Decision for next week: debugging. Please send us stuff that doesn't work!