You can build custom images based on the SPSS Modeler runtime images available in IBM
Watson Studio.
Before you begin
You must have a Cloud Pak for Data cluster administrator role to create and register a
custom image.
Note: If you use custom images, it is your responsibility to update your custom images with
all the latest updates that are made to the available runtime images in Watson Studio. You
are responsible for installing new fix packs, security updates, or any other updates. When
new versions of Cloud Pak for Data are released, rebuilding all of your custom images is the
best way to keep them updated.
About this task
You can use a custom image to optimize the standard configuration of an SPSS Modeler
runtime. You can also use custom images in air-gapped environments that cannot expose any
operations to the internet.
Procedure
- Prepare to build a new image.
- Download the configuration file for the SPSS Modeler runtime image that you
want to customize. See Downloading the configuration
file.
- Download the image in the configuration. See Downloading the
image.
- Get the registry URL from the IBM Entitled registry or a private Container
Registry.
The SPSS Modeler runtime images are stored in a Docker image
registry. In Cloud Pak for Data, you can use only an external registry outside of the
Cloud Pak for Data Red Hat OpenShift cluster. To use that registry, you need the URL
to the external registry that was used during the installation of Cloud Pak for Data.
Use the same URL for all commands and in all the scripts that you
run.
- Download the build-image-for-python-r-packages.zip that
contains the Dockerfile and scripts for installing R and Python
packages.
The archive contains the following files:
- Create the custom runtime image with the files that you downloaded, and add your R
or Python packages.
- Add customizations and build a new image. See Creating a
custom image.
- In Dockerfile from the archive, update
<spss-modeler-base-image> with the tag of the actual
spss-modeler base image that you pulled from the IBM Entitled registry or a private
Container Registry.
Example of the
Dockerfile:
FROM <spss-modeler-base-image> as custom-runtime-for-python-r-packages
USER modeler-user:modeler-user
COPY --chown=modeler-user install-packages.R /tmp/install/
COPY --chown=modeler-user install-Python-packages.sh /tmp/install/
RUN umask 002 \
&& /opt/r/lib/R/bin/Rscript /tmp/install/install-packages.R \
&& bash /tmp/install/install-Python-packages.sh \
&& rm -rf /tmp/install
- If you are installing R packages, add all your package names to the list in
install-packages.R. Every package name must be in double
quotation marks.
install.packages(c(
"pkg-name1",
"pkg-name2",
...),
repos='http://cran.rstudio.com')
- If you are installing Python packages, add all your package names after the
pip install command in
install-Python-packages.sh.
set -e -o pipefail
MODELER_HOME=/opt/IBM/SPSS/ModelerServer/Cloud/
LD_LIBRARY_PATH=$MODELER_HOME/python/lib $MODELER_HOME/python_venv/bin/pip install \
pkg-name1 \
pkg-name2 \
...
- If you want to install only R packages or only Python packages, comment out
the line in Dockerfile for the installation that you want to
skip.
By default,
Dockerfile invokes both
install-packages.R and
install-Python-packages.sh to install the R and Python packages together.
- To install only R packages, comment out
&& bash
/tmp/install/install-Python-packages.sh \.
- To install only Python packages, comment out
&&
/opt/r/lib/R/bin/Rscript /tmp/install/install-packages.R \.
- Push the image to the container server to register it. See Registering the custom
image.
- Change and upload the configuration file to use the new custom image. See Uploading
the changed configuration.