Skip to content

Commit a1531a8

Browse files
author
Jakub Kaczmarzyk
committed
add brief neurodocker tutorial
1 parent dca8f56 commit a1531a8

File tree

2 files changed

+112
-2
lines changed

2 files changed

+112
-2
lines changed

doc/users/install.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ You can follow the `Nipype tutorial <https://miykael.github.io/nipype_tutorial/>
1414
or use this docker container: `docker pull nipype/nipype`
1515

1616
or if you want to build custom docker containers with specific versions of
17-
software see `Neurodocker <https://github.com/kaczmarj/neurodocker>`_
17+
software see Neurodocker_. Read the `brief tutorial <neurodocker.html>`_.
1818

1919
Using conda
2020
~~~~~~~~~~~
@@ -108,7 +108,7 @@ Interface Dependencies
108108
Nipype provides wrappers around many neuroimaging tools and contains some
109109
algorithms. These tools will need to be installed for Nipype to run. You can
110110
create containers with different versions of these tools installed using
111-
`Neurodocker <https://github.com/kaczmarj/neurodocker>`_
111+
Neurodocker_. Read the `brief tutorial <neurodocker.html>`_.
112112

113113
Installation for developers
114114
---------------------------

doc/users/neurodocker.rst

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
.. _neurodocker_tutorial:
2+
3+
====================
4+
Neurodocker tutorial
5+
====================
6+
7+
This page covers the steps to create containers with Neurodocker_.
8+
9+
Neurodocker_ is a command-line program that enables users to generate Docker_
10+
containers that include neuroimaging software. These containers can be
11+
converted to Singularity_ containers for use in high-performance computing
12+
centers.
13+
14+
Requirements:
15+
16+
* Docker_
17+
* Internet connection
18+
19+
20+
Usage
21+
-----
22+
23+
To view the Neurodocker help message
24+
::
25+
docker run --rm kaczmarj/neurodocker:v0.3.2 generate --help
26+
27+
1. Users must specify a base Docker image and the package manager. Any Docker
28+
image on DockerHub can be used as your base image. Common base images
29+
include ``debian:stretch``, ``ubuntu:16.04``, ``centos:7``, and the various
30+
``neurodebian`` images. If users would like to install software from the
31+
NeuroDebian repositories, it is recommended to use a ``neurodebian`` base
32+
image. The package manager is ``apt`` or ``yum``, depending on the base
33+
image.
34+
2. Next, users should configure the container to fit their needs. This includes
35+
installing neuroimaing software, installing packages from the chosen package
36+
manager, installing Python and Python packages, copying files from the local
37+
machine into the container, and other operations. The list of supported
38+
neuroimaging software packages is available in the ``neurodocker`` help
39+
message.
40+
3. The ``neurodocker`` command will generate a Dockerfile. This Dockerfile can
41+
be used to build a Docker image with the ``docker build`` command.
42+
43+
44+
Create a Dockerfile with FSL, Python 3.6, and Nipype
45+
----------------------------------------------------
46+
47+
This command prints a Dockerfile (the specification for a Docker image) to the
48+
terminal.
49+
::
50+
$ docker run --rm kaczmarj/neurodocker:v0.3.2 generate \
51+
--base debian:stretch --pkg-manager apt \
52+
--fsl version=5.0.10 \
53+
--miniconda env_name=neuro \
54+
conda_install="python=3.6 traits" \
55+
pip_install="nipype"
56+
57+
58+
Build the Docker image
59+
----------------------
60+
61+
The Dockerfile can be saved and used to build the Docker image
62+
::
63+
$ docker run --rm kaczmarj/neurodocker:v0.3.2 generate \
64+
--base debian:stretch --pkg-manager apt \
65+
--fsl version=5.0.10 \
66+
--miniconda env_name=neuro \
67+
conda_install="python=3.6 traits" \
68+
pip_install="nipype" > Dockerfile
69+
$ docker build --tag my_image .
70+
$ # or
71+
$ docker build --tag my_image - < Dockerfile
72+
73+
74+
Use NeuroDebian
75+
---------------
76+
77+
This example install AFNI and ANTs from the NeuoDebian repositories. It also
78+
installs ``git`` and ``vim``.
79+
::
80+
$ docker run --rm kaczmarj/neurodocker:v0.3.2 generate --base neurodebian:stretch --pkg-manager apt --install afni ants git vim
81+
82+
Note: the ``--install`` option will install software using the package manager.
83+
Because the NeuroDebian repositories are enabled in the chosen base image, AFNI
84+
and ANTs may be installed using the package manager. git and vim are available
85+
in the default repositories.
86+
87+
88+
Other examples
89+
--------------
90+
91+
Create a container with ``dcm2niix``, Nipype, and jupyter notebook. Install
92+
Miniconda as a non-root user, and activate the miniconda environment upon
93+
running the container.
94+
::
95+
$ docker run --rm kaczmarj/neurodocker:v0.3.2 generate \
96+
--base centos:7 --pkg-manager yum \
97+
--dcm2niix version=master \
98+
--user neuro \
99+
--miniconda env_name=neuro conda_install="jupyter traits nipype" \
100+
> Dockerfile
101+
$ docker build --tag my_nipype - < Dockerfile
102+
103+
104+
Copy local files into a container.
105+
::
106+
$ docker run --rm kaczmarj/neurodocker:v0.3.2 generate \
107+
--base ubuntu:16.04 --pkg-manager apt \
108+
--copy relative/path/to/source.txt /absolute/path/to/destination.txt
109+
110+
.. include:: ../links_names.txt

0 commit comments

Comments
 (0)