Docker启动带有sudo权限的jupyter服务

Published on Aug. 22, 2023, 12:10 p.m.

Docker 不提供在运行的容器中修改环境变量的方法,所以启动时候最好加上sudo权限.

创建密码

import IPython 
IPython.lib.passwd() 

sudo docker run --name user -d --restart unless-stopped -p 8888:8888 -it -e GRANT_SUDO=yes --user root -e JUPYTER_ENABLE_LAB=yes  -v "${PWD}":/home/jovyan/work jupyter/scipy-notebook:33add21fab64 start-notebook.sh --NotebookApp.password='sha1:4f88c5b4e717:738386f19cbdc3e68sb047wbd37a87172ffa620e'  

参考文档位于:

https://jupyter-docker-stacks.readthedocs.io/en/latest/using/recipes.html#using-sudo-within-a-container

Tags: