This topic is under construction.

Premium Feature — This feature is part of the Professional Plus and Enterprise Editions. Learn more or contact LabKey for set up assistance.

As an alternative to installing a local instance of R, or using an Rserver server, LabKey Server can make use of an R engine inside a Docker image.

Multiple Docker-based R engines can be configured, each pointing to different Docker images, each of which may have different versions of R and packages installed.

Docker-based R engines are good candidates for "sandboxed" R engines.

To set up LabKey Server to use Docker-based R engines, complete the following steps:

  • Enable in Experimental Features
  • Modify a Docker image to fit your needs.
  • Configure Docker and Startup the Image.
  • Configure LabKey Server to use the R engine inside the Docker image.
See details on each step below:

Install Docker

  • Install Docker appropriate your operating system.
    • On a Windows test/development machine, go to Docker Settings. Under General, place a checkmark next to Expose daemon on tcp://localhost:2375. Do not do this on a production server, as this is not a secure configuration. Only appropriate for local development and testing.

Enable in Experimental Features

  • Go to > Admin > Site > Admin Console.
  • Click Admin Console Links.
  • Under Configuration, click Experimental Features.
  • Under R Docker Sandbox, click Enable.

(On Development Machines) Set the Base server URL

  • Set the Base Server URL to something other than localhost:8080. For details, see Site Settings. Example value "http://my.server.com".

Make a Docker Image with R Included

LabKey provides two template images to start from. One template is for building a Dockerized R engine using the latest released version of R. The other template is for building an older version of R.

Startup the Docker Image

When the docker image build process finishes, look for the name of your image in the console, for example:

Successfully tagged labkey/rsandbox-base:3.5.1

Start the image:

docker run labkey/rsandbox-base:3.5.1

Configure Docker and Startup the Image

Configure LabKey Server to Use the Docker R Engine

  • In the Edit Engine Configuration dialog, enter the Docker Image Name (at a minimum).
  • The Mount Paths let you (1) map in-container paths to host machine paths and (2) to write script outputs the mapped path on the host machine. For example, the following settings will write the script.R and script.Rout generated files to your host file system at C:scriptsRreports:
Mount (rw): host directory: C:\scripts\Rreports
Mount (rw): container directory: /Users/someuser/cache

Mount (rw) paths refer to Read-Write directories, Mount (ro) refer to Read-Only paths.

  • The Site Default refers to the default sandboxed R engine. If you have only one sandboxed R engine, this cannot be unchecked. If you have more than one sandboxed R engine, you can choose one of them to be the Site Default.

Discussion

Was this content helpful?

Log in or register an account to provide feedback


previousnext
 
expand all collapse all