How can I access jupyter lab from my home folder in a GCloud Deep Learning VM instance?

809 Views Asked by At

I have created a deep learning VM instance following the steps on https://cloud.google.com/deep-learning-vm/docs/quickstart-cli

Now, I would like to access and run my ipynb notebooks in my home folder. I followed the steps on https://cloud.google.com/deep-learning-vm/docs/jupyter

But, when I tried to visit http://localhost:8080 in my local browser, I got an error saying- This site can’t be reached localhost refused to connect.

When I tried to access JupyterLab from the preview button in Cloud Shell, I could no longer access my home folder. The only folders visible were "src" and "tutorials".

Could you kindly tell me how I can view and execute the ipynb files stored in my home folder on the VM instance using a Jupyter interface?

Thank you for your time and effort.

1

There are 1 best solutions below

1
On

There are 2 problems here:

  1. problem with the connection to the instance (and subsequently problem to reach Jupyter on localhost:8080) and
  2. problem with reaching the home folder

Let's address both of them. In order to connect to the instance you need to run the following command:

export INSTANCE_NAME=...
gcloud compute ssh $INSTANCE_NAME -- -L 8080:localhost:8080

Have you tried it? What was the output?

The second one is the home folder. When you SSH-ing to the instance by default gcloud using your username. However, Jupyter is running under user jupyter. In order to SSH under user Jupyter you need to modify gcloud command to look like this:

export INSTANCE_NAME=...
gcloud compute ssh jupyter@$INSTANCE_NAME -- -L 8080:localhost:8080

You can read more about different way to connect to the DL instance here.