无法将笔记本保存为 docker 图片
Cannot save notebook in docker image
我正在 运行 在我没有 sudo 权限的机器上从 https://github.com/jupyter/docker-stacks 创建一个 docker 图像。
出于某种原因,如果我 运行 图像是这样的:
$ docker run -it --rm -p 8888:8888 -v /home/user_name/:/home/jovyan/work/ -e jupyter/datascience-notebook start.sh jupyter lab
当我试图在 jupyter 实验室中保存笔记本(或任何东西)时,我得到的是 403 Forbidden
。我不知道这是怎么回事,但我的下一个方法是 运行 我的用户明确设置的图像:
$ docker run --user=user_name -it --rm -p 8888:8888 -v /home/user_name/:/home/jovyan/work/ -e jupyter/datascience-notebook start.sh jupyter lab
但这会给我:
Unable to find image 'start.sh:latest' locally
docker: Error response from daemon: repository start.sh not found: does not exist or no pull access.
See 'docker run --help'
我不确定这里会出现什么问题。
这是我得到的日志输出:
$ docker run -it --rm -p 8888:8888 -v /home/sfalk/:/home/jovyan/work/ jupyter/datascience-notebook start.sh jupyter lab
Executing the command: jupyter lab
[I 16:32:30.518 LabApp] Writing notebook server cookie secret to /home/jovyan/.local/share/jupyter/runtime/notebook_cookie_secret
[W 16:32:30.991 LabApp] WARNING: The notebook server is listening on all IP addresses and not using encryption. This is not recommended.
[I 16:32:31.003 LabApp] JupyterLab beta preview extension loaded from /opt/conda/lib/python3.6/site-packages/jupyterlab
[I 16:32:31.003 LabApp] JupyterLab application directory is /opt/conda/share/jupyter/lab
[I 16:32:31.015 LabApp] Serving notebooks from local directory: /home/jovyan
[I 16:32:31.015 LabApp] 0 active kernels
[I 16:32:31.015 LabApp] The Jupyter Notebook is running at:
[I 16:32:31.015 LabApp] http://[all ip addresses on your system]:8888/?token=d8fcfc531371f23a265cdc0ffa8db41a784473137827f0da
[I 16:32:31.015 LabApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 16:32:31.016 LabApp]
Copy/paste this URL into your browser when you connect for the first time,
to login with a token:
http://localhost:8888/?token=d8fcfc531371f23a265cdc0ffa8db41a784473137827f0da
[W 16:32:31.801 LabApp] Forbidden
[W 16:32:31.802 LabApp] 403 GET /api/sessions?1518798751791 (192.168.108.41) 3.76ms referer=http://192.168.111.242:8888/lab
[W 16:32:31.805 LabApp] Forbidden
[W 16:32:31.806 LabApp] 403 GET /api/terminals?1518798751792 (192.168.108.41) 2.13ms referer=http://192.168.111.242:8888/lab
[I 16:32:39.936 LabApp] 302 GET /?token=d8fcfc531371f23a265cdc0ffa8db41a784473137827f0da (192.168.108.41) 1.19ms
[I 16:32:40.457 LabApp] Build is up to date
[I 16:32:40.687 LabApp] Writing notebook-signing key to /home/jovyan/.local/share/jupyter/notebook_secret
[W 16:32:40.692 LabApp] Notebook work/workspaces/manz-search/python/notebook/001-bundesrechtsindex.ipynb is not trusted
[W 16:32:41.332 LabApp] 403 GET /api/contents/work/workspaces/manz-search/python/notebook/001-bundesrechtsindex.ipynb/checkpoints?1518798761326 (192.168.108.41): Permission denied: work/workspaces/manz-search/python/notebook/.ipynb_checkpoints
[W 16:32:41.332 LabApp] Permission denied: work/workspaces/manz-search/python/notebook/.ipynb_checkpoints
[W 16:32:41.333 LabApp] 403 GET /api/contents/work/workspaces/manz-search/python/notebook/001-bundesrechtsindex.ipynb/checkpoints?1518798761326 (192.168.108.41) 2.84ms referer=http://192.168.111.242:8888/lab
[I 16:32:41.386 LabApp] Kernel started: cc8c97eb-beeb-40b0-b4a6-bb9e59645496
[W 16:32:41.627 LabApp] 403 GET /api/contents/work/workspaces/manz-search/python/notebook/001-bundesrechtsindex.ipynb/checkpoints?1518798761624 (192.168.108.41): Permission denied: work/workspaces/manz-search/python/notebook/.ipynb_checkpoints
[W 16:32:41.628 LabApp] Permission denied: work/workspaces/manz-search/python/notebook/.ipynb_checkpoints
[W 16:32:41.628 LabApp] 403 GET /api/contents/work/workspaces/manz-search/python/notebook/001-bundesrechtsindex.ipynb/checkpoints?1518798761624 (192.168.108.41) 1.58ms referer=http://192.168.111.242:8888/lab
[I 16:32:42.244 LabApp] Adapting to protocol v5.1 for kernel cc8c97eb-beeb-40b0-b4a6-bb9e59645496
[I 16:32:42.260 LabApp] Adapting to protocol v5.1 for kernel cc8c97eb-beeb-40b0-b4a6-bb9e59645496
[I 16:32:44.944 LabApp] Saving file at /work/workspaces/manz-search/python/notebook/001-bundesrechtsindex.ipynb
[W 16:32:44.946 LabApp] Notebook work/workspaces/manz-search/python/notebook/001-bundesrechtsindex.ipynb is not trusted
[W 16:32:44.947 LabApp] 403 PUT /api/contents/work/workspaces/manz-search/python/notebook/001-bundesrechtsindex.ipynb?1518798764934 (192.168.108.41): Permission denied: work/workspaces/manz-search/python/notebook/001-bundesrechtsindex.ipynb
[W 16:32:44.948 LabApp] Permission denied: work/workspaces/manz-search/python/notebook/001-bundesrechtsindex.ipynb
[W 16:32:44.948 LabApp] 403 PUT /api/contents/work/workspaces/manz-search/python/notebook/001-bundesrechtsindex.ipynb?1518798764934 (192.168.108.41) 9.11ms referer=http://192.168.111.242:8888/lab
[W 16:32:44.957 LabApp] 403 POST /api/contents/work/workspaces/manz-search/python/notebook/001-bundesrechtsindex.ipynb/checkpoints?1518798764953 (192.168.108.41): Permission denied: work/workspaces/manz-search/python/notebook/.ipynb_checkpoints
[W 16:32:44.958 LabApp] Permission denied: work/workspaces/manz-search/python/notebook/.ipynb_checkpoints
[W 16:32:44.959 LabApp] 403 POST /api/contents/work/workspaces/manz-search/python/notebook/001-bundesrechtsindex.ipynb/checkpoints?1518798764953 (192.168.108.41) 2.94ms referer=http://192.168.111.242:8888/lab
docker run -it --rm -p 8888:8888 -v $HOME/test:/home/jovyan/work/ -e NB_UID=$(id -u) -e NB_GID=$(id -g) -e GRANT_SUDO=yes jupyter/datascience-notebook
我要注意,如果你在OSX,你就不需要这个,我的原始回复就足够了。
两者
docker run -it --rm -p 8888:8888 -v $HOME:/home/jovyan/work/jupyter/datascience-notebook jupyter lab
和
docker run -it --rm -p 8888:8888 -v $HOME:/home/jovyan/work/ jupyter/datascience-notebook
像魅力一样工作,没有 sudo,没有大惊小怪
我正在 运行 在我没有 sudo 权限的机器上从 https://github.com/jupyter/docker-stacks 创建一个 docker 图像。
出于某种原因,如果我 运行 图像是这样的:
$ docker run -it --rm -p 8888:8888 -v /home/user_name/:/home/jovyan/work/ -e jupyter/datascience-notebook start.sh jupyter lab
当我试图在 jupyter 实验室中保存笔记本(或任何东西)时,我得到的是 403 Forbidden
。我不知道这是怎么回事,但我的下一个方法是 运行 我的用户明确设置的图像:
$ docker run --user=user_name -it --rm -p 8888:8888 -v /home/user_name/:/home/jovyan/work/ -e jupyter/datascience-notebook start.sh jupyter lab
但这会给我:
Unable to find image 'start.sh:latest' locally
docker: Error response from daemon: repository start.sh not found: does not exist or no pull access.
See 'docker run --help'
我不确定这里会出现什么问题。
这是我得到的日志输出:
$ docker run -it --rm -p 8888:8888 -v /home/sfalk/:/home/jovyan/work/ jupyter/datascience-notebook start.sh jupyter lab
Executing the command: jupyter lab
[I 16:32:30.518 LabApp] Writing notebook server cookie secret to /home/jovyan/.local/share/jupyter/runtime/notebook_cookie_secret
[W 16:32:30.991 LabApp] WARNING: The notebook server is listening on all IP addresses and not using encryption. This is not recommended.
[I 16:32:31.003 LabApp] JupyterLab beta preview extension loaded from /opt/conda/lib/python3.6/site-packages/jupyterlab
[I 16:32:31.003 LabApp] JupyterLab application directory is /opt/conda/share/jupyter/lab
[I 16:32:31.015 LabApp] Serving notebooks from local directory: /home/jovyan
[I 16:32:31.015 LabApp] 0 active kernels
[I 16:32:31.015 LabApp] The Jupyter Notebook is running at:
[I 16:32:31.015 LabApp] http://[all ip addresses on your system]:8888/?token=d8fcfc531371f23a265cdc0ffa8db41a784473137827f0da
[I 16:32:31.015 LabApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 16:32:31.016 LabApp]
Copy/paste this URL into your browser when you connect for the first time,
to login with a token:
http://localhost:8888/?token=d8fcfc531371f23a265cdc0ffa8db41a784473137827f0da
[W 16:32:31.801 LabApp] Forbidden
[W 16:32:31.802 LabApp] 403 GET /api/sessions?1518798751791 (192.168.108.41) 3.76ms referer=http://192.168.111.242:8888/lab
[W 16:32:31.805 LabApp] Forbidden
[W 16:32:31.806 LabApp] 403 GET /api/terminals?1518798751792 (192.168.108.41) 2.13ms referer=http://192.168.111.242:8888/lab
[I 16:32:39.936 LabApp] 302 GET /?token=d8fcfc531371f23a265cdc0ffa8db41a784473137827f0da (192.168.108.41) 1.19ms
[I 16:32:40.457 LabApp] Build is up to date
[I 16:32:40.687 LabApp] Writing notebook-signing key to /home/jovyan/.local/share/jupyter/notebook_secret
[W 16:32:40.692 LabApp] Notebook work/workspaces/manz-search/python/notebook/001-bundesrechtsindex.ipynb is not trusted
[W 16:32:41.332 LabApp] 403 GET /api/contents/work/workspaces/manz-search/python/notebook/001-bundesrechtsindex.ipynb/checkpoints?1518798761326 (192.168.108.41): Permission denied: work/workspaces/manz-search/python/notebook/.ipynb_checkpoints
[W 16:32:41.332 LabApp] Permission denied: work/workspaces/manz-search/python/notebook/.ipynb_checkpoints
[W 16:32:41.333 LabApp] 403 GET /api/contents/work/workspaces/manz-search/python/notebook/001-bundesrechtsindex.ipynb/checkpoints?1518798761326 (192.168.108.41) 2.84ms referer=http://192.168.111.242:8888/lab
[I 16:32:41.386 LabApp] Kernel started: cc8c97eb-beeb-40b0-b4a6-bb9e59645496
[W 16:32:41.627 LabApp] 403 GET /api/contents/work/workspaces/manz-search/python/notebook/001-bundesrechtsindex.ipynb/checkpoints?1518798761624 (192.168.108.41): Permission denied: work/workspaces/manz-search/python/notebook/.ipynb_checkpoints
[W 16:32:41.628 LabApp] Permission denied: work/workspaces/manz-search/python/notebook/.ipynb_checkpoints
[W 16:32:41.628 LabApp] 403 GET /api/contents/work/workspaces/manz-search/python/notebook/001-bundesrechtsindex.ipynb/checkpoints?1518798761624 (192.168.108.41) 1.58ms referer=http://192.168.111.242:8888/lab
[I 16:32:42.244 LabApp] Adapting to protocol v5.1 for kernel cc8c97eb-beeb-40b0-b4a6-bb9e59645496
[I 16:32:42.260 LabApp] Adapting to protocol v5.1 for kernel cc8c97eb-beeb-40b0-b4a6-bb9e59645496
[I 16:32:44.944 LabApp] Saving file at /work/workspaces/manz-search/python/notebook/001-bundesrechtsindex.ipynb
[W 16:32:44.946 LabApp] Notebook work/workspaces/manz-search/python/notebook/001-bundesrechtsindex.ipynb is not trusted
[W 16:32:44.947 LabApp] 403 PUT /api/contents/work/workspaces/manz-search/python/notebook/001-bundesrechtsindex.ipynb?1518798764934 (192.168.108.41): Permission denied: work/workspaces/manz-search/python/notebook/001-bundesrechtsindex.ipynb
[W 16:32:44.948 LabApp] Permission denied: work/workspaces/manz-search/python/notebook/001-bundesrechtsindex.ipynb
[W 16:32:44.948 LabApp] 403 PUT /api/contents/work/workspaces/manz-search/python/notebook/001-bundesrechtsindex.ipynb?1518798764934 (192.168.108.41) 9.11ms referer=http://192.168.111.242:8888/lab
[W 16:32:44.957 LabApp] 403 POST /api/contents/work/workspaces/manz-search/python/notebook/001-bundesrechtsindex.ipynb/checkpoints?1518798764953 (192.168.108.41): Permission denied: work/workspaces/manz-search/python/notebook/.ipynb_checkpoints
[W 16:32:44.958 LabApp] Permission denied: work/workspaces/manz-search/python/notebook/.ipynb_checkpoints
[W 16:32:44.959 LabApp] 403 POST /api/contents/work/workspaces/manz-search/python/notebook/001-bundesrechtsindex.ipynb/checkpoints?1518798764953 (192.168.108.41) 2.94ms referer=http://192.168.111.242:8888/lab
docker run -it --rm -p 8888:8888 -v $HOME/test:/home/jovyan/work/ -e NB_UID=$(id -u) -e NB_GID=$(id -g) -e GRANT_SUDO=yes jupyter/datascience-notebook
我要注意,如果你在OSX,你就不需要这个,我的原始回复就足够了。
两者
docker run -it --rm -p 8888:8888 -v $HOME:/home/jovyan/work/jupyter/datascience-notebook jupyter lab
和
docker run -it --rm -p 8888:8888 -v $HOME:/home/jovyan/work/ jupyter/datascience-notebook
像魅力一样工作,没有 sudo,没有大惊小怪