Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision | |||
| habrok:examples:apptainer [2026/06/29 12:45] – [Using a GPU in your container] pedro | habrok:examples:apptainer [2026/09/15 11:16] (current) – admin | ||
|---|---|---|---|
| Line 7: | Line 7: | ||
| A container is an isolated runtime environment that is often used to run a packaged version of some software (and its dependencies). A container is based on an image that defines the software environment, | A container is an isolated runtime environment that is often used to run a packaged version of some software (and its dependencies). A container is based on an image that defines the software environment, | ||
| - | A container for instance allows you to run Ubuntu applications in an Ubuntu environment on a CentOS | + | A container for instance allows you to run Ubuntu applications in an Ubuntu environment on a RedHat |
| A popular container technology is Docker, but this is not suitable for shared systems like HPC clusters. As an alternative, | A popular container technology is Docker, but this is not suitable for shared systems like HPC clusters. As an alternative, | ||
| Line 25: | Line 25: | ||
| Note that FSL is available as a module as well, but this does not include all the FSL tools, as the current installation method to install the full FSL suite is not supported on Hábrók. | Note that FSL is available as a module as well, but this does not include all the FSL tools, as the current installation method to install the full FSL suite is not supported on Hábrók. | ||
| - | There are several containers for FSL 6 available on Docker Hub; for this example we will be using the following one: | + | There are several containers for FSL available on Docker Hub; for this example we will be using the following one: |
| - | https:// | + | https:// |
| ==== Set the Apptainer cache directory ==== | ==== Set the Apptainer cache directory ==== | ||
| Line 40: | Line 40: | ||
| In order to use this container on Hábrók, we are first going to pull it in and store it on Hábrók. This process should be done on the interactive node on Hábrók, as it may take up some CPU resources. Since the image is very large (several gigabytes!), | In order to use this container on Hábrók, we are first going to pull it in and store it on Hábrók. This process should be done on the interactive node on Hábrók, as it may take up some CPU resources. Since the image is very large (several gigabytes!), | ||
| <code bash> | <code bash> | ||
| - | apptainer pull docker://diannepat/fsl6 | + | apptainer pull docker://brainlife/fsl: |
| </ | </ | ||
| - | This will fetch the container image from Docker Hub and convert it to an Apptainer format, which may take a bit of time. When it's done, you will find a file named '' | + | This will fetch the container image for FSL 6.0.7.22 |
| ==== Start an interactive shell within your container ==== | ==== Start an interactive shell within your container ==== | ||
| Line 48: | Line 48: | ||
| Now that you have the image, you may want to look around in the container and try running some commands interactively. You can do this by launching a shell within the container: | Now that you have the image, you may want to look around in the container and try running some commands interactively. You can do this by launching a shell within the container: | ||
| <code bash> | <code bash> | ||
| - | apptainer shell fsl6_latest.sif | + | apptainer shell fsl_6.0.7.22.sif |
| </ | </ | ||
| Line 58: | Line 58: | ||
| <code bash> | <code bash> | ||
| - | apptainer exec fsl6_latest.sif fsl_anat < | + | apptainer exec fsl_6.0.7.22.sif fsl_anat < |
| </ | </ | ||
| Line 64: | Line 64: | ||
| <code bash> | <code bash> | ||
| - | apptainer exec / | + | apptainer exec / |
| </ | </ | ||
| Line 73: | Line 73: | ||
| For instance, if you want to make your scratch folder available, so that FSL can actually access it, you can do: | For instance, if you want to make your scratch folder available, so that FSL can actually access it, you can do: | ||
| <code bash> | <code bash> | ||
| - | apptainer exec -B / | + | apptainer exec -B / |
| </ | </ | ||
| Line 80: | Line 80: | ||
| In order to make a GPU available in the container, you will have to use the '' | In order to make a GPU available in the container, you will have to use the '' | ||
| <code bash> | <code bash> | ||
| - | apptainer exec --nv / | + | apptainer exec --nv / |
| </ | </ | ||
| Note that this only makes sense if you are running the container in a GPU enabled node. Those would be the interactive GPU nodes '' | Note that this only makes sense if you are running the container in a GPU enabled node. Those would be the interactive GPU nodes '' | ||