welcome: please sign in

Seiteninhalt hochladen

Sie können für die unten genannte Seite Inhalt hochladen. Wenn Sie den Seitennamen ändern, können Sie auch Inhalt für eine andere Seite hochladen. Wenn der Seitenname leer ist, leiten wir den Seitennamen vom Dateinamen ab.

Datei, aus der der Seiteninhalt geladen wird
Seitenname
Kommentar

Revision 5 vom 2019-06-06 09:01:00

location: SingularityDefinitionFile

Definition File

Ein Defnition-File ist wie eine Blaupause zu verstehen für den Bau eines Containers. Immer absolute Pfade angeben bzw. Umgebungsvariablen benutzen!

Was ist ein Definition File?

Es legt fest:

Komponenten

Bootstrap: library
From: debian:7

oder

Bootstrap: library
From: ubuntu:18.04

Sections

%setup

%setup
 touch /file1
 touch${SINGULARITY_ROOTFS}/file2

%files

%files
 /file1
 /file1 /opt

%environment

%environment
 export LISTEN_PORT=12345
 export LC_ALL=C

%post

%post
 apt-get update && apt-get install -y netcat
 NOW=`date`
 echo "export NOW=\"${NOW}\"" >> $SINGULARITY_ENVIRONMENT

%runscript

%runscript
 echo "Container was created $NOW"
 echo "Arguments received: $*"
 exec echo "$@"

$ ./my_container.sif
Container was created Thu Dec  6 20:01:56 UTC 2018
Arguments received:

oder

$ ./my_container.sif this that and the other
Container was created Thu Dec  6 20:01:56 UTC 2018
Arguments received: this that and the other
this that and the other

%startscript

%startscript
 nc -lp $LISTEN_PORT

$ singularity instance start my_container.sif instance1
$ lsof | grep LISTEN
$ singularity instance stop instance1

%test

%test
 grep -q NAME=\"U buntu\"/etc/os-release
 if[ $? -eq 0 ]; then
        echo "Container base is Ubuntu as expected."
 else
        echo "Container base is not Ubuntu."
 fi

%labels

%labels
 Author d@sylabs.io
 Version v0.0.1

%help

%help
 This is a demo container used to illustrate a def file that uses allsupported sections.

Zeitliche Einordnung der Komponenten

definitionFileTime.png

Beispiel für ein komplettes Definition-File

Bootstrap: library
From: ubuntu:18.04

%setup
touch /file1
touch${SINGULARITY_ROOTFS}/file2

%files
/file1
/file1 /opt

%environment
export LISTEN_PORT=12345
export LC_ALL=C

%post
apt-get update && apt-get install -y netcat
NOW=`date`echo "
export NOW=\"${NOW}\"" >> $SINGULARITY_ENVIRONMENT

%runscript
echo "Container was created $NOW"
echo "Arguments received: $*"exec echo "$@"

%startscript
nc -lp $LISTEN_PORT

%test
grep -q NAME=\"Ubuntu\"/etc/os-release
if[ $? -eq 0 ];then
echo "Container base is Ubuntu as expected."
else
echo "Container base is not Ubuntu."
fi

%labels
Author d@sylabs.io
Version v0.0.1

%help
This is a demo container used to illustrate a def file that uses allsupported sections.