Better Programming

Advice for programmers.

Follow publication

Member-only story

How To Share Jupyter Notebooks With Docker

A quick walk-through example for sharing your Notebooks

George Pipis
Better Programming
Published in
4 min readFeb 16, 2021
Image of a whale
Image on Unsplash

As data scientists, we want our work to be reproducible, meaning that when we share our analysis everyone should be able to re-run it and come up with the same results. This is not always easy, since we are dealing with different operating systems (iOS, Windows, Linux) and different programming language versions and packages. That is why we encourage you to work with virtual environments like conda environments. Another more robust solution from conda environments is to work with Dockers.

Scenario: We have run an analysis using Python Jupyter Notebooks on our own data, and we want to share this analysis with various communities ensuring that everyone will be able to reproduce the results.

Run the Analysis Locally

For simplicity, let’s assume that I have run the following analysis:

In essence, I try to run a sentiment analysis on my_data.csv using the pandas, numpy and vaderSentiment libraries. Thus, I want to share this Jupyter Notebook, and I want it to be plug-and-play. Let's see how I can create a docker image containing a Jupyter Notebook, as well as my data and the required libraries.

Jupyter Docker Stacks

Jupyter Docker Stacks are a set of ready-to-run Docker images containing Jupyter applications and interactive computing tools. You can use a stack image to do any of the following (and more):

  • Start a personal Jupyter Notebook server in a local Docker container
  • Run JupyterLab servers for a team using JupyterHub
  • Write your own project Dockerfile

We will build our custom image based on jupyter/scipy

Create the…

Create an account to read the full story.

The author made this story available to Medium members only.
If you’re new to Medium, create a new account to read this story on us.

Or, continue in mobile web

Already have an account? Sign in

George Pipis
George Pipis

Written by George Pipis

Sr. Director, Data Scientist @ Persado | Co-founder of the Data Science blog: https://predictivehacks.com/

No responses yet

Write a response