Apptainer: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 40: Line 40:
NOTE: Apptainer used to be called Singularity.
NOTE: Apptainer used to be called Singularity.


=Other Items=
==Other Items==
==General==
===General===
* In order to use Apptainer one must '''already''' have a container image, e.g., a <code>.sif</code> file or a "sandbox" directory created previously. If you don't already have a container image/sandbox, see the section on '''[[#Building_an_Apptainer_Container/Image|building an image]]''' below.
* In order to use Apptainer one must '''already''' have a container image, e.g., a <code>.sif</code> file or a "sandbox" directory created previously. If you don't already have a container image/sandbox, see the section on '''[[#Building_an_Apptainer_Container/Image|building an image]]''' below.
* While Apptainer is installed and available for use, using Apptainer will require you to install and/or build all software you will need to make use of in your container. In many instances, '''[[Available_software|we already have such software installed on our clusters]]''' so there is often no need to create a container with the same installed in it.
* While Apptainer is installed and available for use, using Apptainer will require you to install and/or build all software you will need to make use of in your container. In many instances, '''[[Available_software|we already have such software installed on our clusters]]''' so there is often no need to create a container with the same installed in it.


==<code>sudo</code>==
===<code>sudo</code>===
Many users ask about <code>sudo</code> since documentation and web sites often discuss using <code>sudo</code>. Know the ability to use <code>sudo</code> to obtain superuser/root permissions is not available on our clusters. Should you require using <code>sudo</code>, consider the following options:
Many users ask about <code>sudo</code> since documentation and web sites often discuss using <code>sudo</code>. Know the ability to use <code>sudo</code> to obtain superuser/root permissions is not available on our clusters. Should you require using <code>sudo</code>, consider the following options:


Line 52: Line 52:
* Apptainer version 1.1.x and newer has improved support for users using <code>--fakeroot</code> implicitly and explicitly so some things may be possible that were not with Apptainer version 1.0 and Singularity. This includes being able to build some images from <code>.def</code> definition files and building some images without needing to use <code>sudo</code>. That said, not all images will be able to be built without needing to use <code>sudo</code> or superuser/root.
* Apptainer version 1.1.x and newer has improved support for users using <code>--fakeroot</code> implicitly and explicitly so some things may be possible that were not with Apptainer version 1.0 and Singularity. This includes being able to build some images from <code>.def</code> definition files and building some images without needing to use <code>sudo</code>. That said, not all images will be able to be built without needing to use <code>sudo</code> or superuser/root.


==When Building Images/Overlays==
===When Building Images/Overlays===
Should you need to build your own container image(s) or overlay(s), be aware of the following:
Should you need to build your own container image(s) or overlay(s), be aware of the following:
* avoid building a sandbox image using <code>--fakeroot</code> on networked filesystem(s): [https://apptainer.org/docs/admin/main/installation.html#fakeroot-with-uid-gid-mapping-on-network-filesystems link to Apptainer documentation].
* avoid building a sandbox image using <code>--fakeroot</code> on networked filesystem(s): [https://apptainer.org/docs/admin/main/installation.html#fakeroot-with-uid-gid-mapping-on-network-filesystems link to Apptainer documentation].
Line 162: Line 162:


as well as the [http://apptainer.org/docs/user/main/index.html official Apptainer documentation].
as well as the [http://apptainer.org/docs/user/main/index.html official Apptainer documentation].
<hr>


===Interactively Running Software: <code>apptainer shell</code>===
===Interactively Running Software: <code>apptainer shell</code>===
Line 191: Line 189:


'''IMPORTANT:''' In addition to choose to use the above options, if you are making use of a persistent overlay image (as a separate file or contained within the SIF file) and want changes to be written to that image, it is extremely important to pass the <code>-w</code> or <code>--writable</code> option to your container. If this option is not passed to it, any changes you make to the image in the <code>apptainer shell</code> session will not be saved!
'''IMPORTANT:''' In addition to choose to use the above options, if you are making use of a persistent overlay image (as a separate file or contained within the SIF file) and want changes to be written to that image, it is extremely important to pass the <code>-w</code> or <code>--writable</code> option to your container. If this option is not passed to it, any changes you make to the image in the <code>apptainer shell</code> session will not be saved!
<hr>


===Running Daemons: <code>apptainer instance</code>===
===Running Daemons: <code>apptainer instance</code>===
cc_staff
156

edits