我正在使用docker imagecontinuumio/anaconda3,并希望通过浏览器使用conda启动jupyter笔记本服务器...
docker run -i -t -p 8888:8888 continuumio/anaconda3 /bin/bash -c "/opt/conda/bin/conda install jupyter -y --quiet && mkdir /opt/notebooks && /opt/conda/bin/jupyter notebook --notebook-dir=/opt/notebooks --ip='*' --port=8888 --no-browser"
这导致...
Package plan for installation in environment /opt/conda:
The following packages will be UPDATED:
anaconda: 5.0.1-py36hd30a520_1 --> custom-py36hbbc8b67_0
conda: 4.3.30-py36h5d9f9f4_0 --> 4.4.10-py36_0
jupyter: 1.0.0-py36h9896ce5_0 --> 1.0.0-py36_4
pycosat: 0.6.2-py36h1a0ea17_1 --> 0.6.3-py36h0a5515d_0
[I 14:59:00.461 NotebookApp] Writing notebook server cookie secret to /root/.local/share/jupyter/runtime/notebook_cookie_secret
[W 14:59:00.475 NotebookApp] WARNING: The notebook server is listening on all IP addresses and not using encryption. This is not recommended.
[I 14:59:00.498 NotebookApp] JupyterLab alpha preview extension loaded from /opt/conda/lib/python3.6/site-packages/jupyterlab
JupyterLab v0.27.0
Known labextensions:
[I 14:59:00.499 NotebookApp] Running the core application with no additional extensions or settings
[C 14:59:00.502 NotebookApp] Running as root is not recommended. Use --allow-root to bypass.
如果我用
$ docker run -p 8888:8888 -i -t continuumio/anaconda3 /bin/bash
root@083f8fbb5d3b:/# jupyter notebook
它给 ...
[I 15:00:52.496 NotebookApp] Writing notebook server cookie secret to /root/.local/share/jupyter/runtime/notebook_cookie_secret
Traceback (most recent call last):
File "/opt/conda/bin/jupyter-notebook", line 11, in <module>
sys.exit(main())
File "/opt/conda/lib/python3.6/site-packages/jupyter_core/application.py", line 267, in launch_instance
return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
File "/opt/conda/lib/python3.6/site-packages/traitlets/config/application.py", line 657, in launch_instance
app.initialize(argv)
File "<decorator-gen-7>", line 2, in initialize
File "/opt/conda/lib/python3.6/site-packages/traitlets/config/application.py", line 87, in catch_config_error
return method(app, *args, **kwargs)
File "/opt/conda/lib/python3.6/site-packages/notebook/notebookapp.py", line 1296, in initialize
self.init_webapp()
File "/opt/conda/lib/python3.6/site-packages/notebook/notebookapp.py", line 1120, in init_webapp
self.http_server.listen(port, self.ip)
File "/opt/conda/lib/python3.6/site-packages/tornado/tcpserver.py", line 142, in listen
sockets = bind_sockets(port, address=address)
File "/opt/conda/lib/python3.6/site-packages/tornado/netutil.py", line 197, in bind_sockets
sock.bind(sockaddr)
OSError: [Errno 99] Cannot assign requested address
我应该如何运行Jupyter Notebook?
最佳答案
谢谢达思伯先生
$ docker run -p 8888:8888 -i -t continuumio/anaconda3 /bin/bash
jupyter notebook --ip=0.0.0.0 --port=8888 --allow-root
并且您已经启动并运行了Jupyter笔记本。
按ctrl,然后在您的终端上点击“使用 token 登录”链接,
http://0.0.0.0:8888/?token= ...
或者
http://127.0.0.1:8888/?token= ...