Configure Docker Host

2024-04-18

Premium Feature — Available in the Professional and Enterprise Editions of LabKey Server. Learn more or contact LabKey.

This topic explains how to configure a connection between LabKey Server and a Docker container. This connection is used for integrations with sandboxed R engines, RStudio, RStudio Workbench, Jupyter Notebooks, etc.

Configure Docker Host Settings

  • Go to (Admin) > Site > Admin Console.
  • Under Premium Features click Docker Host Settings.
    • Enable Docker Settings: select On.
    • Docker Host: Enter the URI for your docker host.
    • Docker Certification Path: Unless you are running in devmode AND using port 2375, you must enter a valid file system path to the Docker certificates. Required for TCP in production mode. Note that LabKey expects certificates with specific names to reside in this directory. The certificate file names should be:
      • ca.pem
      • key.pem
      • cert.pem
    • Container Port Range: In most cases, leave these values blank.
    • User File Management: Select Docker Volume for a server running in production mode.
  • Click Save and then Test Saved Host to check your connectivity.

Supported Integrations

Using Docker, you can facilitate these integrations. Link for more details:

Development Support for OSX

If you're developing with the Docker module on an OSX host you will need to set up a TCP listener. There are two options:

1. Follow the steps in this post to expose the Docker daemon on the desired port:

Execute the below, replacing 2375 with the desired port:
docker run -d -v /var/run/docker.sock:/var/run/docker.sock -p 127.0.0.1:2375:2375 bobrik/socat TCP-LISTEN:2375,fork UNIX-CONNECT:/var/run/docker.sock

Next, export the DOCKER_HOST environment variable by adding this (with the appropriate port) to your bash_profile:

export DOCKER_HOST=tcp://localhost:2375

You can now find the Docker daemon running on that port.

2. An alternative method is to install socat on your local machine, then run socat in the terminal specifying the same port as you would like to use in your Docker Host TCP configuration. Example of running socat:

socat TCP-LISTEN:2375,reuseaddr,fork,bind=127.0.0.1 UNIX-CLIENT:/var/run/docker.sock

Troubleshooting

TLS Handshake

If you see an error message like the following, ensure that the certificate file names in Docker Certification Path match exactly those listed above.

http: TLS handshake error from <host-machine>: tls: first record does not look like a TLS handshake

Related Topics