Building Custom Kubeflow Jupyter Notebook Image
Describes how to build the custom Kubeflow Jupyter notebook image.
About this task
Build a custom image with one of the default notebooks available in the Kubeflow dashboard as a base image. The notebook will be created using the custom image.
You can build the custom image for both air-gapped and non-air-gapped environments for all three types of packages – OS level packages, conda packages and pip packages.
To build the custom Kubeflow Jupyter notebook image, perform:
Procedure
-
Create
requirements.txt
file.For example: The content of the file can be following:###requirements.txt # pandas packages pandas=1.5.0 numpy=1.24.2 # Some other packages ###
-
Create
Dockerfile
.ARG BASE_IMG=gcr.io/mapr-252711/kubeflow/notebooks/jupyter-scipy: <image-tag> FROM $BASE_IMG COPY requirements.txt /tmp/requirements.txt RUN python3 -m pip install -r /tmp/requirements.txt --quiet --no-cache-dir \ && rm -f /tmp/requirements.txt
-
Build the image with
docker build
command. Replace the<image>
with actual image name,<tag>
with actual tag name, and<base_img>
with actual base image.docker build -t <image>:<example> .
(OR) If the default base image is not suitable,- Choose one of the default images as the base image. See Notebook Images.
- Run
docker build -t <image>:<example> --build-arg BASE_IMG=<base_img> .
-
Push the image to the registry.
docker push <image>:<example>
- Use the custom image option when creating the notebook server in the Kubeflow UI.