Installing R Kernel in JupyterLab Runtimes of Cloudera AI
To add R Kernel to JupyterLab Runtimes, create a Dockerfile that specifies the packages to be installed, in addition to the base image.
-
Select the source image for your customization.
For a non-PBJ Runtime, you must use a Runtime image released by Cloudera. When you select a Runtime, check the image tags on the Session Start page of the Cloudera AI user interface.
-
When building a customized image, create a Dockerfile that specifies which
packages you would like to install in addition to the base image.
# Dockerfile # Specify an ML Runtime base image # Possibly use latest from https://archive.cloudera.com/ml-runtimes/latest/artifacts/repo-assembly.json FROM docker.repository.cloudera.com/cloudera/cdsw/ml-runtime-jupyterlab-python3.10-standard:2023.08.2-b8 RUN apt-get update && apt-get install -y --no-install-recommends software-properties-common dirmngr gdebi-core RUN curl https://cloud.r-project.org/bin/linux/ubuntu/marutter_pubkey.asc > /etc/apt/trusted.gpg.d/cran_ubuntu_key.asc RUN add-apt-repository "deb https://cloud.r-project.org/bin/linux/ubuntu $(lsb_release -cs)-cran40/" RUN apt-get update && apt-get install -y --no-install-recommends r-base-core && apt-get clean && rm -rf /var/lib/apt/lists/* RUN \ /bin/bash -c "echo -e \"install.packages('IRkernel')\nIRkernel::installspec(prefix='/usr/local',name = 'RKernel', displayname = 'Rkernel')\" | R --no-save" && \ rm -rf /build # Override Runtime label and environment variables metadata ENV ML_RUNTIME_EDITION="PBJ Jupyter With R Kernel" \ ML_RUNTIME_SHORT_VERSION="1.0" \ ML_RUNTIME_MAINTENANCE_VERSION=1 \ ML_RUNTIME_DESCRIPTION="This Runtime adds R kernel to JuyterLab editor" ENV ML_RUNTIME_FULL_VERSION="${ML_RUNTIME_SHORT_VERSION}.${ML_RUNTIME_MAINTENANCE_VERSION}" LABEL com.cloudera.ml.runtime.edition=$ML_RUNTIME_EDITION \ com.cloudera.ml.runtime.full-version=$ML_RUNTIME_FULL_VERSION \ com.cloudera.ml.runtime.short-version=$ML_RUNTIME_SHORT_VERSION \ com.cloudera.ml.runtime.maintenance-version=$ML_RUNTIME_MAINTENANCE_VERSION \ com.cloudera.ml.runtime.description=$ML_RUNTIME_DESCRIPTION```