use*_*701 1 python docker jupyter-notebook
我有一个 Dockerfile,FROM continuumio/anaconda3它使用 python 3.7.4 创建 anaconda3。我可以运行 jupyter 命令并处理笔记本。该图像记录在此处: https: //hub.docker.com/r/continuumio/anaconda3
但我需要更改此图像才能运行 python 3.9.5。
有一个带有 Continumio/conda-ci-linux-64-python3.9 的 Continumio 页面,但不允许运行 Jupyter Notebook。
如何创建运行 python 3.9.5 并具有 jupyter 命令的 docker 映像?
谢谢
在我看来,在 conda 环境中安装你想要的 python 版本(3.9.5)然后运行 jupyter 是正确的方法!我的实现解决方案最终出现在这个凌乱的 Dockerfile 中!
FROM continuumio/anaconda3
RUN apt update
RUN conda create -n py39 python=3.9 pip
RUN echo "source activate py39" > ~/.bashrc
ENV PATH /opt/conda/envs/env/bin:$PATH
RUN mkdir -p /opt/notebooks
RUN /opt/conda/envs/py39/bin/pip install jupyter
CMD ["bash", "-c", "/opt/conda/envs/py39/bin/jupyter notebook \
--notebook-dir=/opt/notebooks --ip='*' --port=8888 \
--no-browser --allow-root"]
Run Code Online (Sandbox Code Playgroud)