Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
| Beide Seiten der vorigen Revision Vorhergehende Überarbeitung Nächste Überarbeitung | Vorhergehende Überarbeitung | ||
| hpc:tutorials:singularity:create_image_files [2024/04/19 12:31] – gelöscht - Externe Bearbeitung (Unbekanntes Datum) 127.0.0.1 | hpc:tutorials:singularity:create_image_files [2024/04/19 13:45] (aktuell) – | ||
|---|---|---|---|
| Zeile 1: | Zeile 1: | ||
| + | ==== Create Image Files ==== | ||
| + | A quick step-by-step guide to creating a Singularity container: | ||
| + | |||
| + | - Log in to the cluster | ||
| + | - On frontend01 or frontend02 type in ' | ||
| + | - Copy your user id (number of digits) | ||
| + | - Log out again | ||
| + | - Start singularity with a fresh container and a (root) shell inside it:< | ||
| + | singularity build --sandbox debian docker:// | ||
| + | sudo singularity shell --writeable debian</ | ||
| + | - Install the required packages and create a runscript inside the container, if you wish | ||
| + | - Make sure that the user with your copied id has read/ | ||
| + | - Create the image file of your sandbox:< | ||
| + | sudo singularity build debian.sif debian</ | ||
| + | - | ||
| + | - Copy the sif to the cluster and run your script (if present):< | ||
| + | srun singularity exec < | ||
| + | </ | ||
| + | - Otherwise, just run the container so that you can run scripts in your home directory (example using the previously created Ubuntu container):< | ||
| + | [___@frontend01 ~]$ srun --pty singularity run ~/ | ||
| + | [___@node131 ~]$ cat / | ||
| + | PRETTY_NAME=" | ||
| + | </ | ||
| + | | ||
| + | |||
| + | Of course, you can use sbatch scripts instead of calling srun directly, and you can also pull a fresh container, which works on the cluster frontends: | ||
| + | < | ||
| + | singularity pull docker:// | ||
| + | </ | ||
| + | |||
| + | When you open a shell on your singularity image, your outer home directory is always mounted inside the container as your inner home directory. So you can put a script in your home directory on the cluster and use it inside the container in your home directory. | ||
| + | |||
| + | So again, 2 things to remember when starting a Singularity container: | ||
| + | - You stay who you are. | ||
| + | - Your home directory remains the same. | ||
| + | |||
| + | Some final notes: Running singularity on the frontends will cause a high load on the frontends and therefore we (the administrators) may kill this process if it disturbs other users. This is just a note and a reminder to always use srun or sbatch to start your project! ^^ | ||
| + | |||
| + | Finally, we have Singularity versions 3.7.0, 3.1.0 and 2.7.5 installed on every machine. Please always use one of these versions (for compatibility reasons) until there is an update on the cluster. | ||