Installing Bioconductor packages in Docker
1
0
Entering edit mode
adklts • 0
@adklts-21974
Last seen 3.7 years ago

Good afternoon. In my Dockerfile, I try to upload Bioconductor packages for a Shiny app in the following way

RUN Rscript -e 'install.packages("BiocManager")'

RUN Rscript -e 'BiocManager::install("rtracklayer")'

During the installation, I do not receive any kind of issue. But after when I try to run the app in Docker I receive a message that does not exist the packages of Bioconductor. Could anybody help me, please?

Bioconductor DOCKER RShiny • 6.3k views
ADD COMMENT
1
Entering edit mode

Has someone figured out what to do here? I'm having the same issue (apparent install while building the container, but the library cannot be subsequently loaded). I assume that this is a paths issue?

It seems like the responses below suggest changing to a BioC base image, but can someone please suggest a solution in situations where this is not practical?

ADD REPLY
0
Entering edit mode

Hi,

Can you tell me what base docker image you are using? (i.e you need a line in your Dockerfile like FROM bioconductor/bioconductor_docker:RELEASE_3_12 or some other image of that sort)

The information you have currently provided isn't enough for me to help you.

Best,

Nitesh

ADD REPLY
0
Entering edit mode

Thank you very much for the answer I am uploading the dockerfile after the insert pf Bioconductor

# Base image https://hub.docker.com/u/rocker/
FROM rocker/shiny:latest

# system libraries of general use
## install debian packages
RUN apt-get update -qq && apt-get -y --no-install-recommends install \
    libxml2-dev \
    libcairo2-dev \
    libsqlite3-dev \
    libmariadbd-dev \
    libpq-dev \
    libssh2-1-dev \
    unixodbc-dev \
    libcurl4-openssl-dev \
    libssl-dev \
    coinor-libcbc-dev coinor-libclp-dev libglpk-dev


## update system libraries
RUN apt-get update && \
    apt-get upgrade -y && \
    apt-get clean

# copy necessary files
## app folder
COPY ./bms_msisuite ./app

# Docker inheritance
FROM bioconductor/bioconductor_docker:devel

RUN apt-get update
    RUN R -e 'BiocManager::install(ask = F)' && R -e 'BiocManager::install(c("rtracklayer", \
    "GenomicAlignments", "Biostrings", "SummarizedExperiment", "Rsamtools", ask = F))'
# install renv & restore packages
RUN Rscript -e 'install.packages("renv")'
RUN Rscript -e 'install.packages("devtools")'
RUN Rscript -e 'install.packages("shiny")'
RUN Rscript -e 'install.packages("shinyBS")'
RUN Rscript -e 'install.packages("ggvis")'
RUN Rscript -e 'install.packages("shinydashboardPlus")'
RUN Rscript -e 'install.packages("shinycssloaders")'
RUN Rscript -e 'install.packages("shinyWidgets")'
RUN Rscript -e 'install.packages("plotly")'
RUN Rscript -e 'install.packages("RSQLite")'
RUN Rscript -e 'install.packages("forecast", dependencies = TRUE)'
RUN Rscript -e 'install.packages("tsutils")'
RUN Rscript -e 'install.packages("readxl")'
RUN Rscript -e 'install.packages("tidyverse")'
RUN Rscript -e 'install.packages("knitr")'
RUN Rscript -e 'install.packages("knitcitations")'
RUN Rscript -e 'install.packages("nycflights13")'
RUN Rscript -e 'install.packages("Matrix")'
RUN Rscript -e 'install.packages("plotly")'
RUN Rscript -e 'install.packages("igraph")'
RUN Rscript -e 'install.packages("ggthemes")'
RUN Rscript -e 'install.packages("evaluate")'
RUN Rscript -e 'install.packages("psych")'
RUN Rscript -e 'install.packages("kableExtra")'
RUN Rscript -e 'install.packages("ggjoy")'
RUN Rscript -e 'install.packages("gtools")'
RUN Rscript -e 'install.packages("gridExtra")'
RUN Rscript -e 'install.packages("cowplot")'
RUN Rscript -e 'install.packages("ggrepel")'
RUN Rscript -e 'install.packages("data.table")'
RUN Rscript -e 'install.packages("stringr")'
RUN Rscript -e 'install.packages("rmarkdown")'
RUN Rscript -e 'install.packages("shinyjqui")'
RUN Rscript -e 'install.packages("V8")'
RUN Rscript -e 'devtools::install_github("ThomasSiegmund/D3TableFilter")'
RUN Rscript -e 'devtools::install_github("leonawicz/apputils")'
RUN Rscript -e 'devtools::install_github("Marlin-Na/trewjb")'

