When you start a Deep Learning VM Images instance, a JupyterLab session is initialized.
To set up SSH port forwarding , complete the following steps, and then access your JupyterLab session through a local browser:
-
Run the following command by using the Google Cloud CLI in your preferred terminal or in Cloud Shell :
gcloud compute ssh \ --project PROJECT_ID \ --zone ZONE \ INSTANCE_NAME \ -- -L 8080 :localhost:8080
Replace the following:
-
PROJECT_ID: your Google Cloud project ID -
ZONE: the zone where your instance is located -
INSTANCE_NAME: the name of your instance
-
-
Access your JupyterLab session through a local browser:
-
If you ran the command on your local machine, visit
https://localhost:8080to access JupyterLab. -
If you ran the command using Cloud Shell , access JupyterLab through the Web Preview on port 8080.
-
Troubleshooting
Symptom: When using SSH port forwarding to connect to JupyterLab , you are unable to connect to the instance.
Problem: You are trying to connect to the wrong TCP socket.
Solution:
-
On some Linux clients, the localhost resolves to the IPv6 loopback address (
::1). Check this by usingping -c 1 localhost. If this command returns the IPv6 address, use-L 8080:127.0.0.1:8080(rather than-L 8080:localhost:8080) in thegcloud compute sshcommand. -
Ensure that you connect to
http://localhost:8080(instead ofhttps://localhost:8080) on your local client.

