Installation multiple of CRAN, Bioconductor and Github packages through Docker file in ubunto system

13 Views Asked by At

Dears, I have a problem in installation multiple of packages with different sources using docker file. I have multiple of packages, I divide them according to their sources, then put them in R file to be easily installed. The problem now is:

  • the image building time, it tooks a lot.

  • In addition, I confused on which image I should use from dockerhub for R, should I use rocker/r-base or rocker/r-ver.

  • When I use rocker/rbase:4.3.2 and want to run Rscript, I got always: “Rscript not found” like the following: Step 14/14 : RUN Rscript /install_packages_allprojects1.R —> Running in d0ba0f9029cc /bin/sh: 1: Rscript: not found

But it solved when I add: RUN apt-get update -qq && apt-get -y --no-install-recommends install r-base

So what the difference between this line and importing the image of rocker/r-base itself using FROM rocker/rbase:4.3.2

  • Also despite using rbase:4.3.2, I got this error while install package actuar: ERROR: this R is version 3.6.3, package ‘actuar’ requires R >= 4.1.0

Please help me, here is my docker file:

 FROM rocker/r-base:4.3.2
 FROM rocker/tidyverse:4.3.2
 FROM bioconductor/bioconductor_docker:RELEASE_3_18-R-4.3.2
 FROM python:3.8.18
 FROM ubuntu:20.04

 #Set the timezone
 ARG DEBIAN_FRONTEND=noninteractive
 ENV TZ=Europe/Germany
 RUN apt-get update -qq && apt-get -y --no-install-recommends install tzdata

 #Linux dependencies, install debian packages inside the image
 RUN apt-get update -qq && apt-get -y --no-install-recommends install \
  liblapack-dev \
  libblas-dev \
  libc6 \
  zlib1g-dev \
  libcurl4-openssl-dev \
  libssl-dev \
  libfreetype6-dev \
  libcairo2-dev \
  libx11-dev \
  libjpeg-turbo8-dev \
  libharfbuzz-dev \
  libicu-dev \
  libtiff5-dev \
  libfontconfig1-dev \
  libgsl-dev \
  libgeos-dev \
  libfftw3-dev \
  libgmp-dev \
  libaec-dev \
  libhdf5-dev \
  libxml2-dev \
  libproj-dev \
  libmagick++-6.q16-dev \
  libmagickcore-6.q16-dev \
  libnetcdf-dev \
  unixodbc-dev \
  libpng-dev \
  libgdal-dev \
  libglu1-mesa-dev \
  libglvnd-dev \
  openjdk-11-jre-headless \
  libmysqlclient-dev \
  libudunits2-dev \
  libpq-dev \
  librsvg2-dev \
  libglib2.0-dev \
  libfribidi-dev \
  libtcl8.6 \
  libtk8.6 \
  libwebp-dev

 #set r-base
 RUN apt-get update -qq && apt-get -y --no-install-recommends install \
  r-base \
  r-base-dev

 #Set make to install R packages
 RUN apt-get update -qq && apt-get -y --no-install-recommends install make

 #Set gcc/g++/gfortran for compilation
 RUN apt-get update -qq && apt-get -y --no-install-recommends install \
  gcc \
  g++ \
  gfortran

 #Cleanup
 RUN rm -rf /var/lib/apt/lists/*

 #R-packages
 #copy files from local machine to inside the image
 COPY 02_code/install_packages_allprojects1.R /install_packages_allprojects1.R


 #install R-packages inside the image
 RUN Rscript /install_packages_allprojects1.R```
0

There are 0 best solutions below