Important:
IBM Cloud Pak® for Data Version 4.7 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.7 reaches end of support. For more information, see Upgrading IBM Software Hub in the IBM Software Hub Version 5.1 documentation.
Sample Dockerfile for Python runtimes
Use this sample Dockerfile to add customizations to your Python image.
ARG base_image_tag
FROM ${base_image_tag}
# For installing OS packages, use root:root
# e.g.
USER root:root
RUN yum install -y gdb
# For installing to conda site-packages,
# use wmlfuser:condausers
# e.g.
USER wmlfuser:condausers
RUN umask 002 && \
pip install gensim
#
# Alternatively, for Installing to location other than conda site-packages.
# It can be installed to
# --target <any_file_system_dir_path>
# Provided <any_file_system_dir_path> full path is accessible to any user with group "condausers"
#
# Important:
# The <any_file_system_path> must then be added to the environment variable PYTHONPATH
#
# e.g
# use wmlfuser:condausers to install to the path /home/wmlfuser/mypkgs and add
# the path to PYTHONPATH environment variable
#
USER wmlfuser:condausers
RUN umask 002 && \
mkdir -p /home/wmlfuser/mypkgs && \
pip install pydot --target /home/wmlfuser/mypkgs
ENV PYTHONPATH=$PYTHONPATH:/home/wmlfuser/mypkgs
# If pip --user is used for installing package.
# The installation path needs to be explicitly added to PYTHONPATH
# e.g.
#
# for user wmlfuser:condausers it by default goes to user install directory
# (See the Python documentation for site.USER_BASE for full details.)
# use `python -m site --user-site` command to get the path.
#
# for wml-deployment-runtime-py39-1, it goes to
# /home/wmlfuser/.local/lib/python3.9/site-packages
#
#
For Podman:
podman build -t <custom-image-name>:<custom-image-tag> \
--build-arg base_image_tag=<downloaded-base-image> -f <path_to_dockerfile>
<downloaded-base-image>
is copied from the "image" section of the runtime-definition file (in this example, wml-deployment-runtime-py39-server.json
)
Parent topic: Creating a custom image