Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
Showing results for 
Search instead for 
Did you mean: 
Developer Advocate
Developer Advocate
In this second post in my CloudFoundryFun series, I show you how to leverage Cloud Foundry to forge a new learning environment. 

Forging a new learning environment with Jupyter Notebook

The top dog of all interactive learning platforms is by far the Jupyter project. This project has become the de-facto standard learning environment for data scientist around the world. This popularity originates from its close linkage to the languages Python and R.

Btw: did you know what Jupyter stands for “Julia, Python, and R”?

The rising popularity is also reflected by the number of .ipynb files (interactive python notebook - the file format of Jupyter Notebooks) on GitHub.

The rising popularity of Python Notebook on Github (Source)

Notebooks are the core of each Jupyter project and the origin of its simplicity. The code contained in them can be partitioned in small code snippets. The special feature is that those snippets can be enriched with explanations written in Markdown, a lightweight markup language. Beginners can execute the pre-defined snippets section by section. Each section is self-explanatory and thus, generates a unique learning environment.

An example of a Jupyter notebook with explanations and code next to each other

In this post we will run Jupyter Notebooks ON Cloud Foundry, thereby our notebooks will have access to Cloud Foundry services. This way, we can learn how to use Cloud Foundry services using Jupyter Notebook, running on Cloud Foundry.

Bundling the Learning Environment

It might be worth bundling the Notebook app with your training content like notebooks and possibly required datasets. The bundling can be done using with a new Docker image. This Dockerfile shows how new content can be added to an existing image:
FROM jupyter/minimal-notebook

RUN rm -d work
RUN mkdir Lesson_1
COPY Lesson_1 ./Lesson_1

Publishing the Image

  1. Sign up for a Docker account on and install docker

  1. Login via the command line
    docker login

  1. Build the image from the Dockerfile
    docker image build -t "cloudfoundryfun2" .

  1. Read the ID of your image
    docker images

  1. Tag the newly created image
    docker tag <Image ID> <Dockerhub User>/cloudfoundryfun2:latest

  1. Publish the image to Dockerhub
    docker push <Dockerhub User>/cloudfoundryfun2:latest

Note: You can skip this step and use the minimal-notebook if you don't want to add your own data to the image.

Combine the image with your Cloud Foundry Services

Similarly to my last post, specify your image and the bound Cloud Foundry services in a mtad.yaml, the descriptor file:
_schema-version: 3.2.0
ID: jupyter
description: Deploy jupyter notebooks in your SCP CF for learning purposes
version: 0.0.1
- name: jupyter-notebook
type: javascript.nodejs
path: .
- name: hana-service
disk-quota: 4G
memory: 3G
image: <Your Dockerhub User>/cloudfoundryfun2:latest
- name: hana-service
hdi-container-name: ${service-name}
service: hanatrial

This docker container will be bound to an SAP Leonardo Machine Learning Foundation service and an HDI container.

Build the MTAR archive with the cloud build tool.
mbt assemble

The structure of our bundle
Edit: The SAP Leonardo ML Foundation service in not available anymore.

Deploying the Notebook



  1. Use your MTAR

  2. Deploy the archive
    cf deploy jupyter_0.0.1.mtar

    This command outputs the URL of the running app.

  1. Access the Notebook
    You’ll notice that you need a token to access the notebook. You can find it in the logs of your application.


  1. Read the logs
    cf logs juypter-notebook –recent

    Copy and paste the token into the corresponding field.

  1. Login to service
    Open the notebook in the folder “Lesson_1” (if you added data to your own docker image)

  1. Have fun learning!

Disclaimer: I recommend using Jupyter Notebooks on Cloud Foundry only for educational purposes. The application itself runs on hardware that wasn’t designed for compute intense tasks (as machine learning is one).


In this edition you have learned:

  • What Jupyter Notebooks are and where they come from

  • How Docker images can be enriched with additional files

  • How to publish your own Docker images to Dockerhub

  • How to deploy Docker images along with cloud services to SAP Cloud Platform Cloud Foundry

  • How to read the log files of your Cloud Foundry apps

Would you like to learn more about the detailed steps (with actual training content) in a tutorial in our Developer Center? Let me know in the comments!

About this series

This was the second blog post of my monthly new series #CloudFoundryFun. The name already says all there is to it, this series won’t be about building enterprise apps on Cloud Foundry. I think there are already plenty of great posts about those aspects out there. This series rather thinks outside the box and demonstrates unconventional Cloud Foundry use-cases. And sometimes it might be pure entertainment ?.



CloudFoundryFun #3 – Create Your Own Blog on SAP Cloud Platform