在Jupyter docker中,无法连接到内核

问题描述 投票:1回答:1

[例如,安装Jupyter泊坞窗时,此:

docker run -d \
    --hostname jupyterhub-ds \
    --log-opt max-size=50m \
    -p 8000:8000 \
    -p 5006:5006 \
    -e DOCKER_USER=$(id -un) \
    -e DOCKER_USER_ID=$(id -u) \
    -e DOCKER_PASSWORD=$(id -un) \
    -e DOCKER_GROUP_ID=$(id -g) \
    -e DOCKER_ADMIN_USER=$(id -un) \
    -v "$(pwd)":/workdir \
    -v "$(dirname $HOME)":/home_host \
    dclong/jupyterhub-ds /scripts/sys/init.sh

JupyterLab启动良好,我进入了实验室。通过URL +端口。但是,这不可能连接到内部python内核(连接已挂起)。

我面临什么样的安全性?这与套接字通信的安全性有关吗?

调查后,我收到了这些消息:

[D 16:01:39.488 NotebookApp] Starting kernel: ['/usr/local/bin/python', '-m', 'ipykernel_launcher', '-f', '/root/.local/share/jupyter/runtime/kernel-f0420fbf-12e918f-20df7d3e804a.json']
[D 16:01:39.491 NotebookApp] Connecting to: tcp://127.0.0.1:51775
[D 16:01:39.491 NotebookApp] Connecting to: tcp://127.0.0.1:38609
[I 16:01:39.492 NotebookApp] Kernel started: f0420fbf-12ef-403e-918f-20df7d3e804a
[D 16:01:39.492 NotebookApp] Kernel args: {'kernel_name': 'python3', 'cwd': '/'}
[D 16:01:39.493 NotebookApp] Clearing buffer for 5e93046f-aa3e-4edd-a018-66b9d4c752e5
[I 16:01:39.493 NotebookApp] Kernel shutdown: 5e93046f-aa3e-4edd-a018-66b9d4c752e5

似乎与此相关:https://jupyter-notebook.readthedocs.io/en/stable/public_server.html

        Firewall Setup
        To function correctly, the firewall on the computer running the jupyter notebook server must be configured to allow connections from client machines
     on the access port c.NotebookApp.port set in jupyter_notebook_config.py to allow connections to the web interface. 

    The firewall must also allow connections from 127.0.0.1 (localhost) on ports from 49152 to 65535. These ports are used by the server to communicate with the notebook kernels. 

The kernel communication ports are chosen randomly by ZeroMQ, 

并且每个内核可能需要多个连接,因此必须可以访问大量端口。

docker jupyter firewall jupyter-lab websecurity
1个回答
-1
投票

我不确定您如何构建docker命令,或者为什么选择特定的Docker镜像dclong / jupyterhub?

如果它被设计为运行jupyterhub(多用户),那么,如果您想在docker中运行自己的Jupyter服务器,那听起来就不是您想要的。

我建议使用类似jupyter/scipy-notebook的名称,该名称仅用于运行一台Jupyter服务器。

否则,请描述您实际想要运行的内容,或为什么您认为需要使用该图像等。

© www.soinside.com 2019 - 2024. All rights reserved.