0

I have a jupyter notebook running in docker container. I would like to port forward it to my local desktop browser. For that I do the below steps

1) Publish the container port to the remote host port 2) Port forward the remote host port to the localhost (desktop)

Though I tried doing this, I get an error message that "Page cannot be displayed". Can you please let me know if I am making any error with the docker commands

Publish ports (container to remote host)

docker run --runtime=nvidia -it --rm -v 
/home/selva/aiaa_demo:/mnt/aiaa_spleen -p 8787:8888 $DOCKER_IMAGE jupyter 
notebook /opt/nvidia/medical/annotation/examples/MSD_Task09_Spleen --ip 
0.0.0.0 --allow-root --no-browser

Port forwarding in ubuntu bash screen

ssh -L 8343:127.0.0.1:8787 onegpu

The execution of above two commands doesn't help me in opening the browser in local desktop

However, when I use --network-host , it works

docker run --runtime=nvidia --network=host -it --rm -v 
/home/selva/demo:/mnt/disease -p 8787:8888 $DOCKER_IMAGE jupyter 
notebook /opt/nvidia/med/ann/examples/MSD --ip 
0.0.0.0 --allow-root --no-browser 

Can you please tell me what is the mistake with my docker command or what can be the reason as to why it isn't opening?

I am expecting to be able to open the jupyter notebook locally in my desktop without --network=host option and your help in fixing my docker command / port related issue

The Great
  • 7,215
  • 7
  • 40
  • 128
  • Shouldn't you be using remote port forwarding like this: "ssh -R 8343:127.0.0.1:onegpu"? – Mihai May 07 '19 at 05:44
  • Sorry,updated the post. I had SSH -L 8343:127.0.0.1:8787 onegpu. Is this incorrect? Can you let me know why does it work when I use network-host and not when I use docker command without "--network-host" – The Great May 07 '19 at 05:54
  • -L is for local... It seems to me you are trying to do remote port forwarding. – Mihai May 07 '19 at 05:55
  • When I use ssh -R 8343:127.0.0.1:onegpu - I get an error message that it's a bad port forwarding specification. So I modified it to ssh -R 8343:127.0.0.1:8787 onegpu. Though this command was executed successfully without any error, when I opened the local browser, it threw an error. Please note that 8343 is the local port number – The Great May 07 '19 at 06:06
  • Can you also let me know what's the use of --network=host and when it should be used? – The Great May 07 '19 at 06:08
  • 2
    --network=host means that your container receives an IP on your local network and acts like another computer that is "physically" attached to your network. – Mihai May 07 '19 at 06:10
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/192937/discussion-between-mihai-and-selva). – Mihai May 07 '19 at 06:11
  • @Mihai - Would you be able to help me with below post? https://stackoverflow.com/questions/56289341/unable-to-start-the-server-using-docker-command-mount-directory-oci-runtime-e – The Great May 24 '19 at 09:22

0 Answers0