Running Jupyter Notebook inside Docker

I’ve started Stanford class CS224n: Natural Language Processing with Deep Learning

Part of this is to setup and runnig a Jupyter Notebook; but I dont want to install anything locally, in the end, docker should be the tool to run all this things.

Part of the learning points I have to myself is to adquire how to scale any necesary element if I need it.

Run Jupyter Notebook in Docker

Thanks to

This is the docker-compose.yml to run one notebook:

version:  '3'
services:
  datascience-notebook:
    image: jupyter/datascience-notebook
    volumes:
      - ./:/home/jovyan/work
    ports:
      - 8888:8888
    container_name:   jupyter_notebook
    command: "start-notebook.sh"

NOTE: volumes ./ sets a folder where you will access your files inside jupyter

When you start with docker-compose up will show a message like:

jupyter_notebook        | Executing the command: jupyter notebook
jupyter_notebook        | [I 23:37:08.146 NotebookApp] Writing notebook server cookie secret to /home/jovyan/.local/share/jupyter/runtime/notebook_cookie_secret
jupyter_notebook        | [I 23:37:09.002 NotebookApp] JupyterLab extension loaded from /opt/conda/lib/python3.7/site-packages/jupyterlab
jupyter_notebook        | [I 23:37:09.003 NotebookApp] JupyterLab application directory is /opt/conda/share/jupyter/lab
jupyter_notebook        | [I 23:37:09.006 NotebookApp] Serving notebooks from local directory: /home/jovyan
jupyter_notebook        | [I 23:37:09.006 NotebookApp] The Jupyter Notebook is running at:
jupyter_notebook        | [I 23:37:09.007 NotebookApp] http://7ab23d98d2b8:8888/?token=8eb71442202c5bcfb43c06e7a82e619da72f3c1161a02128
jupyter_notebook        | [I 23:37:09.007 NotebookApp]  or http://127.0.0.1:8888/?token=8eb71442202c5bcfb43c06e7a82e619da72f3c1161a02128
jupyter_notebook        | [I 23:37:09.007 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
jupyter_notebook        | [C 23:37:09.011 NotebookApp]
jupyter_notebook        |
jupyter_notebook        |     To access the notebook, open this file in a browser:
jupyter_notebook        |         file:///home/jovyan/.local/share/jupyter/runtime/nbserver-6-open.html
jupyter_notebook        |     Or copy and paste one of these URLs:
jupyter_notebook        |         http://7ab23d98d2b8:8888/?token=8eb71442202c5bcfb43c06e7a82e619da72f3c1161a02128
jupyter_notebook        |      or http://127.0.0.1:8888/?token=8eb71442202c5bcfb43c06e7a82e619da72f3c1161a02128

To open the jupyter notebooks on you local browser you need to check your docker-machine IP and replace it into the corresnpodent url:

From:

http://127.0.0.1:8888/?token=8eb71442202c5bcfb43c06e7a82e619da72f3c1161a02128

To:

http://{docker-machine-ip}:8888/?token=8eb71442202c5bcfb43c06e7a82e619da72f3c1161a02128