拉镜像#
| docker pull captainji/jupyterlab |
启动jupyterlab服务#
| docker run -d \ |
| -p 8888:8888 \ |
| -e JUPYTER_ENABLE_LAB=yes \ |
| -v /data/docker/jupyter:/usr/local/src/jupyterlab_workspace \ |
| -v /usr/share/zoneinfo/Asia/Shanghai:/etc/localtime \ |
| -v /etc/timezone:/etc/timezone \ |
| --restart=always \ |
| --name JupyterLab captainji/jupyterlab |
获取jupyterlab 访问的token#
| # 获取容器日志,看日志中的token |
| docker logs JupyterLab |
| |
| #################################### |
| [I 2022-02-27 21:41:33.955 ServerApp] http: |
| [I 2022-02-27 21:41:33.955 ServerApp] or http: |
| [I 2022-02-27 21:41:33.955 ServerApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation). |
| [C 2022-02-27 21:41:33.958 ServerApp] |
| |
| To access the server, open this file in a browser: |
| file: |
| Or copy and paste one of these URLs: |
| http: |
| or http: |
| #################################### |
| 上面链接中的97c99de9e4b3ea86ebf567d8e1290c11023d165b7351156c 就是访问的token |
| |
访问jupyterlab#
| |
| http://服务器ip:8888/lab?token=97c99de9e4b3ea86ebf567d8e1290c11023d165b7351156c |
| |
设置jupyterlab自定义密码访问#
查看jupyterlab 配置#
| |
| docker exec -it JupyterLab /bin/bash |
| |
| cd ~/.jupyter/ |
| |
| root@3c12d28a99a2:~/.jupyter |
| Python 3.8.6 (default, Sep 25 2020, 09:36:53) |
| Type 'copyright', 'credits' or 'license' for more information |
| IPython 7.19.0 -- An enhanced Interactive Python. Type '?' for help. |
| |
| In [1]: from notebook.auth import passwd |
| |
| In [2]: passwd() |
| Enter password: |
| Verify password: |
| Out[2]: 'argon2:$argon2id$v=19$m=10240,t=10,p=8$R7ikdjMB7JBPTsV/XZPwUA$WYIpSx6zvn9H2HI4XIEHyA' |
| |
| |
修改jupyterlab 配置文件#
| vi jupyter_lab_config.py |
| |
| # 在配置文件底部增加以下内容(shift+g直接到文件底部) |
| c.NotebookApp.password ='argon2:$argon2id$v=19$m=10240,t=10,p=8$R7ikdjMB7JBPTsV/XZPwUA$WYIpSx6zvn9H2HI4XIEHyA' #秘钥(上一步获取的密钥) |
重启jupyterlab容器#
| docker restart JupyterLab |
| |
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· Docker 太简单,K8s 太复杂?w7panel 让容器管理更轻松!