====== 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 ===== see [[https://fmriprep.org/en/20.2.0/docker.html|fmriprep's docker documenation]] ==== 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 [[:tools:templateflow]]. * use ''%%--user%%'' to 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 docker run -v $FS_LICENSE:$FS_LICENSE --env FS_LICENSE freesurfer/freesurfer * use ''%%--entrypoint%%'' to change what gets run. eg ''%%-it --entrypoint bash%%'' for debugging. ===== Creating ===== see [[https://journals.plos.org/ploscompbiol/article?id=10.1371/journal.pcbi.1008316|Ten simple rules for writing Dockerfiles for reproducible data science]] ===== On rhea ===== on [[admin:it:rhea]], 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