RUN Rscript -e 'devtools::install_github("dirkschumacher/ompr")'
RUN Rscript -e 'devtools::install_github("dirkschumacher/ompr.roi")'

RUN Rscript -e 'install.packages("ROI.plugin.glpk")'

RUN Rscript -e 'install.packages("shinydashboard")'
RUN Rscript -e 'install.packages("dplyr")'
RUN Rscript -e 'install.packages("dashboardthemes")'
RUN Rscript -e 'install.packages("shinyjs")'
RUN Rscript -e 'install.packages("magrittr")'
RUN Rscript -e 'install.packages("DT")'
RUN Rscript -e 'install.packages("rhandsontable")'
RUN Rscript -e 'renv::consent(provided = TRUE)'
RUN Rscript -e 'renv::restore()'



# expose port
EXPOSE 3838

# run app on container start
CMD ["R", "-e", "shiny::runApp('/app', host = '0.0.0.0', port = 3838)"]
ADD REPLY
0
Entering edit mode

Hi, did you find a solution?

ADD REPLY
0
Entering edit mode
@konstantinos-yeles-8961
Last seen 12 months ago
Italy

Hello, adklts My way to do the installation of packages in a docker is like this:

    FROM bioconductor/bioconductor_docker:devel

    RUN apt-get update
    RUN R -e 'BiocManager::install(ask = F)' && R -e 'BiocManager::install(c("magick", \
    "tidyverse", "vroom", "VennDiagram", "PerformanceAnalytics", \
    "GO.db", "corrplot", ask = F))' && R -e 'tinytex::install_tinytex()'

Hope it helps!

ADD COMMENT
0
Entering edit mode

Thanks for the answer. I follow instructions but when I run the app from docker I receive the follow message

shiny::runApp('/app', host = '0.0.0.0', port = 3838) Error in shinyAppDir(x) : No Shiny application exists at the path "/app" Calls:

<Anonymous> ... as.shiny.appobj -> as.shiny.appobj.character -> shinyAppDir Execution halted

This is related with bioconductor because when I deactivate the packages the app running.....but the point is that I need bioconductor. Have relation the position that i insert your code in dockerfile?

ADD REPLY
0
Entering edit mode

Probably it has but as I haven't deployed a shiny app from docker yet I cannot say much. Have you tried to move :

# copy necessary files
## app folder
COPY ./bms_msisuite ./app

after the Bioconductor call?

# Docker inheritance
FROM bioconductor/bioconductor_docker:devel  

RUN apt-get update
    RUN R -e 'BiocManager::install(ask = F)' && R -e 'BiocManager::install(c("rtracklayer", \
    "GenomicAlignments", "Biostrings", "SummarizedExperiment", "Rsamtools", ask = F))'
# install renv & restore packages 
 .......
# copy necessary files
## app folder
COPY ./bms_msisuite ./app
ADD REPLY
0
Entering edit mode

How do you run your image after this? I need to specify a password...

ADD REPLY
0
Entering edit mode

I have installed BiocManager on my base image rather than having it as base image.

RUN Rscript -e "install.packages('BiocManager', repos = 'https://packagemanager.rstudio.com/all/__linux__/centos7/latest')" \
    && Rscript -e "options(repos = BiocManager::repositories())" \
    && Rscript -e "BiocManager::install(ask=FALSE)" \
    && Rscript -e "BiocManager::install(c('ropls'), ask=FALSE)"
ADD REPLY

Login before adding your answer.

Traffic: 449 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