Any Expert in Singularity can help me convert a Docker script ?

98 views
Skip to first unread message

Nidhal Ghanmi

unread,
Nov 28, 2021, 4:30:49 AM11/28/21
to singularity
Hi


I have a tool named Big-Mex that researchers have to use it

I am asked to make it run with singularity

the code is simple as I see .. just can not get the things on my mind

Docker code :

  docker run \
    --volume ${INPUT_DIR}:${CONTAINER_SRC_DIR}:rw \
    --volume ${OUTPUT_DIR}:${CONTAINER_DST_DIR}:rw \
    --detach=false \
    --rm \
    --user $(id -u):$(id -g) \
     epereira/bgc_class_pred:latest \
    --input "${CONTAINER_SRC_DIR}/${INPUT_FILE}" \
    --bgc_models "${CONTAINER_SRC_DIR}/${MODELS}" \
    --outdir "${OUTPUT}" \

So ... the options I have some issues with

Any one please can clarify ? this code is working with docker , but asked for singularity

Thanks
Nidhal

v

unread,
Nov 28, 2021, 4:47:57 AM11/28/21
to singu...@lbl.gov
Generally you can do:

singularity pull docker://epereira/bgc_class_pred:latest
singularity exec <options> <container> <entrypoint> <command-args>  # use your own entrypoint/command
singularity run <options> <container> <command-args>  # use the docker set entrypoint/cmd

