Skip to content

Latest commit

 

History

History

general

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

General

Here is a general recipe to customize interaction with the user during run, shell, test, or exec.

%post
    cat > /.singularity.d/env/99-motd.sh <<EOF
case \$0 in
    /.singularity.d/actions/shell)
        echo "Hello \$USER from shell" ;;
    /.singularity.d/actions/exec)
        echo "Hello \$USER from exec" ;;
    /.singularity.d/actions/run)
        echo "Hello \$USER from run" ;;
    /.singularity.d/actions/test)
        echo "Hello \$USER from test" ;;
esac
EOF

Build

You can build the container as follows:

$ sudo singularity build greeting.sif Singularity

And then try running a shell, exec, run, or test to see the greetings.

$ singularity shell greeting.sif 
Hello vanessa from shell
Singularity greeting.sif:~/Documents/Dropbox/Code/singularity/motd/general> exit
$ singularity exec greeting.sif echo "Another hello"
Hello vanessa from exec
Another hello
$ singularity run greeting.sif
Hello vanessa from run
$ exit
$ singularity test greeting.sif
Hello vanessa from test
No Singularity container test found, executing /bin/sh -c true