In Jupyter docker , cannot connect to kernel

Viewed 984

When installing Jupyter docker, for example this one :

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 starts well and I enter the lab. through URL+port. However, this is not possible to connect to the inernal python kernel (connection is hanging up).

What kind of security I am facing ? Is this related to socket communication security ?

After Investigation, I have those messages :

[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

It seems linked to this one : 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, 

and may require multiple connections per kernel, so a large range of ports must be accessible.

1 Answers

I'm not sure how you built the docker command, or why you chose that particular Docker image dclong/jupyterhub?

If it is designed to run jupyterhub (multiuser) then it doesn't sound like what you need if you're trying to run your own Jupyter server in docker, just for you.

I would suggest using something like jupyter/scipy-notebook instead that is designed just to run one Jupyter server.

Otherwise, please describe what you actually want to get running, or why you believe you need to use that image etc.

Related