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.
Connect Using TCP
Set up TLS following these steps:
- See https://docs.docker.com/engine/security/https/
- 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 220.127.116.11 --tlsverify --tlscacert=$DOCKER_CERT_PATH/ca.pem --tlscert=$DOCKER_CERT_PATH/server-cert.pem --tlskey=$DOCKER_CERT_PATH/server-key.pem -H=0.0.0.0:2376"
Build the LabKey/RStudio Image
- 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:
- To stop the container, run:
docker stop <container-name>
Enable Session Keys
For details, see Configure Docker Host
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.
- Click Admin Console Links.
- 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
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: