Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add a particular version of R to a docker container

Tags:

docker

r

I am trying to install R in an Ubuntu docker image. I am able to successfully do so using this line:

RUN apt-get update && apt-get install -y r-base

but it is installing r 3.2.3. I need a newer version (3.5.2). Does anyone know how to specify which version to download?

like image 639
Simon Kassel Avatar asked Jan 17 '19 15:01

Simon Kassel


1 Answers

Sure thing:

FROM ubuntu:18.10

ENV DEBIAN_FRONTEND noninteractive

RUN apt-get update && apt-get -y install --no-install-recommends --no-install-suggests \
        ca-certificates software-properties-common gnupg2 gnupg1 \
      && apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9 \
      && add-apt-repository 'deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/' \
      && apt-get install r-base 

Taken from here: https://cran.r-project.org/bin/linux/ubuntu/README.html

And here: https://github.com/noisebrain/Dockerfiles/blob/0668df74b27f514dab19a7afae6715328de72980/Rstudio-server-aib/rstudio-server-aib.dockerfile

root@100d1cda7377:/# R

R version 3.5.2 (2018-12-20) -- "Eggshell Igloo"
like image 134
maxm Avatar answered Nov 01 '22 05:11

maxm