twn39 / code

:memo: 代码笔记,通过 issue 的方式记录日常遇到的问题和学习笔记
13 stars 1 forks source link

Conda Python & R notebook dockerfile 配置 #404

Open twn39 opened 2 years ago

twn39 commented 2 years ago

Dockerfile:

FROM continuumio/miniconda3
RUN conda install -c conda-forge jupyterlab jupyterlab-git plotly jupyter-dash dtale -y --quiet
RUN mkdir -p /opt/notebook
RUN conda install numpy scipy sympy matplotlib -y --quiet
RUN conda install -c r r-essentials -y --quiet
RUN conda install -c r r-irkernel -y --quiet

EXPOSE 8888
EXPOSE 40000
CMD ["jupyter", "lab", "--notebook-dir=/opt/notebook", "--ip=*", "--port=8888", "--no-browser", "--allow-root"]

-h 参数用来指定 dtale 的资源链接,dtale 会构建独立的页面,端口号为 40000,jupyter 内嵌 dtale 。

build:

docker build -t conda:notebook .

run:

docker run --name notebook -d -p 8888:8888 -p 40000:40000 -h localhost conda:notebook

通过 conda 安装额外扩展包:

!conda install -c conda-forge ta-lib -y