Skip to content

Configure Docker with CemrgApp

Jose Alonso Solis-Lemus edited this page Jun 1, 2022 · 2 revisions

To run all of CemrgApp's specialised modules, such as the machine learning pipeline for scar quantification, Docker is required to be installed on the user's computer. We also use Docker to expand and collaborate with other centres' software.

Download Docker

Docker can be downloaded or installed from:

  • Docker for Linux.
    • You need to provide access to Docker by following these instructions, or see below for a summarised version of the instructions.
    • WARNING: this will give root access to Docker containers.
  • Docker for macOS.
    • Simple installation and running.
  • Docker for Microsoft Windows.

Configure Docker on Ubuntu

To install, run the commands outlined in this guide. Once installed, you need to run the following commands to make sure you can run Docker from within CemrgApp (without the need for sudo).

Step 1. Create the docker group: sudo groupadd docker

Step 2. Add your user to the docker group sudo usermod -aG docker $USER

run the following command to activate the changes to groups: newgrp docker

Step 3. Restart (or Log out and log back in) so that your group membership is re-evaluated.

Step 4. Verify that you can run docker commands without sudo. docker run --rm hello-world

This command downloads a test image and runs it in a container. When the container runs, it prints a message and exits.

If things still do not work

If you initially ran Docker CLI commands using sudo before adding your user to the docker group, you may see the following error, which indicates that your ~/.docker/ directory was created with incorrect permissions due to the sudo commands.

WARNING: Error loading config file: /home/user/.docker/config.json -
stat /home/user/.docker/config.json: permission denied

To fix this problem, either remove the ~/.docker/ directory (it is recreated automatically, but any custom settings are lost), or change its ownership and permissions using the following commands:

sudo chown "$USER":"$USER" /home/"$USER"/.docker -R
sudo chmod g+rwx "$HOME/.docker" -R

Configure on Windows

  1. You need to setup the windows subsystem for linux (WSL 2) here.
  2. Install docker desktop interactively using the instructions here.

Test your configuration

Before running CemrgApp for the first time, run the following two commands in the terminal:

docker pull biomedia/mirtk:v1.1.0
docker pull orodrazeghi/cemrgnet

Both commands will ensure the machine has access to all the necessary external software to run the CemrgApp specialised modules. The first command gets the Docker container for all the MIRTK libraries we employ, while the second command gets the Docker container for our in-house automatic segmentation machine learning model.

The time downloading varies with the internet connection. In general, it should not take more than 10 minutes from start to finish. Such process looks as shown below:

The terminal in macOS is in the Applications folder under Utilities, conversely, you can use Spotlight and type "Terminal" to find it quicker.