% build: # Build Containers ## Option #1 ```bash # opts ----- group="freesurfer" software="freesurfer" ver="7.1.1" # paths ----- export SINGULARITY_TMPDIR="${root_dir}/software/singularity_images/tmp" export SINGULARITY_CACHEDIR="${root_dir}/software/singularity_images/cache" # main ----- cmd="singularity build \ ${root_dir}/software/singularity_images/${software}-${ver}.simg \ docker://${group}/${software}:${ver}" echo -e "\ncommand:\n${cmd}\n" eval ${cmd} ``` ## Option #2 If the first option doesn't work, try running this locally. Assuming that you have docker installed and working () ```bash # opts ----- group="freesurfer" software="freesurfer" ver="7.1.1" # paths ----- out_dir="${root_dir}/software/singularity_images" # main ----- cmd="docker run \ -v /var/run/docker.sock:/var/run/docker.sock \ -v ${out_dir}:/output \ --privileged \ --tty \ --rm \ singularityware/docker2singularity \ ${group}/${software}:${ver}" echo -e "\ncommand:\n${cmd}\n" eval ${cmd} ``` ## Option #3 If the two first options don't work, obtain or create a docker file (advanced option). ```bash docker build -t ``` To check if the image was created: ```bash docker images ``` Then, run option #2 to save the docker image as a singularity image For a current list of dockerfiles that we have created along with code to create the docker container and singularity image, see the following [page](https://github.com/epongpipat/dockerfiles)