Connect to jupyter notebook running in docker on a remote server Connect to jupyter notebook running in docker on a remote server docker docker

Connect to jupyter notebook running in docker on a remote server


First you should connect to the remote server with

ssh username@remoteHostIp

After connecting to it you should run docker container using

docker run -it -p 8080:8888 -p 6006:6006 -v ~/:/host waleedka/modern-deep-learning

i am considering here port 8888 is of jupyter notebook port and 8080 is of remote server port

Now Open a new terminal window on your local machine, SSH into the remote machine again using the following options to setup port forwarding.

ssh -N -L localhost:8000:localhost:8080 username@remoteHostIp

i am considering here port 8000 is of my local machine port and 8080 as i said above is of remote server port already

Now Access the remote jupyter server via your local browser. Open your browser and go to:

localhost:8000


I solved the question myself by connecting to the remove server and checking for the docker container ip adress: docker inspect <container_name>. I used that ip adress then to create the ssh tunnel:

ssh -N -f -L localhost:8889:dockerContainerIpAdress:8889 username@ remote_host_name

now i am able to connect to the jupyter notebook in my local browser with localhost:8889