and for both you might run into issue if the container expects a working directory (Singularity doesn't honor this, but you can set --pwd for the present working directory) OR there are scripts/assets in roots home, which you couldn't see as your user. So I'd probably first try:

singularity run --bind ${INPUT_DIR}:${CONTAINER_SRC_DIR} --bind ${OUTPUT_DIR}:${CONTAINER_DST_DIR} bgc_class_pred_latest.sif --input "${CONTAINER_SRC_DIR}/${INPUT_FILE}" --bgc_models "${CONTAINER_SRC_DIR}/${MODELS}" --outdir "${OUTPUT}"

and if you need to look around the container and test things first interactively you can use singularity shell <container>/
And then report back here with errors/issues you run into. Sharing the expected entrypoint/cmd would help too.



--
You received this message because you are subscribed to the Google Groups "singularity" group.
To unsubscribe from this group and stop receiving emails from it, send an email to singularity...@lbl.gov.
To view this discussion on the web visit https://groups.google.com/a/lbl.gov/d/msgid/singularity/0691b522-28a8-41ee-851b-f46e96e4dcfan%40lbl.gov.

Nidhal Ghanmi

unread,
Nov 28, 2021, 5:56:28 AM11/28/21
to singularity, vanessa
Hey vanessa

Thanks for that code

I am still cofused ! I did the changes on the bash sscript , but still getting a strange issue !


The full code is in attached

the issue is with some overwrite thing .. I tryed all even creating a new work directory but getting same issue

[kcnedal@kcgebhpc test_dir]$ ./run_bgc_class_pred.bash . . --version
. already exist. Use "--overwrite t" to overwrite.

Regards
Nidhal
run_bgc_class_pred.bash

v

unread,
Nov 28, 2021, 9:27:41 AM11/28/21
to Nidhal Ghanmi, singularity
Sounds like you need to debug the script and understand the container entry point, which I can’t help you with unless I did it myself.

Nidhal Ghanmi

unread,
Nov 28, 2021, 11:37:51 PM11/28/21
to singularity, vanessa, singularity, Nidhal Ghanmi
Thank you VAnessa !

I will try to look upon it

Paulina Paiz

unread,
Jan 5, 2022, 11:19:39 AM1/5/22
to singularity, vanessa, singularity
Hi Vanessa, 

Thank you for supporting new users to Singularity! I also have a dockerfile and a singularity definition file but I haven't managed to get the container working on my HPC. When I execute `singularity shell image.sif" the container doesn't have it's own filesystem as I have seen in tutorials. It might also be useful to note that the remote builder was able to get to the layer of renv::restore() but then it timed out after 1 hour. 

Here is my dockerfile for reference:
FROM rocker/rstudio:4.1.1
MAINTAINER paudocker02 <paulin...@gladstone.ucsf.edu>

# Install system dependencies for R
RUN apt-get update -qq && \
DEBIAN_FRONTEND=noninteractive apt-get install -y \
apt-transport-https \
build-essential \
gfortran \
libatlas-base-dev \
libbz2-dev \
libcairo2-dev \
libxml2-dev \
libicu-dev \
liblzma-dev \
libpango-1.0-0 \
libpangocairo-1.0-0 \
libpcre3-dev \
libtcl8.6 \
libtiff5 \
libtk8.6 \
libx11-6 \
libxt6 \
libxt-dev \
locales \
tzdata \
libglib2.0-dev \
zlib1g-dev \
meson \
pkg-config \
gtk-doc-tools \
libfreetype6-dev \
libpng-dev \
libtiff5-dev \
libjpeg-dev \
libharfbuzz-dev \
libfribidi-dev \
libbz2-dev \
libgsl0-dev

RUN apt-get update && apt-get install -y --no-install-recommends \
python3-dev \
python3-pip

# Install Python packages
RUN pip3 install MACS2

ENV RENV_VERSION 0.14.0
RUN R -e "install.packages('remotes', repos = c(CRAN = 'https://cloud.r-project.org'))"
RUN R -e "remotes::install_github('rstudio/renv@${RENV_VERSION}')"

WORKDIR /home/rstudio/myproject/
COPY renv.lock renv.lock

WORKDIR /home/rstudio/
RUN chown -R rstudio .
RUN R -e 'renv::restore()'

and my singularity definition file:
Bootstrap: docker
From: rocker/tidyverse:4.1.1

%post
# Install system dependencies for R

apt-get update -qq && \
DEBIAN_FRONTEND=noninteractive apt-get install -y \
apt-transport-https \
build-essential \
gfortran \
libatlas-base-dev \
libbz2-dev \
libcairo2-dev \
libxml2-dev \
libicu-dev \
liblzma-dev \
libpango-1.0-0 \
libpangocairo-1.0-0 \
libpcre3-dev \
libtcl8.6 \
libtiff5 \
libtk8.6 \
libx11-6 \
libxt6 \
libxt-dev \
locales \
tzdata \
libglib2.0-dev \
zlib1g-dev \
meson \
pkg-config \
gtk-doc-tools \
libfreetype6-dev \
libpng-dev \
libtiff5-dev \
libjpeg-dev \
libharfbuzz-dev \
libfribidi-dev \
libbz2-dev \
libgsl0-dev
apt-get update && apt-get install -y --no-install-recommends \
python3-dev \
python3-pip

# Install Python packages
pip3 install MACS2

# Install R packages
R -e "install.packages('remotes', repos = c(CRAN = 'https://cloud.r-project.org'))"
R -e "remotes::install_github('rstudio/re...@0.14.0')"

# pull in an renv manifest file and restore it to load pacakges
R -e 'renv::restore()'


%runscript
exec /bin/bash "$@"
%startscript
exec /bin/bash "$@"

Dave Dykstra

unread,
Jan 13, 2022, 12:43:09 PM1/13/22
to singu...@lbl.gov, vanessa
Paulina,

Since you are using the remote builder you must be a Sylabs customer.
I suggest you contact them directly through their website.

Dave
> >>>>> <https://groups.google.com/a/lbl.gov/d/msgid/singularity/0691b522-28a8-41ee-851b-f46e96e4dcfan%40lbl.gov?utm_medium=email&utm_source=footer >
> >>>>> .
> >>>>>
> >>>>
>
> --
> You received this message because you are subscribed to the Google Groups "singularity" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to singularity...@lbl.gov.
> To view this discussion on the web visit https://groups.google.com/a/lbl.gov/d/msgid/singularity/d4b5f37e-0430-4714-b8f7-8992dfbd3958n%40lbl.gov .
Reply all
Reply to author
Forward
0 new messages