Giter VIP home page Giter VIP logo

dockerize-jupyter's Introduction

Dockerize-Jupyter

Serve any Jupyter notebook as a REST API using Docker using the Kernel-Gateway.

Development

First build the Docker image:

docker build -t jupyter .

Then start the Jupyter server with the local notebooks directory mapped:

docker run -p 8888:8888 -v $PWD/notebooks:/app/notebooks jupyter jupyter notebook --allow-root --ip=0.0.0.0 --notebook-dir=/app/notebooks

You can then directly develop new notebooks from the Jupyter application by opening the link starting with http://127.0.0.1 in your browser. It's possible to expose each notebook cell as a REST endpoint, see Kernel-Gateway documentation.

Note: If you need specific libraries from PyPi, you can add them to the requirements.txt file and rebuild the image. E.g. for adding pandas, add pandas==1.3.4 to the requirements.txt file.

After finishing development, you have to rebuild the image, to ensure that the latest changes of the notebook files are included in the image. You can then run the image to serve the notebook as a REST server

Run Server

Run the following command to run the Jupyter Docker image as a REST server:

docker run -p 8888:8888 -e KG_SEED_URI=notebooks/test.ipynb jupyter

The KG_SEED_URI environment variable is used to specify the notebook to be served.

After starting up, you can test the API by using curl, e.g.:

curl http://127.0.0.1:8888/test/123

dockerize-jupyter's People

Contributors

marcusschiesser avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.