snippetdockerMinor
How to dockerize a jupyer notebooks project?
Viewed 0 times
notebooksjupyerprojecthowdockerize
Problem
I have a project composed of 6 different Jupyter Notebooks and 4 CSV files. I would like also my colleagues can try to use this project, even if they don't have python installed and maybe with another csv. Is it possible to do this by creating a docker image of this project and letting them "play" with the notebooks and the data?
Solution
Yeah, you can totally do this. We actually do a step up above that. We run https://zero-to-jupyterhub.readthedocs.io/ over kubernetes. It gives each user their own notebook server on kubernetes, but its based on a given docker image. So, we build notebooks and some data files into the images so that each user starts with default examples/tutorials.
More recently, we also found "The Littlest JupyterHub". This is much simpler and lets you host a multi user JupyterHub server which you can do similar things to -> https://tljh.jupyter.org/en/latest/index.html.
The two above options are nice as you can "host" the service for everyone on a server/site so they don't have to set up their local computers. But they still each get their own area/sandbox.
If you really just want a docker image, then start your docker file with
This last option is less ideal though as it requires users to actually have Docker installed and have some knowledge of using it (pull image/create/manage containers). Many people that use Jupyter/Python for some data tasks often have no idea about Docker.
The service alternatives above let you deal with the set-up so your users can focus on the product.
More recently, we also found "The Littlest JupyterHub". This is much simpler and lets you host a multi user JupyterHub server which you can do similar things to -> https://tljh.jupyter.org/en/latest/index.html.
The two above options are nice as you can "host" the service for everyone on a server/site so they don't have to set up their local computers. But they still each get their own area/sandbox.
If you really just want a docker image, then start your docker file with
FROM the image here -> https://jupyterhub.readthedocs.io/en/stable/quickstart-docker.html. Then you can COPY the notebook and CSV files to the user home directory. Then people can use your image instead, if you host it on DockerHub or some org registry like ECR/GitLab/Artifactory/etc.This last option is less ideal though as it requires users to actually have Docker installed and have some knowledge of using it (pull image/create/manage containers). Many people that use Jupyter/Python for some data tasks often have no idea about Docker.
The service alternatives above let you deal with the set-up so your users can focus on the product.
Context
StackExchange DevOps Q#15206, answer score: 2
Revisions (0)
No revisions yet.