I have problems establishing a connection from my local machine to the jupyter notebook instance i have running on my remote server in a docker container.
What i did so far:
I connect to the remote server with ssh username@remoteHostIp
I run docker container ls
to make sure my container is not already running
Now I start my container with docker run -it -p 8888:8888 -p 6006:6006 -v ~/:/host waleedka/modern-deep-learning
Im now using the terminal in my container and start a browser-less jupyter notebook instance
jupyter notebook --no-browser --port=8889 --allow-root
It starts successfully:
The Jupyter Notebook is running at:
[I 11:14:51.979 NotebookApp] system]:8889/
Now i start another shell on my local computer and create a ssh tunnel:
ssh -N -f -L localhost:8888:localhost:8889 username@ remote_host_name
My shell returns the following after some seconds:
channel 2: open failed: connect failed: Connection refused
channel 2: open failed: connect failed: Connection refused
channel 2: open failed: connect failed: Connection refused
Iam unable to access the jupyter notebook with localhost:8888/ or localhost:8889/
When i run jupyter notebook on the remote server outside of the docker container and create the ssh tunnel everything works fine.
Some additional information: remote server: Distributor ID: Ubuntu Description: Ubuntu 16.04.3 LTS Release: 16.04 Codename: xenial
My local machine is running on osx moave
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
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.