0

Situation:
So I have installed Jupyter-Lab inside a Docker container in a VM on my network. I've then done a commit (I know this isnt the correct way to do things, I should use a Docker file). I then go into the container bash and run jupyter-lab this then output to STDOut the urls to conenct to the WebGUI:

  http://localhost:8888/
  or http://127.0.0.1:8888/

Below is a diagram of my setup:

┌─────────────────────────────┐
│                             │
│ VM Container                │
│          IP: 192.168.10.223 │                                    ┌────────────────────┐
│   Docker IP: 172.17.0.1     │                                    │                    │
│                             │  My Local 192.168.10.0/24 Network  │ My Machine         │
│  ┌─────────────────────┐    │xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx│                    │
│  │ Docker              │    │                                    │  IP: 192.168.10.50 │
│  │       Jupyter-Lab   │    │                                    │                    │
│  │                     │    │                                    └────────────────────┘
│  └─────────────────────┘    │
│                             │
└─────────────────────────────┘

Problem:
I can't seem to connect to the Jupyter WebGui. I have tried the following commmands:

 sudo docker run -it --rm -p 8888:8888 -v $(realpath ~/notebooks):/tf/notebooks 
 sudo docker run -it --rm -p 8888:8888 --expose 8888 -v $(realpath ~/notebooks):/tf/notebooks 
 sudo docker run -it --rm -p 127.0.0.1:8888:8888 -v $(realpath ~/notebooks):/tf/notebooks 
 sudo docker run -it --rm -p 8888:8888 --ip 0.0.0.0 -v $(realpath ~/notebooks):/tf/notebooks 

And I cant seem to connect from my 192.168.10.50 machine to the Jupyter instance. I have run netstat -tulnp which clearly shows that port 8888 is exposed:

docker_machine@instance:~$ netstat -tulpn
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 127.0.0.1:45511         0.0.0.0:*               LISTEN      -
tcp        0      0 127.0.0.53:53           0.0.0.0:*               LISTEN      -
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      -
tcp        0      0 0.0.0.0:8888            0.0.0.0:*               LISTEN      -
tcp6       0      0 :::22                   :::*                    LISTEN      -
udp        0      0 127.0.0.53:53           0.0.0.0:*                           -

This shows that it is listening for any address to conenct so I don't understand.

Question
Why I cant get the Jupyter web interface when I point my browser to 192.168.10.223:8888?

Definity
  • 115
  • 3

1 Answers1

1

The output of your jupyter-lab suggests that jupyter is only listening on the loopback interface inside the container. To enable access from outside the container you need to bind it to the external interface of the container (or all interfaces).

jupyter-lab --ip="0.0.0.0"
Gerald Schneider
  • 19,757
  • 8
  • 52
  • 79