Jupyter notebooks are handy for data science and other use cases that rely on iterative programming. If you’re already comfortable running Docker, here’s an easy one-liner to get up and running.
docker run --rm -p 10000:8888 -v ${PWD}:/home/jovyan/work jupyter/datascience-notebook:2023-03-09
The first port number (10000
) can be changed to expose the notebook to a different port. The volume (-v
) flag can be changed from the present directory (${PWD}
) to a directory containing data you’d like to work with. To connect to the notebook, you’ll need to get the connection string from the output. It’ll look like this:
[I 2023-03-13 17:23:37.887 ServerApp] Jupyter Server 2.4.0 is running at:
[I 2023-03-13 17:23:37.887 ServerApp] http://bc7b3ff32303:8888/lab?token=6fd0237c4df26bc1e1af4a7c386c28c8573498850701f200
[I 2023-03-13 17:23:37.887 ServerApp] http://127.0.0.1:8888/lab?token=6fd0237c4df26bc1e1af4a7c386c28c8573498850701f200
If you’re doing this from a Chromebook, you’ll have to get the real IP address from the output of ip addr show dev eth0
. The port number is actually 10000
or whatever port you exposed. So the URL to paste in your browser will be something like this:
http://100.115.92.199:10000/lab?token=6fd0237c4df26bc1e1af4a7c386c28c8573498850701f200
Easy peasy!