JupyterLab Docker部署
- 参照官方文档搭建 docker官方Jupyter安装文档
编写DockerFile
- vim jupyterlab.Dockerfile
粘贴下方代码
# 从官方镜像获取
FROM quay.io/jupyter/base-notebook
# 自定义安装依赖包
RUN pip install -i https://pypi.tuna.tsinghua.edu.cn/simple/ --no-cache-dir pandas numpy selenium matplotlib
# 安装Jupyter插件,汉化包等
RUN pip install -i https://pypi.tuna.tsinghua.edu.cn/simple/ jupyterlab-language-pack-zh-CN \
jupyterlab_code_formatter \
jupyterlab-execute-time \
jupytext \
jupyterlab_spellchecker \
jupyterlab-lsp
构建镜像
- docker build -f jupyterlab.Dockerfile -t jupyterlab .
-f指定文件名-t命名镜像名.镜像构建工作区

- docker images 查看镜像

编写Docker Compose文件
- vim jupyterlab.yaml
粘贴以下代码
services:
jupyterlab:
container_name: jupyterlab
image: jupyterlab
ports:
- "8888:8888"
volumes:
- jupyter-data:/home/jovyan/work # 官方挂载work目录,可自行修改
command: start-notebook.py --NotebookApp.token='jupyterlab' # 自定义token登陆时可重置密码
volumes:
jupyter-data:
name: jupyter-data
创建容器
- docker compose -f jupyterlab.yaml up -d
-f指定文件名-d后台运行

访问页面
这时访问8888端口即可开始使用jupyterlab,可以看到安装的插件也在。


3043

被折叠的 条评论
为什么被折叠?



