How to add a BioConductor package to a Docker image based on rocker/shiny
0
0
Entering edit mode
Sam ▴ 10
@sam-21502
Last seen 7 hours ago
Jerusalem

I am trying to create a working docker image (based on Shiny) which includes a BioConductor package. The packages are installed during the build phase, but they do not persist. I have tried installing it using 4 different methods ; none works.

Dockerfile :

FROM rocker/shiny:4.0.5

RUN apt-get update && apt-get install -y \
    libcurl4-gnutls-dev \
    libssl-dev 

# A repo from Rpackagemanager
RUN install2.r --repos=https://packagemanager.rstudio.com/all/2022-08-18+Y3JhbiwyOjQ1MjYyMTU7RkU2MERFREE \
  shinycssloaders \
... \
  BiocManager


RUN install2.r --repos=https://packagemanager.rstudio.com/all/2022-08-18+Y3JhbiwyOjQ1MjYyMTU7RkU2MERFREE \
    littler


# Four different ways to install clusterProfiler

RUN install2.r -r http://bioconductor.org/packages/3.12/bioc --deps TRUE \
    clusterProfile

RUN /usr/local/lib/R/site-library/littler/examples/installBioc.r clusterProfiler

RUN R -e 'BiocManager::install("clusterProfiler", version="3.12")'

RUN R -e 'install.packages("clusterProfiler", repos=BiocManager::repositories())'


COPY ./*.R ./


CMD ["R", "-e" , "shiny::runApp(port=8080, host='0.0.0.0')"]

None of the four ways I tried works.

docker • 1.8k views
ADD COMMENT
0
Entering edit mode

There are probably some docker experts on here that might have better ideas but my initial thought is you might have to have a host specific library set up for persistence. Some helpful links might be the Bioconductor docker which shows our Dockerfile for Bioconductor and the Bioconductor help page that shows how to customize this base docker file with packages or additional system dependencies.

ADD REPLY
0
Entering edit mode

Please show both the full build command docker build ... and the way you assessed / checked that the package was not installed. There is not much magic going on actually, the shown commands should all be fine.

ADD REPLY
0
Entering edit mode

I simply use docker build -t withmistake . and run it with docker run --rm withmistake

and I get the error Error in library(clusterProfiler) : there is no package called ‘clusterProfiler

When I use FROM bioconductor/bioconductor_docker:RELEASE_3_12 instead of FROM rocker/shiny:4.0.5 no such error is thrown, and I even manage do deploy it on fly.io ( however, the image size is about 3GB larger in such a case ).

I prefer a small image size, and (though I don't really know) I think that the Shiny base image would be better for a Shiny app.

ADD REPLY
0
Entering edit mode

Could you provide the error message that you get, so that we can diagnose the problem better?

A strategy that I've used recently was to include the required packages in an Rscript and call that in the Dockerfile

RUN Rscript rpkgs.R

Working example: https://github.com/casbap/ncRNA/tree/main/docker

ADD REPLY
0
Entering edit mode

The error message is simply Error in library(clusterProfiler) : there is no package called ‘clusterProfiler‘

ADD REPLY

Login before adding your answer.

Traffic: 727 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6