我有以下Dockerfile:
FROM jupyter/datascience-notebook
RUN conda create -c rdkit -n my-rdkit-env rdkit
RUN echo "source activate my-rdkit-env" > ~/.bashrc
ENV PATH /opt/conda/envs/env/bin:$PATH
我使用以下命令构建的:
sudo docker build -t demo .
当我使用以下命令交互式运行此程序时:
sudo docker run -it demo bash
我可以看到我的环境已激活。但是,当我打开带有以下内容的jupyter笔记本时:
sudo docker run -it -v {my_path}:/home/jovyan/notebooks --rm -p 8888:8888 demo
然后,我得到一个jupyter仪表板,可以在启动的终端中看到激活的环境,但是我无法获得任何笔记本来启动激活的环境。咨询吗?
上面最后一个命令的输出结果导致我在上一段中描述的笔记本:
Executing the command: jupyter notebook
[I 08:46:06.674 NotebookApp] Writing notebook server cookie secret to /home/jovyan/.local/share/jupyter/runtime/notebook_cookie_secret
[I 08:46:08.180 NotebookApp] JupyterLab extension loaded from /opt/conda/lib/python3.6/site-packages/jupyterlab
[I 08:46:08.180 NotebookApp] JupyterLab application directory is /opt/conda/share/jupyter/lab
[I 08:46:08.182 NotebookApp] Serving notebooks from local directory: /home/jovyan
[I 08:46:08.182 NotebookApp] The Jupyter Notebook is running at:
[I 08:46:08.182 NotebookApp] http://(3a03022aa4dc or 127.0.0.1):8888/?token=081a6dc774dd7edbbb7c6940f7db4b5a285703b6e7265449
[I 08:46:08.182 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 08:46:08.182 NotebookApp]
Copy/paste this URL into your browser when you connect for the first time,
to login with a token:
http://(3a03022aa4dc or 127.0.0.1):8888/?token=081a6dc774dd7edbbb7c6940f7db4b5a285703b6e7265449