[DS] Build JupyterHub with docker

JupyterHub

Use Docker to build a JupyterHub for multiple users

Notices

Before your start to build a JupyterHub with docker, please download the relative file at example.

Enable HTTPS (SSL encryption)

  1. Generate a self-signed certificate with openssl, as below:

    For example, the following command will create a certificate valid for 365 days with both the key and certificate data written to the same file:

    $ openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout jupyterhub.key -out jupyterhub.pem
    
  2. Copy the certificate and key file to a director named secrets in the root directory.

    $ mkdir -p secrets
    $ cp jupyterhub.key jupyterhub.pem secrets/
    

Create a JupyterHub Data Volumn

$ docker volume create --name jupyterhub-data

Create a Docker Network

$ docker network create jupyterhub-network

DockerSpawner: Build the Jupyter Notebook Image

$ make notebook_image

Build the JupyterHub Image

$ make build

Run JupyterHub

$ docker-compose up -d

Stop JupyterHub

$ docker-compose down

Stops containers and remove volumes created by up.

$ docker-compose down --volumes