Skip to content

SIRF SuperBuild on Docker

Casper da Costa-Luis edited this page Jan 26, 2018 · 26 revisions

Docker

Docker is a low-overhead, container-based replacement for virtual machines (VMs).

This works best on a linux system due to:

  1. Possibility to get CUDA support within the container
  2. X11 windows displayed natively without needing e.g. a vnc server or desktop in the container
  3. Really short installation instructions (see below)

Prerequisites

SIRF Container Building

The docker image can be built from source using CCPPETMR/SIRF-SuperBuild and docker-compose by following the steps below. Alternatively, simply run docker pull ccppetmr/sirf to download the pre-built image.

Linux

For easier file and window sharing, the container should be built using the host user's ID and some environment variables.

SIRF-SuperBuild/docker$ docker-compose -f docker-compose.yml \
  -f docker-compose.nix.yml build \
  --build-arg UID=$(id -u) --build-arg GROUPS=$(id -g) sirf
SIRF-SuperBuild/docker$ docker-compose create

Windows

For the first step, instead of passing user IDs, Windows requires that file sharing is enabled.

SIRF-SuperBuild/docker> docker-compose create

Usage

Well, that was easy. This will have pulled ubuntu:16.04, and fetched and built SIRF and all its dependencies into an image tagged in docker as ccppetmr/sirf. A container called sirf is then created based on this image. The container can be run interactively for daily use.

SIRF-SuperBuild/docker$ docker-compose start -ai sirf
sirf:~$ gadgetron &
sirf:~$ python SIRF-SuperBuild/SIRF/examples/Python/MR/fully_sampled_recon.py

The first line starts the sirf docker container. The second line starts gadgetron within the container as a background process. Finally, we can then run an example. Note that the devel folder in the host's SIRF-SuperBuild/docker directory is mounted to /devel in the container.

Notes

  • "Cannot connect to display" errors are usually fixed by running xhost +local:"" on the host linux system
  • Non-linux users (e.g. Windows) will need to set up a desktop and vnc server in order to have a GUI (docker files coming soon)
  • On host systems with less than 16GB RAM, before docker-compose create you may want to edit SIRF-SuperBuild/docker/user_sirf-ubuntu.sh, changing the line make -j to simply make. This increases build time and reduces build memory requirements.