Commit b92a10c5 authored by Ravi Tripathi's avatar Ravi Tripathi

Added 2 example to pull a Singularity container from SingularityHub and DockerHub

parent 6738fe08
......@@ -101,7 +101,138 @@
"metadata": {},
"outputs": [],
"source": [
"!singularity build help"
"!singularity pull help"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Example 1:\n",
"\n",
"In this example we are going to be pulling images from [Singularity-Hub](https://singularity-hub.org/). This singularity image contains the tool [neurodebian](http://neuro.debian.net/).\n",
"\n",
"NeuroDebian provides a large collection of popular neuroscience research software for the Debian operating system as well as Ubuntu and other derivatives."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Let's begin by pulling the [Neurodebian Singularity image](https://singularity-hub.org/collections/209) from Singularity Hub"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"!singularity pull shub://neurodebian/neurodebian"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Now that we have pulled the image you should be able to see that image in your directory by simply running a 'ls' command"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"!ls"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Now, we'll try to execute a command from within the container. Remember that exec parameter allows you to achieve this functionality. Let's list the content of you /data/user/$USER directory"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"!singularity exec neurodebian-neurodebian-master-latest.simg ls /tmp"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Hmmm, an error. Remember your singularity container image doesn't know about the directories on your host machine. It by default (in most containers) binds your HOME and tmp directory. So try to run the above command again but change the list path to your HOME directory.\n",
"\n",
"Now, all our raw data is generally in our /data/user/$USER locations, so we really need to access that location if our container has to be useful. SIngularity provides you with a parameter (-B) to bind path from your host machine to the container. Try the same command again, but with the bind parameter"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"!singularity exec -B /data neurodebian-neurodebian-master-latest.simg ls /data/user/wsmonroe"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Now rather then using ls command from within the container we are going to see one of the softwares within the container: [dcm2nii](https://www.nitrc.org/projects/mricron)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"!singularity exec -B /data neurodebian-neurodebian-master-latest.simg dcm2nii"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Example 2:\n",
"\n",
"In this example we are going to be pulling a singularity image from [dockerhub](https://hub.docker.com/). This singularity image contains [google-cloud-sdk tools](https://cloud.google.com/sdk/).\n",
"\n",
"The Cloud SDK is a set of tools for Cloud Platform. It contains gcloud, gsutil, and bq command-line tools, which you can use to access Google Compute Engine, Google Cloud Storage, Google BigQuery, and other products and services from the command-line. You can run these tools interactively or in your automated scripts."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"!singularity pull docker://jess/gcloud"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"!singularity exec -B /data gcloud.simg gsutil"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"!rm *.simg"
]
}
],
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment