Docker Community Forums

Share and learn in the Docker community.

Cannot access jupyter notebook running in docker container on remote server

From my local (OS X 10.10.5) machine I SSH onto my remote (Ubuntu 16.04) machine like so:
ssh -X local_machine@remote_address -p remote_port -v

Then, I spin up my docker container like so:
nvidia-docker run -it -p 8889:8889 user/docker_container

Once I’m in my container, I open up a Jupyter notebook like so:
jupyter notebook --no-browser --port=8889

Then, I open a new tab in terminal and attempt to pull up the Jupyter notebook on my local machine:
ssh -N -L localhost:8889:localhost:8889 user@remote_address -p remote_port

When I check localport:8889 on my local machine, I get the following error in my terminal tab:
channel 2: open failed: connect failed: Connection refused

Alternatively, I can pull up a juypter notebook successfully if I run the notebook directly on my remote machine (i.e., not in the Docker container), and I connect to it using:
ssh -N -L localhost:9001:localhost:9001 user@remote_address -p remote_port

I’ve debugged issues with occupied ports by shutting down ports and trying different chains of port combinations, but the same problem described above persists. I’ve also tried passing the -R flag instead of the -L flag when I try to ssh to the notebook, but that hasn’t worked either.

Any thoughts? (Apologies if this is not an appropriate place for this question)