Version v0.7 of the documentation is no longer actively maintained. The site that you are currently viewing is an archived snapshot. For up-to-date documentation, see the latest version.

Create a Custom Jupyter Image

Creating a custom Docker image for your Jupyter notebook

This guide tells you how to configure a custom Docker image for your Jupyter notebook server in Kubeflow.

Your custom image must meet the requirements of the Kubeflow notebook controller which manages the life cycle of notebooks. The Kubeflow UI expects Jupyter to start after launching the Docker image with docker run. You must therefore set the default command of your Docker image to launch Jupyter.

Follow these steps to configure the launch command (CMD) in your Docker image:

  • Set the working directory:


    The /home/jovyan directory is backed by a Kubernetes persistent volume (PV).

  • Allow Jupyter to listen on all IP addresses:

  • Allow the user to run the notebook as root:

  • Set the port:

  • Disable authentication. (Kubeflow takes care of authentication based on the type of authentication selected during deployment of Kubeflow. After authentication to Kubeflow, users can access all Kubeflow components from the UI, including notebooks.)

    Use the following setting to allow passwordless access to your Jupyter notebook servers:

    --NotebookApp.token=''  --NotebookApp.password=''
  • Allow any origin to access your Jupyter notebook server:

  • Set the base URL. The Kubeflow notebook controller manages the base URL for the notebook server using the environment variable called NB_PREFIX. Your Docker image should define the variable and set the value of base_url as follows:


Below is an example of what your Dockerfile should contain:


CMD ["sh","-c", "jupyter notebook --notebook-dir=/home/jovyan --ip= --no-browser --allow-root --port=8888 --NotebookApp.token='' --NotebookApp.password='' --NotebookApp.allow_origin='*' --NotebookApp.base_url=${NB_PREFIX}"]

Next steps

When starting a Jupyter notebook server from the Kubeflow UI, specify your custom Docker image. See the guide to setting up your Jupyter notebooks.