Docker
Docker containers are one way of establishing a fixed software environment. This is ideal for sharing the exact version and setup used for running your project.
Using
Hints
- Use bind mounts to map an actual path to a virtual one within the container like
-v /abs/actual/path:/path/in/container- bind mount files that might otherwise be downloaded and discarded like TemplateFlow.
- use
--userto not run as root.--user $(id -u):$(id -g). w/o user, containers may run as root and - export variables for your local environment to the container like
--env FS_LICSENSE- combine with bind mount
- rundocker.bash
docker run -v $FS_LICENSE:$FS_LICENSE --env FS_LICENSE freesurfer/freesurfer
- use
--entrypointto change what gets run. eg-it --entrypoint bashfor debugging.
Creating
On rhea
on Rhea (linux server), docker containers are stored in /home/ni_tools/docker replacing the default folder /var/lib/docker with a symbolic link
ls -l /var/lib/docker lrwxrwxrwx 1 root root 21 Apr 18 2018 /var/lib/docker -> /home/ni_tools/docker df -h /home Filesystem Size Used Avail Use% Mounted on /dev/sdc2 3.4T 952G 2.3T 30% /home