Important:

IBM Cloud Pak® for Data Version 4.6 will reach end of support (EOS) on 31 July, 2025. For more information, see the Discontinuance of service announcement for IBM Cloud Pak for Data Version 4.X.

Upgrade to IBM Software Hub Version 5.1 before IBM Cloud Pak for Data Version 4.6 reaches end of support. For more information, see Upgrading IBM Software Hub in the IBM Software Hub Version 5.1 documentation.

Updating a custom image

Following an upgrade from certain versions of Cloud Pak for Data, you must update the custom image. This update applies only to upgrades from Cloud Pak for Data versions up to and including 4.0.6.

Follow these steps to update your custom image:

Note:
A CPD 4.6 compatible image must have package files accessible to users with group name condausers and group id 103000.

For Watson Machine Learning custom images, what ties the software specification with the custom image is the runtime definition file. This file maps the software specification to the custom image, and can be updated. To update the file, follow the steps in Updating the runtime definition file with the new image.

To run custom images that were created in CPD 4.5 or earlier versions of CPD 4.6.x, you must first patch the runtime definition file. Refer to Updating the runtime definition after an upgrade.

Updating a custom image from release 3.5 of CPD

Note:
Updating a custom image from release CPD 3.5 increases the image size by more than 7 GB. The exact size depends on the number of files. Therefore, it is recommended to use a fresh CPD 4.6 base image.

To update a CPD 3.5 custom image in CPD 4.6.x:

  1. Update the Docker image, with the sample file and then run these commands:

    podman build  -t <custom_image_name_for_cpd40>:<new_tag> --build-arg base_image_tag=<custom_image_name_from_cpd3.5>:<tag> -f Dockerfile
    
  2. Customize, and then upload the Watson Machine Learning base image. For details, refer to Creating and uploading a custom image.

Sample Dockerfile

ARG  base_image_tag
FROM ${base_image_tag}


USER root:root
RUN groupmod -g 103000 condausers && \
    umask 000 & \
    mkdir -p \
        "/.local/lib/python3.9/site-packages" \
        /.cache && \
    chown -R wmlfuser:condausers \
        /.local \
        /.cache && \
    find / -path /proc -prune -false -o -group 1000320900 -exec chgrp -h condausers {} \; && \
    chmod -R 775 \
        /home

Patching the deployment and preserving the software specification from CPD 3.5

Here you need to update the runtime definition so that the software specification (created in CPD 3.5) picks up the new image.

  1. Identify the runtime definition file for the software specification and update it with the new image. For details, refer to Updating the runtime definition file with the new image.
  2. Create a new model with the software specification (created in CPD 3.5)
  3. Patch the existing deployment with the new model.

Patching the deployment and creating a new software specification in CPD 4.0.x

To patch the deployment with a new model:

  1. Create the base software specification that will be surfaced for deploying assets
  2. Create the runtime definition file, which maps the base_sw_spec to the custom_image
  3. Save the new model that uses the new custom software specification to the Watson Machine Learning repository
  4. Patch the existing deployment with the new model

Creating a new deployment and preserving the software specification from CPD 3.5

Here you need to update the runtime definition so that the software specification (created in CPD 3.5) picks up the new image:

  1. Identify the runtime definition file for the software specification and update it with the new image. For details, refer to Updating the runtime definition file with the new image.
  2. You can now use existing models that use this software specification (created in CPD 3.5) to create the new deployment.

Updating the runtime definition file with the new image

To update the runtime definition file:

  1. Get the runtime definition files.

    curl -k -X GET \
    $CPDHOST/zen-data/v1/volumes/files/%2F_global_%2Fconfig%2F.runtime-definitions%2Fibm%2F \
    -H "Authorization: Bearer ${TOKEN}" --output rundef.tar.gz
    

    Downloaded files are in the .tar.gzip format.

  2. Extract the downloaded file. You will see the ibm directory. The concerned files have the *-server.json extension.

    tar -zxvf rundef.tar.gz
    cd ibm
    SW_SPEC_NAME=<the_software_specification_name>
    
    WML_RUNTIME_DEF_JSON=$(grep -l $SW_SPEC_NAME *-server.json)
    echo "The required file: $WML_RUNTIME_DEF_JSON"
    
  3. Update the value for the image key in the JSON file with the new image. You can use the jq tool to help in updating. Refer to this example code:

    # The new custom image is a fully qualified registry image
    # e.g <target_registry>/<new-image-name>:<new-image-tag>
    # NEW_CUSTOM_IMAGE=<new_custom_image>
    
    # take a backup
    cp $WML_RUNTIME_DEF_JSON $WML_RUNTIME_DEF_JSON.bkp
    
    # extract required fields from old configuration
    SOURCE_DISPLAY_NAME=$(jq -r ".displayName" $WML_RUNTIME_DEF_JSON)
    SOURCE_DESCRIPTION=$(jq -r ".description" $WML_RUNTIME_DEF_JSON)
    SOURCE_SW_SPEC_NAME=$(jq -r ".software_specification_name" $WML_RUNTIME_DEF_JSON)
    
    # re-write the configuration  with the template
    # and update it with required fields already extracted
    # e.g. for Python-based custom images
    # TEMPLATE_CONFIG_JSON=wml-deployment-runtime-py310-server.json
    TEMPLATE_CONFIG_JSON=<>
    
    cp $TEMPLATE_CONFIG_JSON $WML_RUNTIME_DEF_JSON
    
    tmp=$(mktemp)
    
    jq  --arg dn "$SOURCE_DISPLAY_NAME" \
        --arg ds "$SOURCE_DESCRIPTION" \
        --arg sw "$SOURCE_SW_SPEC_NAME" \
        --arg img "$NEW_CUSTOM_IMAGE" \
       '.displayName = $dn | .description = $ds | .software_specification_name = $sw | .image = $img' \
        $CUSTOM_WML_RUN_DEF > "$tmp" && mv "$tmp" $CUSTOM_WML_RUN_DEF
    
    jq "." $WML_RUNTIME_DEF_JSON
    
  4. Check whether the file to be uploaded contains the required details.

    cat $WML_RUNTIME_DEF_JSON
    
  5. Update the Runtime Definition file so that the software specification now points to the new image.

    PATH_CUSTOM_RUN_DEF=`pwd`"/"$WML_RUNTIME_DEF_JSON
    echo "New Custom Runtime definition file path:"
    echo $PATH_CUSTOM_RUN_DEF
    
  6. Upload the updated Runtime Definition file:

    curl -k -X PUT \
    $CPDHOST/zen-data/v1/volumes/files/%2F_global_%2Fconfig%2F.runtime-definitions%2Fibm \
    -H "Authorization: Bearer $TOKEN" \
    -H 'content-type: multipart/form-data' \
    -F upFile=@"$PATH_CUSTOM_RUN_DEF"
    

    If the upload is completed successfully, the following message appears:

    {"_messageCode_":"Success","message":"Successfully uploaded file and created the directory structure"}
    

Learn more

Parent topic: Customizing deployment runtime images