Skip to content

Commit 91c372b

Browse files
committed
ENH: add new neurodocker notebook
1 parent 9f8a7b8 commit 91c372b

File tree

1 file changed

+149
-0
lines changed

1 file changed

+149
-0
lines changed
Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"metadata": {},
6+
"source": [
7+
"# Neurodocker tutorial\n",
8+
"\n",
9+
"[Neurodocker](https://github.com/kaczmarj/neurodocker) is a brilliant tool to create your own neuroimaging docker container. [Neurodocker](https://github.com/kaczmarj/neurodocker) is a command-line program that enables users to generate [Docker](http://www.docker.io/) containers that include neuroimaging software. These containers can be\n",
10+
"converted to [Singularity](http://singularity.lbl.gov/) containers for use in high-performance computing\n",
11+
"centers.\n",
12+
"\n",
13+
"Requirements:\n",
14+
"\n",
15+
"* [Docker](http://www.docker.io/)\n",
16+
"* Internet connection"
17+
]
18+
},
19+
{
20+
"cell_type": "markdown",
21+
"metadata": {},
22+
"source": [
23+
"## Usage\n",
24+
"\n",
25+
"To view the Neurodocker help message\n",
26+
"\n",
27+
" docker run --rm kaczmarj/neurodocker:v0.3.2 generate --help\n",
28+
"\n",
29+
"1. Users must specify a base Docker image and the package manager. Any Docker\n",
30+
" image on DockerHub can be used as your base image. Common base images\n",
31+
" include ``debian:stretch``, ``ubuntu:16.04``, ``centos:7``, and the various\n",
32+
" ``neurodebian`` images. If users would like to install software from the\n",
33+
" NeuroDebian repositories, it is recommended to use a ``neurodebian`` base\n",
34+
" image. The package manager is ``apt`` or ``yum``, depending on the base\n",
35+
" image.\n",
36+
"2. Next, users should configure the container to fit their needs. This includes\n",
37+
" installing neuroimaging software, installing packages from the chosen package\n",
38+
" manager, installing Python and Python packages, copying files from the local\n",
39+
" machine into the container, and other operations. The list of supported\n",
40+
" neuroimaging software packages is available in the ``neurodocker`` help\n",
41+
" message.\n",
42+
"3. The ``neurodocker`` command will generate a Dockerfile. This Dockerfile can\n",
43+
" be used to build a Docker image with the ``docker build`` command."
44+
]
45+
},
46+
{
47+
"cell_type": "markdown",
48+
"metadata": {},
49+
"source": [
50+
"## Create a Dockerfile with FSL, Python 3.6, and Nipype\n",
51+
"\n",
52+
"This command prints a Dockerfile (the specification for a Docker image) to the\n",
53+
"terminal.\n",
54+
"\n",
55+
" docker run --rm kaczmarj/neurodocker:v0.3.2 generate \\\n",
56+
" --base debian:stretch --pkg-manager apt \\\n",
57+
" --fsl version=5.0.10 \\\n",
58+
" --miniconda env_name=neuro \\\n",
59+
" conda_install=\"python=3.6 traits\" \\\n",
60+
" pip_install=\"nipype\""
61+
]
62+
},
63+
{
64+
"cell_type": "markdown",
65+
"metadata": {},
66+
"source": [
67+
"## Build the Docker image\n",
68+
"\n",
69+
"The Dockerfile can be saved and used to build the Docker image\n",
70+
"\n",
71+
" docker run --rm kaczmarj/neurodocker:v0.3.2 generate \\\n",
72+
" --base debian:stretch --pkg-manager apt \\\n",
73+
" --fsl version=5.0.10 \\\n",
74+
" --miniconda env_name=neuro \\\n",
75+
" conda_install=\"python=3.6 traits\" \\\n",
76+
" pip_install=\"nipype\" > Dockerfile\n",
77+
"\n",
78+
" docker build --tag my_image .\n",
79+
" # or\n",
80+
" docker build --tag my_image - < Dockerfile"
81+
]
82+
},
83+
{
84+
"cell_type": "markdown",
85+
"metadata": {},
86+
"source": [
87+
"## Use NeuroDebian\n",
88+
"\n",
89+
"This example installs AFNI and ANTs from the NeuroDebian repositories. It also\n",
90+
"installs ``git`` and ``vim``.\n",
91+
"\n",
92+
" docker run --rm kaczmarj/neurodocker:v0.3.2 generate \\\n",
93+
" --base neurodebian:stretch --pkg-manager apt \\\n",
94+
" --install afni ants git vim\n",
95+
"\n",
96+
"**Note**: the ``--install`` option will install software using the package manager.\n",
97+
"Because the NeuroDebian repositories are enabled in the chosen base image, AFNI\n",
98+
"and ANTs may be installed using the package manager. ``git`` and ``vim`` are\n",
99+
"available in the default repositories."
100+
]
101+
},
102+
{
103+
"cell_type": "markdown",
104+
"metadata": {},
105+
"source": [
106+
"## Other examples\n",
107+
"\n",
108+
"Create a container with ``dcm2niix``, Nipype, and jupyter notebook. Install\n",
109+
"Miniconda as a non-root user, and activate the Miniconda environment upon\n",
110+
"running the container.\n",
111+
"\n",
112+
" docker run --rm kaczmarj/neurodocker:v0.3.2 generate \\\n",
113+
" --base centos:7 --pkg-manager yum \\\n",
114+
" --dcm2niix version=master \\\n",
115+
" --user neuro \\\n",
116+
" --miniconda env_name=neuro conda_install=\"jupyter traits nipype\" \\\n",
117+
" > Dockerfile\n",
118+
" docker build --tag my_nipype - < Dockerfile\n",
119+
"\n",
120+
"Copy local files into a container.\n",
121+
"\n",
122+
" docker run --rm kaczmarj/neurodocker:v0.3.2 generate \\\n",
123+
" --base ubuntu:16.04 --pkg-manager apt \\\n",
124+
" --copy relative/path/to/source.txt /absolute/path/to/destination.txt"
125+
]
126+
}
127+
],
128+
"metadata": {
129+
"kernelspec": {
130+
"display_name": "Python [default]",
131+
"language": "python",
132+
"name": "python3"
133+
},
134+
"language_info": {
135+
"codemirror_mode": {
136+
"name": "ipython",
137+
"version": 3
138+
},
139+
"file_extension": ".py",
140+
"mimetype": "text/x-python",
141+
"name": "python",
142+
"nbconvert_exporter": "python",
143+
"pygments_lexer": "ipython3",
144+
"version": "3.6.5"
145+
}
146+
},
147+
"nbformat": 4,
148+
"nbformat_minor": 2
149+
}

0 commit comments

Comments
 (0)