pip install jupyter
jupyter notebook --generate-config
#生成密码,用于远程登陆
python -c "from notebook.auth import passwd; print(\"c.NotebookApp.password = u'\" + passwd('123456') + \"'\")" >> /root/.jupyter/jupyter_notebook_config.py
#自定义端口
echo c.NotebookApp.port = 2678 >> /root/.jupyter/jupyter_notebook_config.py
jupyter notebook --ip=0.0.0.0 --no-browser --allow-root
Dockerfile()
... 配置好python环境
RUN pip install jupyter
RUN jupyter notebook --generate-config
#生成密码,用于远程登陆
RUN python -c "from notebook.auth import passwd; print(\"c.NotebookApp.password = u'\" + passwd('123456') + \"'\")" >> /root/.jupyter/jupyter_notebook_config.py
#自定义端口
RUN echo c.NotebookApp.port = 2678 >> /root/.jupyter/jupyter_notebook_config.py
CMD ["jupyter notebook" , "--ip=0.0.0.0" , "--no-browser" , "--allow-root"]

本文介绍如何在Docker中配置Jupyter Notebook,包括安装Jupyter、生成配置文件、设置远程登录密码、自定义端口号及启动参数,实现安全的远程访问。
2393

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



