bashdockersingularity-container

Singularity/docker: bash script does not parse arguments


I have this tool that I want to use through singularity to process sequencing data. The main script is written in bash. I successfully changed /bin/shto /bin/bash through an ENTRYPOINT but my arguments aren't parsed. Even not giving arguments is ignoring the Help function display. My Dockerfile is :

FROM ubuntu:latest
ENV DEBIAN_FRONTEND=noninteractive
USER root
COPY ./install_docker.sh ./
RUN chmod +x ./install_docker.sh && sh ./install_docker.sh
ENTRYPOINT ["/bin/bash", "/Metadbgwas/metadbgwas.sh"]
ENV PATH="/Metadbgwas/:${PATH}"
ENV OPENSSL_CONF=/dev/null

The instal_docker.sh :

apt-get update
apt install -y libgatbcore-dev libhdf5-dev libboost-all-dev libpstreams-dev zlib1g-dev g++ cmake git r-base-core
Rscript -e "install.packages(c('ape', 'phangorn'))"
Rscript -e "install.packages('https://raw.githubusercontent.com/sgearle/bugwas/master/build/bugwas_1.0.tar.gz', repos=NULL, type='source')"
git clone --recursive https://github.com/Louis-MG/Metadbgwas.git
cd Metadbgwas
chmod +x metadbgwas.sh
chmod +x ./tools/phantomjs/phantomjs
chmod +x ./tools/gemma/gemma.0.93b
sed -i "51i#include <limits>" ./REINDEER/blight/robin_hood.h #temporary fix for REINDEER compilation

The last line fixes a bug for phantomjs. You can test the singularity with the following command : singularity pull docker://007ptar007/metadbgwas:latest

An exemple of how the tool would be used outside of the singularity:

bash metadbgwas.sh --files ./input --output ./output --K 17 6000000 --strains ./strains 

I should see: Starting Lighter ... and the output of the tool Lighter, included in mine, and then the rest of the processing.


Solution

  • It appears that removing the line USER root solved my problem. Using the ENTRYPOINT ["/bin/bash"] was not necessary after the modification. The Dockerfile has the final form:

    FROM ubuntu:latest
    ENV DEBIAN_FRONTEND=noninteractive
    
    COPY ./install_docker.sh ./
    RUN chmod +x ./install_docker.sh && sh ./install_docker.sh
    
    ENTRYPOINT ["/Metadbgwas/metadbgwas.sh"]
    ENV PATH="/Metadbgwas/:${PATH}"
    ENV OPENSSL_CONF=/dev/null
    

    I have no idea why, but this is for another thread.