Singularity: Difference between revisions
No edit summary |
No edit summary |
||
| Line 1: | Line 1: | ||
<br /> | <br />Singularity is a utility that can run containers without requiring any elevated privileges. | ||
== Cheat sheet == | |||
{| class="wikitable" | |||
!Description | |||
!Command | |||
|- | |||
|Pulling images from docker hub | |||
|<code>singularity pull docker://gcc:7.2.0</code> (outputs <code>gcc_7.2.0.sif</code>) | |||
<code>singularity pull docker://gcc</code> (outputs <code>gcc_latest.sif</code>) | |||
|- | |||
|Running a container | |||
|<code>./gcc_latest.sif</code> (which uses the container's runscript) | |||
<code>singularity run gcc_latest.sif</code> | |||
|- | |||
|Exec a command instead of runscript | |||
|<code>singularity exec gcc_latest.sif echo hi</code> | |||
|} | |||
==Tasks== | ==Tasks== | ||
===Pulling docker images=== | ===Pulling docker images=== | ||
singularity pull pulls from: | <code>singularity pull</code> pulls from: | ||
*docker:// docker hub | *<code>docker://</code> docker hub | ||
*shub:// Singularity hub | *<code>shub://</code> Singularity hub | ||
Images that are pulled will be saved as a .sif file | Images that are pulled will be saved as a <code>.sif</code> file. If a tag was provided, the tag will be part of the output filename. | ||
=== Building singularity image from Dockerfile === | ===Building singularity image from Dockerfile=== | ||
You cannot build Dockerfiles in Singularity. You can however, build the Dockerfile with Docker as usual, then convert the local docker image into a singularity image file using <code>singularity build</code> while specifying the local <code>docker-daemon</code> as the source. | You cannot build Dockerfiles in Singularity. You can however, build the Dockerfile with Docker as usual, then convert the local docker image into a singularity image file using <code>singularity build</code> while specifying the local <code>docker-daemon</code> as the source. | ||
{{Highlight | {{Highlight | ||
Revision as of 21:13, 16 August 2021
Singularity is a utility that can run containers without requiring any elevated privileges.
Cheat sheet
| Description | Command |
|---|---|
| Pulling images from docker hub | singularity pull docker://gcc:7.2.0 (outputs gcc_7.2.0.sif)
|
| Running a container | ./gcc_latest.sif (which uses the container's runscript)
|
| Exec a command instead of runscript | singularity exec gcc_latest.sif echo hi
|
Tasks
Pulling docker images
singularity pull pulls from:
docker://docker hubshub://Singularity hub
Images that are pulled will be saved as a .sif file. If a tag was provided, the tag will be part of the output filename.
Building singularity image from Dockerfile
You cannot build Dockerfiles in Singularity. You can however, build the Dockerfile with Docker as usual, then convert the local docker image into a singularity image file using singularity build while specifying the local docker-daemon as the source.
# docker pull quay.io/singularity/singularity
# docker run --rm -ti -v /tmp:/tmp quay.io/singularity/singularity build /tmp/output.sif docker-daemon://input:latest