RStudio

Compute Resources

Docker Usage

Image Details

Initial Setup

R installs a default set of packages during installation. The list of installed packages can be viewed in the lower right pane of RStudio, with currently active packages indicated with a checkmark.

If you wish to install additional packages, you can do so by first creating a file in your home directory called .Rprofile, if it doesn’t already exist. This file will be loaded automatically when RStudio starts.

> touch ~/.Rprofile

Next, create a folder to host your additional R packages. In the example below, the R packages will be stored in a folder named R_libraries in the Active folder of your storage allocation.

Storage Allocation Name

Make sure to replace ${STORAGE_ALLOCATION} with the same name as the name of your storage allocation.

mkdir /storage1/fs1/${STORAGE_ALLOCATION}/Active/R_libraries/

Backup an existing .Rprofile file if you have one.

mv ~/.Rprofile ~/.Rprofile.bak

Create a new .Rprofile file to store your additional R packages in storage1.

cat <<EOF > $HOME/.Rprofile
vals <- paste('/storage1/fs1/${STORAGE_ALLOCATION}/Active/R_libraries/',paste(R.version$major,R.version$minor,sep="."),sep="")
for (devlib in vals) {
    if (!file.exists(devlib))
    dir.create(devlib)
x <- .libPaths()
x <- .libPaths(c(devlib,x))
}
rm(x,vals)
EOF

Now that the .Rprofile file is created, you can install additional R packages using install.packages(). Please see https://www.rdocumentation.org/packages/utils/versions/3.6.2/topics/install.packages for more information.

Interactive GUI Session

Please use the following commands to submit an interactive GUI session for RStudio.

export PASSWORD=password
export LSF_DOCKER_PORTS='8080:8080'
export LSF_DOCKER_VOLUMES="/storage1/fs1/${STORAGE_ALLOCATION}/Active:/storage1/fs1/${STORAGE_ALLOCATION}/Active"
bsub -Is -R 'select[port8080=1]' -q general-interactive -a 'docker(ghcr.io/washu-it-ris/rstudio:<tag>)' supervisord -c /app/supervisord.conf

RStudio Docker Tag

The <tag> will refer to the version of RStudio in the Docker container. Please click here to see a current list of available RStudio versions and their corresponding Docker images.

  • Since LSF is running interactively, it will output the name of the host it’s running on in the terminal.

  • The host will be the IP address needed to access the VNC.

  • For example: <<Starting on compute1-exec-187.ris.wustl.edu>> translates to the IP being https://compute1-exec-187.compute.ris.wustl.edu:8080/vnc.html.

  • The password will be what was set above with the export PASSWORD= command.

  • Please see our documentation for more information on selecting a port.

  • Open an interactive RStudio session using the following command:

> rstudio

You should now see the RStudio GUI

You can safely ignore XDG_RUNTIME_DIR and Session version X does not match server version X warnings that may appear when starting RStudio.

GUI Session Variables

  • You can change the GUI display size by clicking on the settings icon on the left of the browser and selecting ‘Local Scaling’ from the Scaling Mode dropdown. Click the settings icon again to resume the session.

  • The display height and width can also be changed by passing them as variables.

export DISPLAY_WIDTH=<width> (default is 1024)
export DISPLAY_HEIGHT=<height> (default is 768)

Interactive Command-Line Session

  • If you wish to use R in an interactive command-line session, you can do so with the following commands.

export LSF_DOCKER_VOLUMES="/storage1/fs1/${STORAGE_ALLOCATION}/Active:/storage1/fs1/${STORAGE_ALLOCATION}/Active"
bsub -Is -q general-interactive -a 'docker(ghcr.io/washu-it-ris/rstudio:<tag>)' /bin/bash

Extending the RStudio Docker Image

The steps in the initial setup will work for some but not all R packages. For example, devtools requires the following dependencies to be installed to the Docker image: build-essential libcurl4-gnutls-dev libxml2-dev libssl-dev.

This will require extending the existing Docker image to include these dependencies. Below is a sample Dockerfile that includes these dependencies. Please see this section for more information on setting the Docker tag in the Dockerfile.

Dockerfile Best Practices

It is recommended to set the Docker tag to a specific R version. This will prevent using an updated version of the RIS RStudio image, which may have compatibility issues with R packages previously installed. As an example, in the Dockerfile below, the tag is set to 3.6.3.

FROM gcr.io/ris-registry-shared/rstudio:3.6.3

# install packages using apt-get

ENV LANG=C.UTF-8 LC_ALL=C.UTF-8
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update --fix-missing && \
apt-get install -y build-essential \
libcurl4-gnutls-dev libxml2-dev \
libssl-dev && \
apt-get clean

# extend image to include tidyverse and devtools R packages

RUN R -e "install.packages(c('devtools','tidyverse'), dependencies=TRUE)"

Please see our Docker Workshop for more information on building and pushing a Docker image. You can also open a ticket at our Service Desk for further help.

Available RStudio Versions

Current Version:

  • ghcr.io/washu-it-ris/rstudio
    • 4.4.0

Earlier Versions:

Earlier versions are still available but no longer directly supported by RIS. Please refer to the latest version for direct support.

  • ghcr.io/washu-it-ris/rstudio
    • 4.3.0
  • gcr.io/ris-registry-shared/rstudio
    • 4.2.3

    • 4.2.2

    • 4.1.2

    • 4.1.2_seurat_4.1.1

    • 4.0.0

    • 3.6.3