[英]Docker - Connecting to Jupyter notebook
我正在嘗試在 docker 中運行 Jupyter 筆記本,因為我嘗試了命令 -
docker run -p 8888:8888 jupyter/scipy-notebook
Executing the command: jupyter notebook
[I 04:19:53.460 NotebookApp] Writing notebook server cookie secret to /home/jovyan/.local/share/jupyter/runtime/notebook_cookie_secret
[I 04:19:53.856 NotebookApp] JupyterLab extension loaded from /opt/conda/lib/python3.8/site-packages/jupyterlab
[I 04:19:53.856 NotebookApp] JupyterLab application directory is /opt/conda/share/jupyter/lab
[I 04:19:53.859 NotebookApp] Serving notebooks from local directory: /home/jovyan
[I 04:19:53.859 NotebookApp] Jupyter Notebook 6.1.4 is running at:
[I 04:19:53.859 NotebookApp] http://ed93c6a6ff91:8888/?token=40c97f5c727829f0c094449618af1cad30d56a8d5c252b6c
[I 04:19:53.859 NotebookApp] or http://127.0.0.1:8888/?token=40c97f5c727829f0c094449618af1cad30d56a8d5c252b6c
[I 04:19:53.859 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 04:19:53.861 NotebookApp]
To access the notebook, open this file in a browser:
file:///home/jovyan/.local/share/jupyter/runtime/nbserver-6-open.html
Or copy and paste one of these URLs:
http://ed93c6a6ff91:8888/?token=40c97f5c727829f0c094449618af1cad30d56a8d5c252b6c
or http://127.0.0.1:8888/?token=40c97f5c727829f0c094449618af1cad30d56a8d5c252b6c
當我嘗試使用以下網址連接到筆記本時(我嘗試了三種不同的瀏覽器) -
file:///home/jovyan/.local/share/jupyter/runtime/nbserver-6-open.html
OR
http://ed93c6a6ff91:8888/?token=40c97f5c727829f0c094449618af1cad30d56a8d5c252b6c
我收到錯誤代碼ERR_NAME_NOT_RESOLVED無法立即訪問該站點,同時使用 url -
http://127.0.0.1:8888/?token=40c97f5c727829f0c094449618af1cad30d56a8d5c252b6c
瀏覽器會繼續嘗試連接一段時間,然后得到ERR_CONNECTION_RESET
我試圖禁用我的 VPN。 我還嘗試使用export no_proxy=127.0.0.1
設置no_proxy變量,但我仍然無法連接到 jupyter notebook。
操作系統 - Manjaro Linux ,
碼頭工人形象-
REPOSITORY TAG IMAGE ID CREATED SIZE
jupyter/scipy-notebook latest b8f7562c1262 4 days ago 2.7GB
任何有關如何排除故障和連接到筆記本電腦的幫助或指導都會很有幫助。
Or copy and paste one of these URLs:
http://ed93c6a6ff91:8888/?token=40c97f5c727829f0c094449618af1cad30d56a8d5c252b6c
or http://127.0.0.1:8888/?token=40c97f5c727829f0c094449618af1cad30d56a8d5c252b6c
↑ 那是你的 docker 容器 IP 和主機名。 您需要使用 docker 容器之外的 IP 進行連接。
例如,如果您的 docker 主機(物理 linux 機器)IP 是 192.168.0.100 嘗試訪問
http://192.168.0.100:8888/?token=40c97f5c727829f0c094449618af1cad30d56a8d5c252b6c
如果在這種情況下您無法訪問,請嘗試通過運行來設置您的主機 IP
docker run -p 192.168.0.100:8888:8888 jupyter/scipy-notebook
嘗試運行
sudo netstat -ntpl | grep 8888
如果你會看到類似的東西
tcp6 0 0 :::8888 :::* LISTEN 1234/docker-proxy
或者
tcp 0 0 0.0.0.0:8888 0.0.0.0:* LISTEN 1234/docker-proxy
這意味着您的 docker 運行良好並將 8888 端口轉發到所有本地 IP(包括 localhost)。
因此,如果您可以看到打開的端口但無法連接,則很可能是防火牆造成的。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.