前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >JupyterLab Dockerfile 内置基础扩展及机器学习库,让你快速进入学习

JupyterLab Dockerfile 内置基础扩展及机器学习库,让你快速进入学习

作者头像
李昂君
发布2021-12-24 19:03:52
1.4K0
发布2021-12-24 19:03:52
举报
文章被收录于专栏:李昂君李昂君

阅读量: 13

仓库地址

github:https://github.com/JoiLa/jupyterlab-dockerfile-template

Dockerfile配置

代码语言:javascript
复制
# 基于 anaconda
FROM continuumio/anaconda3:latest

MAINTAINER liang <liang@lilogs.com>
# 更新软件源
RUN apt-get update
# 安装软件源

RUN apt-get install wget vim curl -y

# `conda` 更新
RUN conda update -n base -c defaults conda -y
# `jupyter lab` 服务安装
RUN conda install -c conda-forge jupyterlab -y
# 安装`nodejs v12.4.0`
RUN conda install -c conda-forge/label/cf202003 nodejs -y
# 安装`jupyterlab-lsp`编码助手
RUN conda install -c conda-forge 'jupyterlab>=3.0.0,<4.0.0a0' jupyterlab-lsp -y
# 安装`jupyterlab-lsp`服务
RUN pip install 'python-lsp-server[all]'
# `jupyter lab` 安装中文语言包
RUN pip install jupyterlab-language-pack-zh-CN
# 安装`jupyter lab`插件
RUN pip install jupyterlab_code_formatter
# `jupyter lab`扩展安装
# 安装格式化规范
RUN pip install isort black autopep8
# `jupyter lab`扩展服务启动
RUN jupyter serverextension enable --py jupyterlab_code_formatter
# - 格式化代码插件
RUN jupyter labextension install @ryantam626/jupyterlab_code_formatter


# 安装机器学习库
RUN pip install scikit-learn
RUN pip install numpy
RUN pip install scipy
RUN pip install matplotlib
RUN pip install pandas
# 查看 pip list
RUN pip list

# 设置配置信息
RUN echo "==========================================================================="
# 设置`格式化规范`
COPY ./config/settings.jupyterlab-settings  /root/.jupyter/lab/user-settings/@ryantam626/jupyterlab_code_formatter/settings.jupyterlab-settings
# 设置`快捷键`快速格式化
COPY ./config/shortcuts.jupyterlab-settings /root/.jupyter/lab/user-settings/@jupyterlab/shortcuts-extension/shortcuts.jupyterlab-settings
# 设置`jupyter lab`主题为暗黑
COPY ./config/themes.jupyterlab-settings  /root/.jupyter/lab/user-settings/@jupyterlab/apputils-extension/themes.jupyterlab-settings
# 设置`jupyter lab`语言为中文
COPY ./config/plugin.jupyterlab-settings /root/.jupyter/lab/user-settings/@jupyterlab/translation-extension/plugin.jupyterlab-settings
RUN echo "==========================================================================="


# 定义工作环境变量
ENV MYPATH /work
# 设置工作环境变量
WORKDIR $MYPATH

# 启动`jupyter lab` 服务
CMD jupyter lab --ip='*' --port=8888 --no-browser --allow-root --NotebookApp.token=''
# 暴露工作端口
EXPOSE 8888

docker构建镜像

代码语言:javascript
复制
# cd 到Dockerfile 的根目录,执行一下命令
# 这里给镜像命名为“author/image-name:1.0”,在实际应用中,因个人应用命名。
docker build -t author/image-name:1.0 .

docker 启动

代码语言:javascript
复制
docker run -d -p 8081:8888 author/image-name:1.0
# 容器启动后,打开地址查看效果:http://127.0.0.1:8081

docker-composer 配置快速编排

代码语言:javascript
复制
version: '2'

services:
  anaconda-jupyter-lab-server:
    image: author/image-name:1.0
    restart: always
    volumes:
      - /opt/docker-anaconda/root:/work
    ports:
      - 8800:8888
本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2021-11-08 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 仓库地址
  • Dockerfile配置
  • docker构建镜像
  • docker 启动
  • docker-composer 配置快速编排
相关产品与服务
容器服务
腾讯云容器服务(Tencent Kubernetes Engine, TKE)基于原生 kubernetes 提供以容器为核心的、高度可扩展的高性能容器管理服务,覆盖 Serverless、边缘计算、分布式云等多种业务部署场景,业内首创单个集群兼容多种计算节点的容器资源管理模式。同时产品作为云原生 Finops 领先布道者,主导开源项目Crane,全面助力客户实现资源优化、成本控制。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档