1.docker安装
docker exec -it dfefa656bf29 /bin/bash
进入容器后,输入命令:jupyter notebook list
http://dfefa656bf29:8888/?token=03ec033-b:: /home/jovyan
记下token,设置密码 123123123
2.安装jupyter
pip install jupyter
无法用pip3
3.安装vim
apt-get update
apt-get install vim
4.配置jupyter notebook可远程访问
jupyter-notebook --generate-config
#输入密码两次
jupyter-notebook password
# 复制下面的sha1码
cat /root/.jupyter/jupyter_notebook_config.json
vim /root/.jupyter/jupyter_notebook_config.py
# 在jupyter_notebook_config.py文件末填入下面配置:
# 允许通过任意绑定服务器的ip访问
c.NotebookApp.ip = '*'
# 用于访问的端口
c.NotebookApp.port = 8888
# 不自动打开浏览器
c.NotebookApp.open_browser = False
# 设置登录密码
c.NotebookApp.password = u'sha1:xxxxxxxxxxxxxxxx' # json中复制的sha1码
5.容器内启动jupyter
jupyter-notebook --ip=0.0.0.0 --allow-root
6.本地浏览器访问远程docker的jupyter
http://宿主机ip:8888
备注
按Ctrl+P+Q退出容器但不关闭