Install R in docker image

Viewed 13330

How do I install R version 3.4.0 in my docker image. I've installed python using:

RUN yum -y install https://centos6.iuscommunity.org/ius-release.rpm \
  && yum -y install python36u \
  && yum -y install python36u-devel \
  && yum -y install python36u-pip \
  && yum -y install python36u-tkinter.x86_64

Similarly I need to install R:

I've specified following things in file so far for R:

ENV R_BASE_VERSION 3.4.0
RUN Rscript -e 'install.packages("devtools",dependencies=TRUE)' \
    &&Rscript -e 'install.packages("methods",dependencies=TRUE)' \
    &&Rscript -e 'install.packages("jsonlite",dependencies=TRUE)' \

Please suggest .I'm new to docker

I think I need to do something like below:

ENV R_BASE_VERSION 3.4.1

## Now install R and littler, and create a link for littler in /usr/local/bin
## Also set a default CRAN repo, and make sure littler knows about it too
RUN apt-get update \
    && apt-get install -t unstable -y --no-install-recommends \
        littler \
                r-cran-littler \
        r-base=${R_BASE_VERSION}* \
        r-base-dev=${R_BASE_VERSION}* \
        r-recommended=${R_BASE_VERSION}* \
        && echo 'options(repos = c(CRAN = "https://cran.rstudio.com/"), download.file.method = "libcurl")' >> /etc/R/Rprofile.site \
        && echo 'source("/etc/R/Rprofile.site")' >> /etc/littler.r \
    && ln -s /usr/share/doc/littler/examples/install.r /usr/local/bin/install.r \
    && ln -s /usr/share/doc/littler/examples/install2.r /usr/local/bin/install2.r \
    && ln -s /usr/share/doc/littler/examples/installGithub.r /usr/local/bin/installGithub.r \
    && ln -s /usr/share/doc/littler/examples/testInstalled.r /usr/local/bin/testInstalled.r \
    && install.r docopt \
    && rm -rf /tmp/downloaded_packages/ /tmp/*.rds \
    && rm -rf /var/lib/apt/lists/*

But I do not know what is this litter and all. I just need R to be installed and then i will install required packages as I have specified above.

Edits : First line in my docker file installs node4.

3 Answers
Related