Skip to content

Instantly share code, notes, and snippets.

@garywu
Last active February 8, 2017 05:05
Show Gist options
  • Select an option

  • Save garywu/6c01c97bcb4dd5a62d4f49abc75a412f to your computer and use it in GitHub Desktop.

Select an option

Save garywu/6c01c97bcb4dd5a62d4f49abc75a412f to your computer and use it in GitHub Desktop.
jupyter-notebook-kernel-gateway-hello-world
Jupyter notebook as microservice with kernel gateway and docker

#Minimum jupyter kernel gateway microservice Size of docker image is 500 MB

  1. clone or download the gist
  2. build the docker container
docker build -t hello-service .
  1. run docker

    docker run -p 8888:8888  hello-service
    
  2. browse to http://localhost:8888/hello

  3. you should see output:

    {
       hello: "world"
    }
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
# jupyter/base-notebook 493 MB
FROM jupyter/base-notebook
# jupyter/minimal-notebook 2 GB
# FROM jupyter/minimal-notebook
# RUN pip install --upgrade pip
# Install Kernel Gateway
RUN pip install jupyter-kernel-gateway
# Configure container startup
ENTRYPOINT ["tini", "--", "jupyter", "kernelgateway", "--KernelGatewayApp.api=notebook-http", "--KernelGatewayApp.ip=0.0.0.0", "--KernelGatewayApp.seed_uri=/srv/notebooks/hello.ipynb"]
# Add notebook served by the kernel gateway
ADD hello.ipynb /srv/notebooks/
# Run container as user jovyan
USER jovyan
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment