I have a docker file that successfully grabs R and installs it but whenever I run the docker file, it just takes the latest version of R. Now I want to install just specific version of R (R 4.2.3 to be exact) but i dont seem to find a easy nice solution
Please note my image has to be based on Ubuntu 20.04. I am aware of r.rocker series of images from docker hub.
Here is my docker file code for the reference:
FROM ubuntu:20.04
#ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update -qq && 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 focal-cran40/'
RUN apt-get -y install r-base r-base-dev
RUN apt-get -y --no-install-recommends install
curl
libxml2-dev
libcairo2-dev
libsqlite3-dev
libmariadbd-dev
libpq-dev
libssh2-1-dev
unixodbc-dev
libcurl4-openssl-dev
libssl-dev
libsodium-dev
2
Answers
After looking at here and some trail and error, I finally made a generic docker image that all the R 4 versions can be installed on, just change the R version on
ENV
You could invert the problem and start from the appropriate Docker images:
The
r-base
images go back to a few more R 3.* versions if you need those.Edit If you are on Ubuntu and have the CRAN mirror of Ubunty binaries configure then you can point at 4.2.3 via a version constraint. I am on 24.04 and I don’t see 4.2.3 but I do see 4.3.1. An older base may see 4.2.3. Worst case … you can use a from-source installation.