title: Connect to jupyter notebook running in docker on a remote server
body: <p>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.</p>
  
  <p>What i did so far:</p>
  
  <p>I connect to the remote server with <code>ssh username@remoteHostIp</code></p>
  
  <p>I run <code>docker container ls</code> to make sure my container is not already running</p>
  
  <p>Now I start my container with <code>docker run -it -p 8888:8888 -p 6006:6006 -v ~/:/host waleedka/modern-deep-learning</code></p>
  
  <p>Im now using the terminal in my container and start a browser-less jupyter notebook instance </p>
  
  <pre><code>jupyter notebook --no-browser --port=8889 --allow-root
  </code></pre>
  
  <p>It starts successfully:</p>
  
  <pre><code>The Jupyter Notebook is running at:
  [I 11:14:51.979 NotebookApp] system]:8889/
  </code></pre>
  
  <p>Now i start another shell on my local computer and create a ssh tunnel:</p>
  
  <pre><code>ssh -N -f -L localhost:8888:localhost:8889 username@ remote_host_name
  </code></pre>
  
  <p>My shell returns the following after some seconds:</p>
  
  <pre><code>channel 2: open failed: connect failed: Connection refused
  channel 2: open failed: connect failed: Connection refused
  channel 2: open failed: connect failed: Connection refused
  </code></pre>
  
  <p>Iam unable to access the jupyter notebook with localhost:8888/ or localhost:8889/</p>
  
  <p>When i run jupyter notebook on the remote server outside of the docker container and create the ssh tunnel everything works fine.</p>
  
  <p>Some additional information: 
  remote server:
  Distributor ID: Ubuntu
  Description:    Ubuntu 16.04.3 LTS
  Release:    16.04
  Codename:   xenial</p>
  
  <p>My local machine is running on osx moave</p>