GCP DL Image instance automatically starts Jupyter server but I cant find login Token

78 Views Asked by At

I just created a VM instance with deep-learning-vm image provided by GCP. I am trying remote access to notebook server. However I realized jupyter notebook server starts the moment I start the VM. I can use the external_ip:8888 to connect the VM's jupyter notebook server.

There is 1 issue with his. Normally when we start jupyter notebook server manually it provides us a login token. In this case I do not know what the token is.

Second issue is when i do jupyter notebook list to see running servers, i see nothing. I tried with sudo user as well. There is no trace of a running server. However I can connect to login page of jupyter server regardless. Also when i check the ports using lsof -i, I can see jupyter is listening even tho I did not started it manually.

i tried to to kill the ports but they start again after seconds. I dont understand how I am suppose to use the jupyter server without token information. I tried to setup a password but it did not worked.

I tried changing the user, killing the ports, manually running the server using jupyter-lab. However these did not help me

1

There are 1 best solutions below

0
gogasca On BEST ANSWER

There is some assumptions that need clarification.

  1. When you use Deep Learning Platform, Jupyter is a dedicated systemctl service. The Jupyter service is defined here: /lib/systemd/system/jupyter.service

You can access JupyterLab through a Proxy URL provided by Google. Jupyter Service binds to local IP address (127.0.0.1) and port (8080) and does not use a token.

To track Jupyter status use: systemctl status jupyter.service

Example:

/lib/systemd/system/jupyter.service
[Unit]
Description=Jupyter Notebook Service

[Service]
Type=simple
MemoryHigh=15348914432
MemoryMax=15398914432
ExecStartPost=/usr/bin/timeout 60 sh -c 'while ! ss -t -l -n sport = :8080 | grep -q "^LISTEN.*:8080"; do sleep 1; done'
ExecStart=/bin/bash --login -c '/opt/conda/bin/jupyter lab --config=/home/jupyter/.jupyter/jupyter_notebook_config.py'
User=jupyter
Group=jupyter
WorkingDirectory=/home/jupyter
Restart=always

[Install]
WantedBy=multi-user.target
  1. Is a not a good security practice to start JupyterLab manually and use an external IP address. This is why we provide a Proxy URL or recommend SSH access.

  2. You can explore User Managed Notebooks which uses the same underlying OS as the Deep Learning VM image:

https://cloud.google.com/vertex-ai/docs/workbench/user-managed/create-new

https://cloud.google.com/deep-learning-vm/docs/cli