Premium Feature — This feature supports RStudio, which is part of the Professional and Enterprise Editions of LabKey Server. Learn more or contact LabKey for details.

This topic explains how administrators can set up communication between LabKey Server and an RStudio instance packaged inside a Docker image. As part of the configuration, we recommend that you allow Docker, not LabKey Server, to manage the RStudio data using Docker Volumes. This avoids a number of issues with file sharing, permissions, path mapping, and security, making setup much easier.

Install Docker

Connect Using TCP

Set up TLS following these steps:

  • See
  • An example TLS and certificate configuration for LabKey Server is available here.
  • After certificates are set up, find the values of the following environment variables. You will use these values in the Configure Docker step below. (On Linux run 'env | grep DOCKER'.)
  • On an Ubuntu system modify the "/etc/default/docker" file to include the following:



DOCKER_OPTS="--dns --tlsverify --tlscacert=$DOCKER_CERT_PATH/ca.pem --tlscert=$DOCKER_CERT_PATH/server-cert.pem --tlskey=$DOCKER_CERT_PATH/server-key.pem -H="

Build the LabKey/RStudio Image

  • Clone the docker-rstudio repository from github: (This repository is available in the Premium Plus and Enterprise editions of LabKey Server. Contact us for more information.)
  • cd to the rstudio-base directory:
cd docker-rstudio/images/labkey/rstudio-base
  • Build the image from the source files:
  • Test by running the following:
docker run labkey/rstudio-base
  • Ctrl-C to get to return to the command prompt once you see the 'done' message.
  • Run the following to get the container name:
docker ps
  • To stop the container, run:
docker stop <container-name>

Enable Session Keys

Configure Docker

For details, see Configure Docker Host.

Configure RStudio

When configuring RStudio, you can skip the prerequisite check for user home directories. The configuration page will show a list of existing volumes and corresponding user emails. The email field is blank if the volume doesn't correspond to an existing user.

  • Go to (Admin) > Site > Admin Console.
  • Under Premium Features click RStudio Settings.
  • If you have successfully created the Docker image, it will be listed under Docker Volumes.
  • Configure the remaining fields as appropriate for your environment, and click Save.
    • Docker Image Name - labkey/rstudio (or a custom image derived from labkey/rstudio)
    • Port = 8787
    • Mount Volume = /home/rstudio
    • Host library directory - leave blank
    • User for Containers - leave blank
    • AppArmor Profile - leave blank
    • Local IP address from LabKey Server - set to the IP address of the labkey server from within your docker container. This may be left blank if the normal DNS lookup works.
    • Resource Configuration: Customize defaults if needed.

Enable RStudio in Folders

The modules docker and rstudio must be enabled in each folder where you want RStudio to be available. Select (Admin) > Folder > Management, select the Folder Type tab and make sure both modules are checked in the right column. Click Update Folder to save any changes.

Once RStudio is enabled, you can use the instructions in these topics to edit reports and export data:

Related Topics


Was this content helpful?

Log in or register an account to provide feedback

expand all collapse all