Problème : vous essayez de vous connecter au mauvais socket TCP.
Solution :
Sur certains clients Linux, l'hôte local est résolu en adresse de bouclage IPv6 (::1). Vérifiez cela à l'aide de ping -c 1 localhost. Si cette commande renvoie l'adresse IPv6, utilisez -L 8080:127.0.0.1:8080 (plutôt que -L 8080:localhost:8080) dans la commande gcloud compute ssh.
Assurez-vous de vous connecter à http://localhost:8080 (et non à https://localhost:8080) sur votre client local.
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2025/09/04 (UTC).
[[["Facile à comprendre","easyToUnderstand","thumb-up"],["J'ai pu résoudre mon problème","solvedMyProblem","thumb-up"],["Autre","otherUp","thumb-up"]],[["Difficile à comprendre","hardToUnderstand","thumb-down"],["Informations ou exemple de code incorrects","incorrectInformationOrSampleCode","thumb-down"],["Il n'y a pas l'information/les exemples dont j'ai besoin","missingTheInformationSamplesINeed","thumb-down"],["Problème de traduction","translationIssue","thumb-down"],["Autre","otherDown","thumb-down"]],["Dernière mise à jour le 2025/09/04 (UTC)."],[[["\u003cp\u003eA JupyterLab session is initialized when you start a Deep Learning VM Images instance.\u003c/p\u003e\n"],["\u003cp\u003eYou can set up SSH port forwarding to access your JupyterLab session through a local browser using the \u003ccode\u003egcloud compute ssh\u003c/code\u003e command.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003egcloud compute ssh\u003c/code\u003e command requires you to specify your project ID, zone, and instance name.\u003c/p\u003e\n"],["\u003cp\u003eIf using Cloud Shell, you might need to add a \u003ccode\u003e-4\u003c/code\u003e flag to the SSH command to connect via IPv4.\u003c/p\u003e\n"],["\u003cp\u003eIf you encounter connection issues, ensure you are using the correct localhost IP address (127.0.0.1 instead of ::1) and protocol (http instead of https).\u003c/p\u003e\n"]]],[],null,["# Connect to JupyterLab\n\nWhen you start a Deep Learning VM Images instance, a JupyterLab session is\ninitialized.\n\nTo set up\n[SSH port forwarding](/solutions/connecting-securely#port-forwarding-over-ssh),\ncomplete the following steps, and then access your JupyterLab session through a\nlocal browser:\n\n1. Run the following command by using the [Google Cloud CLI](/sdk/gcloud) in\n your preferred terminal or in\n [Cloud Shell](https://console.cloud.google.com?cloudshell=true):\n\n ```bash\n gcloud compute ssh \\\n --project PROJECT_ID \\\n --zone ZONE \\\n INSTANCE_NAME \\\n -- -L 8080:localhost:8080\n ```\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: your [Google Cloud project ID](/resource-manager/docs/creating-managing-projects#identifying_projects)\n - \u003cvar translate=\"no\"\u003eZONE\u003c/var\u003e: the [zone](/compute/docs/regions-zones) where your instance is located\n - \u003cvar translate=\"no\"\u003eINSTANCE_NAME\u003c/var\u003e: the name of your instance\n\n| **Note:** If using Cloud Shell to run the command, add a `-4` to the SSH flags to use IPv4 to connect. Example: `-- -4 -L `\u003cvar translate=\"no\"\u003eLOCAL_PORT\u003c/var\u003e`:localhost:`\u003cvar translate=\"no\"\u003eREMOTE_PORT\u003c/var\u003e\n\n1. Access your JupyterLab session through a local browser:\n\n - If you ran the command on your local machine, visit\n `https://localhost:8080` to access JupyterLab.\n\n - If you ran the command using\n [Cloud Shell](https://console.cloud.google.com?cloudshell=true),\n access JupyterLab through the\n Web\n Preview on port 8080.\n\nTroubleshooting\n---------------\n\n**Symptom** : When [using SSH port forwarding\nto connect to JupyterLab](/deep-learning-vm/docs/jupyter),\nyou are unable to connect to the instance.\n\n**Problem**: You are trying to connect to the wrong TCP socket.\n\n**Solution**:\n\n- On some Linux clients, the localhost resolves to\n the IPv6 loopback address (`::1`).\n Check this by using `ping -c 1 localhost`. If this command returns\n the IPv6 address, use `-L 8080:127.0.0.1:8080`\n (rather than `-L 8080:localhost:8080`) in the\n `gcloud compute ssh` command.\n\n- Ensure that you connect to `http://localhost:8080`\n (instead of `https://localhost:8080`) on your local client."]]