Skip to content

Accessing JupyterLab

JupyterLab runs on your instance and listens on port 8888 by default. Keep it private. Use SSH port-forwarding.

Start an instance

In the Main OS volume section, choose JupyterLab. Leave the default configuration, or increase the size if you need more space for datasets or models.

Secure the instance

Do this before you run any public-facing services:

Warning

Do not open port 8888 to the internet. Use SSH tunneling.

1) Create an SSH tunnel

Run this in a terminal on your laptop/desktop:

ssh -L 8888:localhost:8888 <user>@IP_OF_YOUR_INSTANCE

Replace IP_OF_YOUR_INSTANCE with your instance's public IP address and <user> with your SSH username. See Connecting to Your Server if you need help with your SSH key or connection details.

If you use root, the command looks like:

ssh -L 8888:localhost:8888 root@IP_OF_YOUR_INSTANCE

This opens an SSH session on your instance and forwards the port to your laptop/desktop. Keep this session open while you use JupyterLab.

If JupyterLab uses a different port, forward that port instead.

2) Get the token on the instance

Run the following commands in the SSH session from step 1, on your instance.

JupyterLab in Docker

List the running containers:

docker ps

Find the JupyterLab container using the IMAGE or NAMES column. Copy its CONTAINER ID, then use it in place of <container-id> below to print the running server list:

docker exec <container-id> jupyter server list

You’re looking for a line like:

  • http://localhost:8888/?token=...

Copy the value after token= from the URL.

JupyterLab installed directly on the host

If you installed JupyterLab directly on the instance instead of using Docker, run this on the instance as the user who started JupyterLab:

jupyter server list

Copy the value after token= from the URL in the output.

3) Open JupyterLab locally

Open this URL in a browser on your laptop/desktop:

Paste the token into the token or password field, then log in. Keep the SSH session from step 1 open while you use JupyterLab.

(Optional) Connect from VS Code

VS Code connects to the same forwarded URL. Use the Jupyter extension. Then point the kernel URL at:

  • http://127.0.0.1:8888

Continue here for the VS Code flow: