I am trying to build a singularity container with nextflow installed. After doing the build I install it in a dir and it is installed as ROOT. When I try to run the container it fails since I am not root. I looked over the best practices and it says the following:
Always install packages, programs, data, and files into operating system locations (e.g. not /home, /tmp , or any other directories that might get commonly binded on).
My def file:
BootStrap: yum
OSVersion: 7
MirrorURL: http://mirror.centos.org/centos-%{OSVERSION}/%{OSVERSION}/os/$basearch/
Include: yum
%post
yum -y install java-1.8.0-openjdk-headless
yum -y install wget
yum -y install which
mkdir /s2fast
cd /s2fast
wget -qO- https://get.nextflow.io | bash
%runscript
exec /s2fast/nextflow
Running it gets me 'Permission Denied' I'm running singularity 3.4.0-1
Not sure if I should be looking at using bind paths, overlays, or something else?
If your container only needs Nextflow, may I suggest using the Nextflow biocontainer from quay.io?
singularity pull docker://quay.io/biocontainers/nextflow:19.07.0--hecc5488_0
If you need to install other apps along with Nextflow, usually one would install these into /usr/local/bin
. But there's nothing wrong with using custom directory paths like what you are doing. In any case, you need to make sure these apps have the necessary permissions. Just add chmod 755 /s2fast/nextflow
to your %post section. Also remove your %runscript section. It's not usually needed unless you need to process command-line arguments.