Updating the Dockerfile to support newer a R version

The openanalytics/r-base Docker image used by ShinyProxy is based on R version 3.4.4 from March this year. This morning I tried building an image that includes the pacman package. This build failed because pacman now requires R version 3.5 or greater.

Since the openanalytics image is largely based upon the rocker r-base image (which currently runs R 3.5.1), I’ve tried to update it with a new version, but I’m not experienced enough to get the Dockerfile working. Here’s my attempt:

# Could be ubuntu:18.04. Why not Debian as in rocker/r-base?
FROM ubuntu:16.04

MAINTAINER "Tobias Verbeke" tobias.verbeke@openanalytics.eu

## Add user to 'staff' group, granting them write privileges to /usr/local/lib/R/site.library
RUN useradd docker \
        && mkdir /home/docker \
        && chown docker:docker /home/docker \
        && addgroup docker staff

RUN apt-get update \ 
        && apt-get install -y --no-install-recommends \
                ed \
                less \
                locales \
                vim-tiny \
                wget \
                ca-certificates \
                apt-transport-https \
                gsfonts \
        && rm -rf /var/lib/apt/lists/*

## I added this to get apt-key adv working:
RUN apt-get update && apt-get install -my wget gnupg

## Configure default locale, see https://github.com/rocker-org/rocker/issues/19
RUN echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen \
        && locale-gen en_US.utf8 \
        && /usr/sbin/update-locale LANG=en_US.UTF-8


## Here I changed the repository for the new version of R, because I don't understand 'pinning'.
RUN echo sudo add-apt-repository 'deb https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/'
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9


## 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 -y --no-install-recommends \
                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://cloud.r-project.org/"), 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/*

CMD ["R"]

# system libraries of general use
RUN apt-get update && apt-get install -y \
    sudo \
    pandoc \
    pandoc-citeproc \
    libcurl4-gnutls-dev \
    libcairo2-dev \
    libxt-dev \
    libssl-dev \
    libssh2-1-dev \
    libxml2-dev \
    libssl1.0.0 \
    libpq-dev \

# basic shiny functionality
RUN R -e "install.packages(c('pacman'), repos='https://cloud.r-project.org/')"

# copy the app to the image
RUN mkdir /root/app
COPY benchmarking /root/app

COPY Rprofile.site /usr/lib/R/etc/


CMD ["R", "-e", "shiny::runApp('/root/app')"]

The Docker build fails when trying to install R and littler with the following error:

E: Version '3.5.1*' for 'r-base' was not found
E: Version '3.5.1*' for 'r-base-dev' was not found
E: Version '3.5.1*' for 'r-recommended' was not found

Can anyone help me in the right direction here? Or should I rather open an issue on Github? I think this will be an issue for many ShinyProxy users going forward. Should I attempt a quick fix by installing old packages or compiling them from source?

1 Like

+1 . I think openanalytics/r-base could use an update (if possible)

Hello @fifthace @BetweenTwoTests,

You are right an update was due - updated now to Ubuntu 18.04 and R 3.5.2 at



Good afternoon @tverbeke,

Do you plan to update r-base docker image in the short term ? I saw github repo has been updated but not Dockerhub.
Do you release updates on a regular basis, or this is not planned ?

Thanks in advance,


Hi @pabgamu,

Thank you for your request. The repository and Docker hub have been updated to R 3.6.1.


1 Like

Good morning @tverbeke,

Thanks a lot for this fast update.


Hi @tverbeke,

The last Dockerfile on GitHub includes 4.0.5 version of R. Some packages need to be greater than 4.0.5 version. I’ve just tried to change ubuntu version and R version in Dockerfile without other changings. While building dockerfile fails. In order to understand the problem, I tried to build Dockerfile itself in openanalytics/r-base first. However, as you can see the image below, E: Version '4.0.5*' for 'r-base-core' was not found error seems.

What issue can affect building dockerfile in this stage?

Thanks in advanve.

Hi @Ekrem_Bayar,

For all or our purposes, we switched to using our openanalytics/r-ver images. See https://hub.docker.com/r/openanalytics/r-ver/tags and https://github.com/openanalytics/r-ver for the source. If you found a reference still using openanalytics/r-base, please let us know and we will update the relevant documentation.

Good luck!


1 Like

Thanks a lot to share with us this important information. @tverbeke

In the image example in the “Write a Docker file” section of the Shinyproxy documentation openanalytics/r-base had been used instead of openanalytics/r-ver. That’s why, I knew that the image must have been openanalytics/r-base. However, the GitHub link given us in the documentation includes Dockerfile and it uses openanalytics/r-ver image as you mentioned. I have not realized before that the correct usage must be openanalytics/r-ver.

It would be great if you could update this part of documentation to prevent misunderstanding.


1 Like

Thanks again for reporting this, in the meantime we updated the page to use be similar to https://github.com/openanalytics/shinyproxy-shiny-demo-minimal

1 Like