Creating a Dockerfile for the custom Runtime Image

Follow the instructions to create a Dockerfile for a custom image.

  1. Select the source image for your customization.
    For a non-PBJ Runtime, you must use a Runtime image released by Cloudera. Image tags can be checked on the Session Start page on the user interface when you select a Runtime.
  2. Create a Dockerfile when building a customized image, that specifies which packages you would like to install in addition to the base image.

    For example, the following Dockerfile installs the telnet package, the sklearn Python package and upgraded base packages on top of a ML Runtime image released by Cloudera.

    # Dockerfile
    # Specify an ML Runtime base image
    FROM docker.repository.cloudera.com/cloudera/cdsw/ml-runtime-jupyterlab-python3.7-standard:2021.12.1-b17
    # Install telnet in the new image
    RUN apt-get update && apt-get install -y --no-install-recommends telnet && apt-get clean && rm -rf /var/lib/apt/lists/*
    # Upgrade packages in the base image
    RUN apt-get update && apt-get upgrade -y && apt-get clean && rm -rf /var/lib/apt/lists/*
    # Install the python package sklearn
    RUN pip install --no-cache-dir sklearn
    # Override Runtime label and environment variables metadata
    ENV ML_RUNTIME_EDITION="Telnet Edition" \
           	ML_RUNTIME_SHORT_VERSION="1.0" \
            ML_RUNTIME_MAINTENANCE_VERSION=1 \
            ML_RUNTIME_DESCRIPTION="This runtime includes telnet and sklearn and upgraded packages"
    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