參考 Jupyter Docker Stacks documentation
容器地址在 quay.io/jupyter/scipy-notebook
如果你直接執行命令:
docker run -p 10000:8888 quay.io/jupyter/scipy-notebook:2024-03-14
你啟動的 Jupyter 服務會執行在一個奇怪的域名:
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://1f6fc664b015:8888/lab?token=73a9a4986e03cf7bec47b0a93de0bb712fe2d1cefbb02552
http://127.0.0.1:8888/lab?token=73a9a4986e03cf7bec47b0a93de0bb712fe2d1cefbb02552
你可以設定 ip='*'
引數來將域名變成 localhost
:
docker run -p 10000:8888 quay.io/jupyter/scipy-notebook:2024-03-14 start-notebook.py --ServerApp.ip='*'
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://localhost:8888/lab?token=f0bfa879fbbd9859579ee7e1cf2b166b600f912feb8f62af
http://127.0.0.1:8888/lab?token=f0bfa879fbbd9859579ee7e1cf2b166b600f912feb8f62af
這裡
ip
引數是透過start-notebook.py
指令碼提供的。向指令碼指定--ServerApp.ip
選項來設定ip
引數。
你還可以設定容器名、後臺執行、關聯掛載等引數:
docker run --name jupyter -d -p 8888:8888 -v ~/notebooks:/home/jovyan quay.io/jupyter/scipy-notebook start-notebook.py --ServerApp.ip='*'
然後透過下面的命令來檢視服務地址:
docker exec jupyter jupyter server list
Currently running servers:
http://localhost:8888/?token=03bd71def07b54f61399f03b8214c19f8ac2d51dd614707d :: /home/jovyan