spinalcordtoolbox / sct_docker

Docker distribution of Spinal Cord Toolbox
3 stars 3 forks source link
docker-image neuroimaging testing-tool

.. -- coding: utf-8; indent-tabs-mode:nil; --

###################################################### ⚠️ Disclaimer: This repository is no longer maintained ######################################################

To use the newest version of SCT in a Docker container, please visit the installation instructions found on https://spinalcordtoolbox.com/.


Spinal Cord Toolbox Docker

This documentation shows how to install SCT within a Docker container. If you want install a different version of SCT please specify the version number you want.

.. contents:: .. 1 Docker for Windows 1.1 Installation 1.2 Video tutorials 1.3 Usage 2 Docker for Unix like OSes (GNU/Linux, BSD family, MacOS) 2.1 Installation 2.2 Usage 3 Offline Archives 3.1 Usage 4 Generation and Distribution 4.1 Notes 5 Support

Docker for Windows ##################

That would be the main reason to use Docker, as SCT can be installed directly pretty much anywhere else.

Note: in case of problem, see Support_.

When using Docker Toolbox, mounting folders in a docker container can be a bit complicated and has certain limitations. The main limitation is that by default we will only be able to mount folders that are inside the C:/Users folder, for compatibility reasons we will consider a shared folder under this folder, but it can be changed.

To be able to process NIFTI volumes that we have in our Windows PC we will go to the folder C:/Users and create a folder called docker_shared_folder This folder that we have just created will be our work folder in which we will place all the volumes that we want to process using the SCT.

Installation


. Install git <https://git-scm.com/download/win>_ (in case you don't already have it), this is to provide

an SSH binary.

. Install Xming <https://sourceforge.net/projects/xming/files/Xming/6.9.0.31/>_.

. Install Docker:

. Fetch the SCT image

Either:

. If you are NOT using Docker Toolbox skip this step. To avoid

memory issues when running the SCT is important to increment the default amount of RAM (1GB) of the Docker VM. To do this:

Open Docker Quickstart Terminal wait until get a prompt and run:

.. code:: sh

  docker-machine stop default

  /c/Program\ Files/Oracle/VirtualBox/VBoxManage.exe modifyvm default --memory 3072

  docker-machine start default

Note: With these commands we have increased the RAM memory of the VM Docker to 3GB. It is important that your PC has at least 4 GB of RAM in order to leave at least 1 GB for your Windows host system.

. For sharing folders between host and container:

. Go to C:/Users/Public and create the folder named

  ``docker_shared_folder``

. If running Docker for Windows, click the Docker tray icon,

  run settings and allow sharing of your `C:` drive with the container,
  so as to allow access to the path.

. Finally, reboot your computer after the installation.

(Or you might end up with issues afterwards such as ssh: connect to host localhost port 2222: Cannot assign requested adress )

Video tutorials


Windows 10 home <https://v.youku.com/v_show/id_XNDMwMzQ1OTQ1Ng==.html?spm=a2hzp.8244740.0.0>_

Usage


. Start throw-away container on the image.

. Check the shared folder:

. (NOT MANDATORY) Change the password (default is sct) from the

container prompt:

.. code:: sh

  passwd

. Connect to it using Xming/SSH if X forwarding is needed

(eg. running FSLeyes from there):

Open a new CMD window and clone this repository:

.. code:: sh

  git clone https://github.com/neuropoly/sct_docker.git

If you are using Docker Desktop, run (double click) windows/sct-win.xlaunch. If you are using Docker Toolbox, run windows/sct-win_docker_toolbox.xlaunch

If this is the first time you have done this procedure, the system will ask you if you want to add the remote PC (the docker container) as trust pc, type yes. Then type the password to enter the docker container (by default sct).

If there is no new open windows :

Docker for UNIX (GNU/Linux, BSD family, MacOS) ##############################################

Installation


. Install Docker

. Fetch/install the SCT image:

. If you are on OSX and you need X forwarding (e.g. to run FSLeyes from the ssh window), install Xquartz <https://www.xquartz.org/>_.

After installing Xquartz and after rebooting, run this command to prevent this issue <https://github.com/neuropoly/sct_docker/issues/29>_:

.. code:: sh

  defaults write org.macosforge.xquartz.X11 enable_iglx -bool true

Usage


. Create a folder called docker_shared_folder in your home

directory to be able to share information between your host system a the docker container.

.. code:: sh

  mkdir ~/docker_shared_folder

. Start throw-away container on the image:

.. code:: sh

  docker run -p 2222:22 --rm -it -v ~/docker_shared_folder://home/sct/docker_shared_folder neuropoly/sct:latest

. (NOT MANDATORY) Change the password (default is sct) from the container prompt:

.. code:: sh

  passwd

. Connect to container using SSH if X forwarding is needed

(eg. running FSLeyes from there):

.. code:: sh

  ssh -Y -p 2222 sct@localhost

. Then enjoy SCT ;)

Offline Archives ################

Usage


. Extract archive in /home/sct (unfortunately due to hard-coded paths in the

installation folder, this is mandatory):

.. code:: sh

  cd $HOME
  tar xf /path/to/latest.tar.xz

. Add PATH:

.. code:: sh

  PATH+=":/home/sct/latest/bin"

. Use it!

.. code:: sh

  sct_check_dependencies

Generation and Distribution ###########################

The tool sct_docker_images.py helps with creation and distribution of SCT Docker images.

List of suported distros for docker images:

For the official image that is released on docker hub we use the Ubuntu 18.04 bas image.

List all available images in the registery (you will need wget for this to work):

.. code:: sh

wget -q https://registry.hub.docker.com/v1/repositories/neuropoly/sct/tags -O - | sed -e 's/[][]//g' -e 's/"//g' -e 's/ //g' | tr '}' '\n' | awk -F: '{print $3}'

Example: creation of all distros container images for a specific version:

.. code:: sh

./sct_docker_images.py generate --version 4.2.1

Example: creation of offline archive tarball:

.. code:: sh

./sct_docker_images.py generate --version 4.2.1 --distros ubuntu:18.04 --generate-distro-specific-sct-tarball

Example: creation and distribution:

.. code:: sh

docker login # Make sure your account has push permission on neuropoly organization ./sct_docker_images.py generate --version 4.2.1 --publish-under neuropoly/sct

Notes


Support #######

Please try to differentiate issues about the SCT Docker packages or tools, and SCT itself.

In case of problem, create issues on the github project <https://github.com/neuropoly/sct_docker/issues>_ and provide information allowing to quickly assist you.

Thank you!