我让docker使用带有张量流的jupyter笔记本。 (我的操作系统是窗口10,所以我使用Powershell。)
我希望jupyter自动打开Web浏览器。当我尝试初始化jupyter笔记本时。
例如,我输入命令启动anaconda图像(包括tensorflow)。
> docker run -it -v ~/tensorwork:/notebooks -p 8888:8888 anaconda3
并激活tensorflow
(base) root@e088a0e0e58e:/# conda activate tensorflow
进入tensorflow内核模式后,执行jupyter notebook。
(tensorflow) root@e088a0e0e58e:/# jupyter notebook --ip '*' --allow-root
[I 14:47:00.827 NotebookApp] [nb_conda_kernels] enabled, 4 kernels found
[W 14:47:01.080 NotebookApp] WARNING: The notebook server is listening on all IP addresses and not using encryption. This is not recommended.
[I 14:47:01.214 NotebookApp] [nb_anacondacloud] enabled
[I 14:47:01.219 NotebookApp] [nb_conda] enabled
[I 14:47:01.265 NotebookApp] ✓ nbpresent HTML export ENABLED
[W 14:47:01.265 NotebookApp] ✗ nbpresent PDF export DISABLED: No module named 'nbbrowserpdf'
[I 14:47:01.268 NotebookApp] Serving notebooks from local directory: /
[I 14:47:01.269 NotebookApp] 0 active kernels
[I 14:47:01.269 NotebookApp] The Jupyter Notebook is running at:
[I 14:47:01.269 NotebookApp] http://[all ip addresses on your system]:8888/?token=55d0e39e50ff64ca52ab43516d06c96127704fb56de2d356
[I 14:47:01.269 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[W 14:47:01.270 NotebookApp] No web browser found: could not locate runnable browser.
[C 14:47:01.275 NotebookApp]
Copy/paste this URL into your browser when you connect for the first time,
to login with a token:
http://localhost:8888/?token=55d0e39e50ff64ca52ab43516d06c96127704fb56de2d356
jupyter笔记本的执行效果很好 但是,我手动输入我的浏览器的URL进入笔记本。
我猜这个问题来自于docker的功能。容器的文件路径需要连接到本地主机,以便jupyter可以找到我使用的默认Web浏览器(chrome)。
但我怎么能让它成为可能呢?我已经尝试过jupyter笔记本的编辑配置。
在执行jupyter notebook之前,我输入如下命令:
jupyter notebook --generate-config
vim ~/.jupyter/jupyter_notebook_config.py # or use your favorite editor
c.NotebookApp.browser = u'chrome'
(参考; https://groups.google.com/a/continuum.io/forum/#!topic/anaconda/oXjbKNMyP30)
但jupyter仍然说它找不到任何网络浏览器。请帮帮我:)。