栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

jupyter notebook + 服务器中docker 使用配置

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

jupyter notebook + 服务器中docker 使用配置

背景:
设备1: 服务器Ubuntu16.04 无图形界面,docker 环境
设备2:笔记本

期望在笔记本访问 服务器docker中的环境(pytorch等)

step 1: 确保笔记本能访问到服务器
ssh -p 11122 user_name@ssh-proxy.xxx.com
其中user_name@ssh-proxy.xxx.com 为服务器用户名和地址

11122 为docker 映射端口

step2: 服务器docker 安装jupyter
pip install jupyter notebook
ipython -> 分别输入
from notebook.auth import passwd
passwd()

输完之后,设定一个密码,会生成一个sha1的秘钥会有如下的结果:

这时候把sha1秘钥保存下来,然后退出ipython命令行:
quit()
生成jupyter notebook的配置文件
jupyter notebook --generate-config
这时候会生成配置文件,在 ~/.jupyter/jupyter_notebook_config.py

vim ~/.jupyter/jupyter_notebook_config.py
编辑,其中sha1那一串秘钥是上面生成的那一串
c.NotebookApp.ip=’*’
c.NotebookApp.password = u’sha1:41e4da01dde4:e820dc9c0398eda2dc9323c9e4a51ea1228166a2’
c.NotebookApp.open_browser = False
c.NotebookApp.port =8888
8888表明要使用container的8888端口访问jupyter,然后保存退出。

服务器中打开jupyter notebook
jupyter notebook --allow-root

step3: 笔记本运行命令进行端口映射
ssh -N -p 11122 -L 8888:localhost:8888 user_name@ssh-proxy.xxx.com

step4: 笔记本输入
http://127.0.0.1:8888/
访问服务器中的docker环境

参考
基于docker的服务器端使用jupyter notebook的方法

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/341482.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号