Skip to content

Instantly share code, notes, and snippets.

@vishnuexe
Last active February 21, 2024 05:35
Show Gist options
  • Save vishnuexe/72db09d3340d2390f38b0079e3687212 to your computer and use it in GitHub Desktop.
Save vishnuexe/72db09d3340d2390f38b0079e3687212 to your computer and use it in GitHub Desktop.

Accessing Jupyter-lab running inside docker in remote ssh server

Step1: ssh into your remote server

$ ssh username@server_ip_address

Step2: Run this in the remote server

#running docker with port assignment
#replace image:version with your docker image id
$ docker run --gpus all -it -p 8888:8888 image:version

Step3: Run this inside docker

#starting jupyter lab
$ jupyter lab --ip 0.0.0.0 --port 8888 --no-browser --allow-root

Step4: Run this in your local sytem

#port forwarding from remote server to local system
$ ssh -N -L 8888:localhost:8888 username@server_ip_address

Step 5:

Access the notebook through your desktop browser on http://localhost:8888 Copy paste the token which was generated when you started the server which you will find from Step 3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment