Jupyter Notebook is part of Project Jupyter which is announced by Fernando Pérez in 2014. It’s a spin-off project from IPython and become the kernel for Jupyter.
Jupyter is a language agnostic and support other programming language like Python, Julia, R, Haskel and Ruby. It’s 100% open-source.
The file format for Jupyter is ‘.ipynb’.
The Jupyter kernel is responsible for handling various type of request (code execution, code completion, inspection) and providing a reply. Since it can connect to many kernels,
it can provide programming in different languages.
In this tutorial, I use:
-Xubuntu 18.04
-Docker 20.10.14
STEP1.FIND THE IMAGES
First, we have to get the docker image. Make sure you are connected to the Internet.
darklinux@darklinuxpc:~$ docker search jupyter NAME DESCRIPTION STARS OFFICIAL AUTOMATED jupyter/datascience-notebook Jupyter Notebook Data Science Stack from htt… 917 jupyter/all-spark-notebook Jupyter Notebook Python, Scala, R, Spark, Me… 375 jupyter/scipy-notebook Jupyter Notebook Scientific Python Stack fro… 340 jupyterhub/jupyterhub JupyterHub: multi-user Jupyter notebook serv… 310 [OK] jupyter/tensorflow-notebook Jupyter Notebook Scientific Python Stack w/ … 301 jupyter/pyspark-notebook Jupyter Notebook Python, Spark, Mesos Stack … 224 jupyter/base-notebook Small base image for Jupyter Notebook stacks… 169 jupyter/minimal-notebook Minimal Jupyter Notebook Stack from https://… 154 jupyter/r-notebook Jupyter Notebook R Stack from https://github… 44 jupyterhub/singleuser single-user docker images for use with Jupyt… 43 [OK] jupyter/nbviewer Jupyter Notebook Viewer 27 [OK] bitnami/jupyter-base-notebook 24 jupyterhub/k8s-hub 18 bitnami/jupyterhub 11 jupyterhub/k8s-singleuser-sample 9 jupyterhub/configurable-http-proxy node-http-proxy + REST API 6 [OK] jupyterhub/k8s-network-tools 2 graphcore/pytorch-jupyter The Poplar® SDK plus PyTorch for IPUs includ… 1 ibmcom/jupyter-base-notebook-ppc64le Small base image for Jupyter Notebook stacks… 1 pachyderm/jupyterhub-pachyderm-user 0 ibmcom/jupyter-nb-nb2kg 0 pachyderm/jupyterhub-pachyderm-hub 0 graphcore/tensorflow-jupyter The Poplar® SDK plus TensorFlow 1 & 2 for IP… 0 ibmcom/jupyter-ppc64le 0 ibmcom/jupyter 0 darklinux@darklinuxpc:~$
STEP 3. DOWNLOAD THE IMAGE
darklinux@darklinuxpc:~$ docker pull jupyter/datascience-notebook Using default tag: latest latest: Pulling from jupyter/datascience-notebook d5fd17ec1767: Pull complete 9288915018bc: Pull complete ad895732ee5c: Pull complete 4f4fb700ef54: Pull complete 7b053b0d567d: Pull complete 577d6f3bb6f4: Pull complete 1d18b5a5f242: Pull complete ffc9ad0a0b36: Pull complete 75f3e04b1547: Pull complete e9036ae1aec3: Pull complete 8016e50184c6: Pull complete 55f4c93ee7b8: Pull complete 17c3e54db24b: Pull complete e8c81a9b6c9a: Pull complete 530f1db1e9d7: Pull complete 44fa9360bdc5: Pull complete 6f59df66069f: Pull complete a8c1c1bcf1d4: Pull complete 5784e3ca1d66: Pull complete 60e2c9b0e0a4: Pull complete 4866b0f6598a: Pull complete 613fc67c0714: Pull complete 2a41639ceb55: Pull complete fa391f2a4b79: Pull complete Digest: sha256:acd52864dd364e2e5c494ccefa661e6f58f551c9006ec7263d7b5afd5d1852e9 Status: Downloaded newer image for jupyter/datascience-notebook:latest docker.io/jupyter/datascience-notebook:latest darklinux@darklinuxpc:~$
STEP3. CHECK THE IMAGE
darklinux@darklinuxpc:~$ sudo docker images REPOSITORY TAG IMAGE ID CREATED SIZE jupyter/datascience-notebook latest 0376841b7305 15 hours ago 4.42GB jupyter/datascience-notebook <none> 02e55f7a76b5 3 months ago 4.22GB ubuntu latest ba6acccedd29 6 months ago 72.8MB ubuntu 18.04 5a214d77f5d7 7 months ago 63.1MB 32bit/ubuntu bionic c0f69fac47fc 2 years ago 423MB ubuntu bionic c3c304cb4f22 2 years ago 64.2MB hello-world latest bf756fb1ae65 2 years ago 13.3kB mongo 4.1 d93e3cc722d8 2 years ago 360MB garland/xampp-base latest 21861acf735a 7 years ago 1.44GB darklinux@darklinuxpc:~$
I’ve downloaded Jupyter/datascience-notebook before, that’s why there are 2 now. Docker will not replace the image although the image name is the same. The images are differentiated with Image ID.
STEP4. RUNNING THE IMAGE
The image is ready. Now, we can run it to create the docker container.
If you don’t specify the container name, docker will create it for you.
$ docker run -p 8888:8888 jupyter/datascience-notebook
If you specify the name, you will get the container as you specified.
$ docker run -p 8888:8888 –name=jupyter-notebook jupyter/datascience-notebook
darklinux@darklinuxpc:~$ docker run -p 8888:8888 --name=jupyter-notebook jupyter/datascience-notebook Entered start.sh with args: jupyter lab Executing the command: jupyter lab [I 2022-05-06 04:36:30.541 ServerApp] jupyterlab | extension was successfully linked. [W 2022-05-06 04:36:30.563 NotebookApp] 'ip' has moved from NotebookApp to ServerApp. This config will be passed to ServerApp. Be sure to update your config before our next release. [W 2022-05-06 04:36:30.563 NotebookApp] 'port' has moved from NotebookApp to ServerApp. This config will be passed to ServerApp. Be sure to update your config before our next release. [W 2022-05-06 04:36:30.563 NotebookApp] 'port' has moved from NotebookApp to ServerApp. This config will be passed to ServerApp. Be sure to update your config before our next release. [I 2022-05-06 04:36:30.578 ServerApp] nbclassic | extension was successfully linked. [I 2022-05-06 04:36:30.607 ServerApp] Writing Jupyter server cookie secret to /home/jovyan/.local/share/jupyter/runtime/jupyter_cookie_secret [I 2022-05-06 04:36:32.379 ServerApp] notebook_shim | extension was successfully linked. [I 2022-05-06 04:36:32.507 ServerApp] notebook_shim | extension was successfully loaded. [I 2022-05-06 04:36:32.510 LabApp] JupyterLab extension loaded from /opt/conda/lib/python3.9/site-packages/jupyterlab [I 2022-05-06 04:36:32.510 LabApp] JupyterLab application directory is /opt/conda/share/jupyter/lab [I 2022-05-06 04:36:32.530 ServerApp] jupyterlab | extension was successfully loaded. [I 2022-05-06 04:36:32.555 ServerApp] nbclassic | extension was successfully loaded. [I 2022-05-06 04:36:32.557 ServerApp] Serving notebooks from local directory: /home/jovyan [I 2022-05-06 04:36:32.557 ServerApp] Jupyter Server 1.17.0 is running at: [I 2022-05-06 04:36:32.558 ServerApp] http://2557ebac7ab1:8888/lab?token=de96fd0d44694ef387ae34c27a4222d1976dbdb795aaa308 [I 2022-05-06 04:36:32.559 ServerApp] or http://127.0.0.1:8888/lab?token=de96fd0d44694ef387ae34c27a4222d1976dbdb795aaa308 [I 2022-05-06 04:36:32.559 ServerApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation). [C 2022-05-06 04:36:32.566 ServerApp] To access the server, open this file in a browser: file:///home/jovyan/.local/share/jupyter/runtime/jpserver-7-open.html Or copy and paste one of these URLs: http://2557ebac7ab1:8888/lab?token=de96fd0d44694ef387ae34c27a4222d1976dbdb795aaa308 or http://127.0.0.1:8888/lab?token=de96fd0d44694ef387ae34c27a4222d1976dbdb795aaa308
STEP5. RUNNING FROM CONTAINER
Open other linux terminal and check the docker IP address.
In my device is: 172.17.0.1
darklinux@darklinuxpc:~$ ifconfig docker0 docker0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 172.17.0.1 netmask 255.255.0.0 broadcast 172.17.255.255 inet6 fe80::42:85ff:fefe:69a5 prefixlen 64 scopeid 0x20<link> ether 02:42:85:fe:69:a5 txqueuelen 0 (Ethernet) RX packets 697 bytes 6827968 (6.8 MB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 805 bytes 249616 (249.6 KB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 darklinux@darklinuxpc:~$
Use this IP address and Jupyter port, to open Jupyter_notebook in browser.
So, it become: 172.17.0.1:8888
Use the token for the password.
de96fd0d44694ef387ae34c27a4222d1976dbdb795aaa308
STEP6. CHANGE THE PASSWORD
You can login with the Token, but I prefer login via password.
So,you have to set the password first.
Scrool down the webpage, copy paste the Token in Token text box and Enter a new password.
If you everthing run well, you will the screen below:
Jupyter Notebook is ready to use.
Leave a comment