/ufo-kit-docker

Dockerfiles UFO framework for tomographic image processing

Primary LanguageDockerfile

Dockerfiles for UFO framework

Dockerfiles for x86_64 GNU/Linux that include components of the UFO framework for tomographic data processing. The following Dockerfiles are included:

  • ufo-kit-base/Dockerfile. Install the .deb packages with apt-get in Ubuntu
  • ufo-kit-dev/Dockerfile. Install ufo-core and ufo-filters from source.

Features

  • Installation of UFO-core and UFO-filters Debian packages
  • X-server access from container to run GUI components

Requirements

  • NVIDIA capable GPU
  • NVIDIA driver
  • Docker 19.03
  • nvidia-container-toolkit

Read the updated information about nvidia-docker. Docker 19.03 supports nvidia without the need for the nvidia-docker wrapper, but nvidia-container-toolkit must be installed to support this. It is suggested to be familiar with basic Docker commands before proceeding.

Setup

GPU driver

The NVIDIA driver for the GPU must be installed on the host.It may be installed alone or along with the CUDA toolkit:

(1) NVIDIA driver; or
(2) CUDA toolkit.

The CUDA toolkit version and driver version must be matched with the GPU architecture of your device. For example, if you intend to use CUDA 10.1 in your container, you must use Linux x86_64 Driver Version >= 418.39.

Build Docker image

Dowload the Dockerfile and save it to a local folder called "ufo". Rename it "Dockerfile." Build the image:

$ docker make ufo ufo-kit:local

If sucessful, the container can be launched:

$ docker run --gpus all -it ufo-kit:local

Check the functionality of the container:

$ nvidia-smi && clinfo

Run interactive container with GUI and data mounted

A GUI-capable container with a folder mapped to the host can be setup as follows. Please consider the security implications of the steps that modify file permisssions and allow access to the x-server of the host.

  1. Permit x-server access from the container.
    Use:
$ xhost +local:root

If desired, this can be reversed later with:

$ xhost -local:root
  1. Set file permissions.
    The directory that will be accessible in the container can permits two-way file sharing. A group 1024 was added to the container during the build, so it is necessary that the host is also a member of this group:
$ dir=/media/user/test
$ chown :1024 $dir
$ chmod 775 $dir
$ chmod g+s $dir

The full command to launch the container with x-server access and data directory mounted:

$ docker run \
	--gpus all \
	-v /media/user/test:/data \
	-v /tmp/.X11-unix:/tmp/.X11-unix \
	-e DISPLAY=unix$DISPLAY \
	-it ufo-kit:local

Consider putting the above command in an executable bash script to launch the container:

$ echo 'docker run --gpus all -v /media/user/test:/data \
	-v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=unix$DISPLAY \
	-it ufo-kit:local' >> ufo-kit-base_launch.sh
$ sudo chmod +x ufo-kit-base_launch.sh
$ ./ufo-kit-base_launch.sh

Inside the container, test a ufo-launch command on a grayscale version of lena:

$ ufo-launch read path=lena_gs.tif ! blur size=20 sigma=5 ! write filename=blur.tif
$ ufo-launch read path=lena_gs.tif ! calculate expression="'v+1000'" ! write filename=plus1000.tif