Spotfire® Service for R Installation and Administration

Configuring a custom Docker image on a node with no internet access

If your node manager does not have external access to the internet, then you can create a Docker image on an internet-enabled computer, and then transfer it to your node manager.

About this task

Perform the first three steps of this task from the command line on a computer with internet access. Perform the rest of the task from the command line on the computer where your node manager is installed.

Before you begin

  • If you are using the script to build the base Docker image, you must have a connection to the internet. (A connection to the internet is not required if you are using a locally-available Docker image.)
  • You must have a Linux computer where the node manager is installed. (Your node manager and the Spotfire Server are usually on different computers).
  • You must have Docker installed on the computer running the node manager. If you install and start the service before you install Docker, then exceptions are written to the log.
Custom docker images for the service must contain the following.
  • The Java 17 Runtime.
  • The JAVA_HOME environmental variable, correctly defined.
    ENV JAVA_HOME=</correct/path/to/java>

Procedure

  1. On a computer with internet access, create the Dockerfile.
    Important: Remember that for any script you write, the line endings must be appropriate for the operating system where the service runs. Many text editors can perform end-of-line (EOL) conversion.
    #############################################
    # A sample Dockerfile for installing JDK. #
    #############################################
    FROM debian:12-slim
    #  install openjdk
    RUN apt-get install openjdk-17-jdk && apt-get clean
    #  set JAVA_HOME variable
    ENV JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64
  2. Install open-source R
    # Install required packages
    RUN apt update -y \
      && apt upgrade -y \
      && apt install -y  \
      ca-certificates \
      gnupg \
      && gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-key '95C0FAF38DB3CCAD0C080A7BDC78B2DDEABC47B7' \
      && gpg --armor --export '95C0FAF38DB3CCAD0C080A7BDC78B2DDEABC47B7'   | tee /etc/apt/trusted.gpg.d/cran_debian_key.asc \
      && echo deb http://cloud.r-project.org/bin/linux/debian bullseye-cran40/ > /etc/apt/sources.list.d/r-project.list \
      && apt update -y \
      && apt install -y --no-install-recommends \
      openjdk-17-jdk \
      r-base-core=4.3.* \
      r-base-dev=4.3.* \
      r-recommended=4.3.* \
      && apt clean all 
  3. Build the image specifying the name and tag.
    Use the command docker build -t <name:version>, as follows:
    docker build -t rsrv:258 .
  4. Save the image to a .tar file.
    Use the command docker save -o <name-version>.tar <name:version>, as follows:
    docker save -o rsrv-258.tar rsrv:258
  5. If you have already installed the service from the Spotfire Server Nodes & Services administration page, and if it is running, then stop the service.
  6. Transfer the .tar file to the target computer (where the node manager is running).
  7. Load the .tar file into the node manager.
    Use the command docker load -i <name-version>.tar, as follows:
    $ sudo docker load -i osrsrv-258.tar
    f2419d350464: Loading layer [==================================================>]  329.5MB/329.5MB
    Loaded image: rsrv:258
    $ docker images
    REPOSITORY              TAG                 IMAGE ID            CREATED             SIZE
    rsrv                 258                 9941b68e7f65        17 hours ago        517MB
  8. On the computer running the Spotfire Server, export the custom.properties.
  9. Edit the settings in the file custom.properties, specifying the name and tag of your custom image, and indicating that the docker image identifier should be used directly, without building an image on top of it.
    use.engine.containers: TRUE
    docker.image.name: <name:version>
    use.immutable.container=true
    
    See Docker container built for no internet access for more information.
  10. On the computer running the Spotfire Server, import the custom.properties.
  11. From the Spotfire Server Nodes & Services administration page, install the service, specifying the configuration to use, and then start the service.

    If you have already installed the service, then, under the node manager, select the service and click Edit. From the Configuration drop-down list, select the new configuration.

See Installing the Service on a Node Manager for a Spotfire Server and Configuring the Service for more information.