gcloud中启动jupyter笔记本的问题

时间:2018-11-05 22:54:42

标签: google-cloud-platform jupyter-notebook

Anaconda已安装在此实例中,并且external ip已设置为静态。同时,添加了jupyter notebook的防火墙规则例外以提供:

Source IP ranges: 0.0.0.0/0
Allowed protocols and ports: tcp:8888

和配置文件.jupyter/jupyter_notebook_config.py.py已被编辑以添加以下术语:

c = get_config()
c.NotebookApp.ip = '*'
c.NotebookApp.open_browser = False
c.NotebookApp.port = <Port Number>

但是,当我运行jupyter-notebook时,我仍然收到以下信息:

[I 22:50:31.533 NotebookApp] JupyterLab extension loaded from /home/baggiohbs_1989/anaconda3/lib/python3.7/site-packages/jupyterlab
[I 22:50:31.533 NotebookApp] JupyterLab application directory is /home/baggiohbs_1989/anaconda3/share/jupyter/lab
[I 22:50:31.538 NotebookApp] Serving notebooks from local directory: /home/baggiohbs_1989
[I 22:50:31.538 NotebookApp] The Jupyter Notebook is running at:
[I 22:50:31.538 NotebookApp] http://(tf-with-anaconda1 or 127.0.0.1):8888/?token=5de42e55c4192604f3da19f3cb0d45a24cb0269e1de23f2b
[I 22:50:31.538 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 22:50:31.539 NotebookApp]

    Copy/paste this URL into your browser when you connect for the first time,
    to login with a token:
        http://(tf-with-anaconda1 or 127.0.0.1):8888/?token=5de42e55c4192604f3da19f3cb0d45a24cb0269e1de23f2b

怎么可能?我希望看到jupyter notebook在静态外部IP上运行。我错了哪一部分?

1 个答案:

答案 0 :(得分:0)

在您的情况下,它应该可以在外部IP地址上正常工作。记不清了,但我认为tf-with-anaconda1是具有外部IP的实例的DNS记录。如果您无法访问FireWall规则中最有可能出现问题的笔记本,则可以这样打开端口8888:

allow_port () {
     gcloud compute firewall-rules create allow-port-$1 --allow tcp:$1
}

allow_port 8888

顺便说一句,如果您正在使用深度学习映像jupyter labjupyter notebook(已在端口8080上运行),则只需打开端口8080,即可从Internet进行访问。