Singularity: Difference between revisions

Jump to navigation Jump to search
no edit summary
(Marked this version for translation)
No edit summary
Line 89: Line 89:


<!--T:124-->
<!--T:124-->
Many modern Linux distributions, use an in-memory <tt>tmpfs</tt> filesystem, which may limit the size of the container you can build.  
Many modern Linux distributions, use an in-memory <code>tmpfs</code> filesystem, which may limit the size of the container you can build.  
The [https://sylabs.io/guides/3.6/user-guide/build_env.html#temporary-folders Singularity Documentation] gives a more detailed explanation.
The [https://sylabs.io/guides/3.6/user-guide/build_env.html#temporary-folders Singularity Documentation] gives a more detailed explanation.


Line 129: Line 129:


<!--T:18-->
<!--T:18-->
Suppose the Docker Hub URL for a container you want is <tt>docker://ubuntu</tt>,
Suppose the Docker Hub URL for a container you want is <code>docker://ubuntu</code>,
then you would download the container by running:
then you would download the container by running:
<source lang="console">$ singularity build myubuntuimage.sif docker://ubuntu</source>
<source lang="console">$ singularity build myubuntuimage.sif docker://ubuntu</source>
Line 160: Line 160:
<!--T:133-->
<!--T:133-->
One can also use a '''Dockerfile''' to create Singularity images, but this is a two step process.
One can also use a '''Dockerfile''' to create Singularity images, but this is a two step process.
* The first step is to create a Docker image with the Dockerfile. This step should be executed on your VM or Linux machine, where you have sudo access. Go to the directory which contains the Dockerfile and run the command <tt>sudo docker build -t CC:latest .</tt>. By passing '.' as a parameter we are asking Docker to search for the Dockerfile in the current directory. This command will create a Docker image with the name '''CC''' and assign the image a tag with the value '''latest'''. Remember that latest is the default tag that Docker assigns to an image, so if you don't provide a tag, the image will use the default tag value '''latest'''.  
* The first step is to create a Docker image with the Dockerfile. This step should be executed on your VM or Linux machine, where you have sudo access. Go to the directory which contains the Dockerfile and run the command <code>sudo docker build -t CC:latest .</code>. By passing '.' as a parameter we are asking Docker to search for the Dockerfile in the current directory. This command will create a Docker image with the name '''CC''' and assign the image a tag with the value '''latest'''. Remember that latest is the default tag that Docker assigns to an image, so if you don't provide a tag, the image will use the default tag value '''latest'''.  
* The second step is to use the Docker image created above as the source for Singularity. The following command will create a Singularity image '''cc_image_latest.sif''' from the Docker image '''CC:latest''',
* The second step is to use the Docker image created above as the source for Singularity. The following command will create a Singularity image '''cc_image_latest.sif''' from the Docker image '''CC:latest''',
<source>sudo singularity build cc_image_latest.sif docker-daemon://CC:latest</source>
<source>sudo singularity build cc_image_latest.sif docker-daemon://CC:latest</source>
Line 168: Line 168:


<!--T:128-->
<!--T:128-->
The <tt>--sandbox</tt> flag allows you to create a container within a writable directory.
The <code>--sandbox</code> flag allows you to create a container within a writable directory.
this allows for easy modifications of existing containers.
this allows for easy modifications of existing containers.
<source>
<source>
$ singularity build --sandbox IMAGE_NAME/ docker://DOCKER-IMAGE-NAME
$ singularity build --sandbox IMAGE_NAME/ docker://DOCKER-IMAGE-NAME
</source>
</source>
Changes can be made within the container with the <tt>--writable</tt> flag.
Changes can be made within the container with the <code>--writable</code> flag.
<source>
<source>
$ singularity shell --writable IMAGE_NAME/  
$ singularity shell --writable IMAGE_NAME/  
</source>
</source>
A sandbox directory can be converted into a <tt>sif</tt> file with the build command.
A sandbox directory can be converted into a <code>sif</code> file with the build command.
<source>
<source>
$ singularity build production.sif IMAGE_NAME/  
$ singularity build production.sif IMAGE_NAME/  
Line 447: Line 447:


<!--T:131-->
<!--T:131-->
The <tt>--nv</tt> flag needs to be added to make CUDA work.
The <code>--nv</code> flag needs to be added to make CUDA work.


<!--T:132-->
<!--T:132-->
rsnt_translations
56,430

edits

Navigation menu