Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can't view jupyter notebook in docker #297

Closed
hputnam opened this issue Oct 15, 2016 · 22 comments

Comments

Projects
None yet
3 participants
@hputnam
Copy link

commented Oct 15, 2016

I have followed the instructions for jupyter notebook use in a docker container and also downloaded firefox for compatibility. When I call jupyter notebook I get the following:

root@7785b6fe19f1:/Users/hollie/Documents/HP_BioInf/Oly_MBD/Notebooks# jupyter notebook

[I 20:07:48.555 NotebookApp] Writing notebook server cookie secret to /root/.local/share/jupyter/runtime/notebook_cookie_secret

[I 20:07:48.631 NotebookApp] Serving notebooks from local directory: /Users/hollie/Documents/HP_BioInf/Oly_MBD/Notebooks

[I 20:07:48.632 NotebookApp] 0 active kernels

[I 20:07:48.633 NotebookApp] The Jupyter Notebook is running at: http://localhost:8888/

[I 20:07:48.634 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).

[W 20:07:48.635 NotebookApp] No web browser found: could not locate runnable browser.

I then ran D-128-95-149-201:Oly_MBD hollie$ docker-machine ip in another terminal and got back 192.168.99.103

I used this address in firefox and got an unable to connect message.

Any thoughts @kubu4 @sr320

@kubu4

This comment has been minimized.

Copy link
Collaborator

commented Oct 15, 2016

selection_084

@hputnam

This comment has been minimized.

Copy link
Author

commented Oct 15, 2016

Sorry I forgot to say tried that too and same error for all of the following:
192.168.99.103:8888
localhost:8888
192.168.99.103

@kubu4

This comment has been minimized.

Copy link
Collaborator

commented Oct 15, 2016

Are you using Remote Desktop or are you ssh-ing into Roadrunner?

If Remote Desktop, are you using a browser on Roadrunner?

If ssh-ing, did you create a tunnel into Roadrunner?

@hputnam

This comment has been minimized.

Copy link
Author

commented Oct 15, 2016

I am using Remote Desktop, with firefox as browser on Roadrunner under user hollie

@kubu4

This comment has been minimized.

Copy link
Collaborator

commented Oct 15, 2016

What command did you use to launch your Docker container?

@hputnam

This comment has been minimized.

Copy link
Author

commented Oct 15, 2016

docker start 7785b6fe19f1
docker attach 7785b6fe19f1

#hollie running docker:
docker run -p 8787:8787 -p 8888:8888 -v /Users/hollie/Documents/Putnam/Data:/Users/hollie/Documents/HP_BioInf -it 7dc3e9c32189 /bin/bash

@kubu4

This comment has been minimized.

Copy link
Collaborator

commented Oct 15, 2016

What was the original command you used to launch your container?

@hputnam

This comment has been minimized.

Copy link
Author

commented Oct 15, 2016

Originally:
docker run -p 8787:8787 -p 8888:8888 -v /Users/hollie/Documents/Putnam/Data:/Users/hollie/Documents/HP_BioInf -it 7dc3e9c32189 /bin/bash

@hputnam

This comment has been minimized.

Copy link
Author

commented Oct 15, 2016

docker

@kubu4

This comment has been minimized.

Copy link
Collaborator

commented Oct 15, 2016

Leave your container (use Control p, then Control q).

Type: docker start 7dc3e9c32189 and press Enter.
Type: docker ps -a and press Enter.

Post output of the docker ps -a command.

@hputnam

This comment has been minimized.

Copy link
Author

commented Oct 15, 2016

docker_error

@hputnam

This comment has been minimized.

Copy link
Author

commented Oct 15, 2016

Might it be because only safari was installed at the time the container was built and so docker is linked to safari as a web browser and not firefox?

@kubu4

This comment has been minimized.

Copy link
Collaborator

commented Oct 15, 2016

Container named cocky_nobel is now showing that there are ports forwarded, which is what you want.

Now, type: docker attach cocky_nobel and press Enter

This should put you in the container, but you won't see a command prompt. To get to the prompt, type: Control c

You should now have a command prompt within the container. From here, you should be able to follow the steps to get a Jupyter notebook going and access it in the browser on Roadrunner.

There shouldn't be any issues in regards to which browser you use.

@hputnam

This comment has been minimized.

Copy link
Author

commented Oct 15, 2016

Same issue is persisting

Instructions:
Start Jupyter Notebook (enter this inside the container):

jupyter notebook

[I 21:16:49.008 NotebookApp] Serving notebooks from local directory: /Users/hollie/Documents/HP_BioInf/Oly_MBD/Notebooks
[I 21:16:49.009 NotebookApp] 0 active kernels
[I 21:16:49.010 NotebookApp] The Jupyter Notebook is running at: http://localhost:8888/
[I 21:16:49.011 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[W 21:16:49.012 NotebookApp] No web browser found: could not locate runnable browser.

In a separate Terminal window, outside of your container, check the IP address of the Docker machine

docker-machine ip

`````` 192.168.99.103```

Pasted into firefox
192.168.99.103:8888`` got back Unable to connect```

@hputnam

This comment has been minimized.

Copy link
Author

commented Oct 15, 2016

Is this thread helpful?
gopherdata/gophernotes#6

This works
jupyter notebook --ip=0.0.0.0

paste in browser 192.168.99.103:8888

@hputnam

This comment has been minimized.

Copy link
Author

commented Oct 15, 2016

@kubu4

This comment has been minimized.

Copy link
Collaborator

commented Oct 15, 2016

If that works, then I'd certainly say it's helpful. :)

Out of curiosity, are you running Docker for Mac or Docker Toolbox?

@hputnam

This comment has been minimized.

Copy link
Author

commented Oct 15, 2016

I am using the Docker Quickstart Terminal that was previously installed.

@kubu4

This comment has been minimized.

Copy link
Collaborator

commented Oct 19, 2016

I figured out why this isn't working as described in the lab documentation. The Dockerfile actually has instructions to change the default Jupyter notebook IP to 0.0.0.0. That's this weird command: (sed -i '/# c.NotebookApp.ip/c\c.NotebookApp.ip = \x270.0.0.0\x27' /root/.jupyter/jupyter_notebook_config.py)

That command uses sed to edit the Jupyter config file. It looks for the line that starts with "# c.NotebookApp.ip" and then changes the line to "c.NotebookApp.ip = \x270.0.0.0\x27". The weird \x27 is some crazy representation for single quotes.

However, this command is no longer working and that's why you ended up having to specify the default IP address with the jupyter notebook --ip=0.0.0.0

@hputnam

This comment has been minimized.

Copy link
Author

commented Oct 19, 2016

It seems to be working great now with jupyter notebook --ip=0.0.0.0 Good to know why. Thanks!

@hputnam hputnam closed this Oct 19, 2016

@kubu4

This comment has been minimized.

Copy link
Collaborator

commented Oct 19, 2016

I've fixed the Dockerfile so that the lab documentation for this remains accurate (i.e. can use jupyter notebook to launch Jupyter notebooks).

For the curious. the problem was caused by a change in the formatting of the Jupyter config file. The formatting used to have a space after the #. It no longer has a space. I changed the sed commands to be more "universal" so that they only look for lines in the config file that match the text (and, effectively, ignore the formatting of the config file).

@renderit

This comment has been minimized.

Copy link

commented Aug 29, 2017

Having the same issue :(
I did it with jupyter notebook --ip=0.0.0.0 : I get:

[I 19:31:35.329 NotebookApp] Writing notebook server cookie secret to /home/appuser/.local/share/jupyter/runtime/notebook_cookie_secret
[W 19:31:35.343 NotebookApp] WARNING: The notebook server is listening on all IP addresses and not using encryption. This is not recommended.
[I 19:31:35.349 NotebookApp] Serving notebooks from local directory: /home/appuser/pygdf/notebooks
[I 19:31:35.349 NotebookApp] 0 active kernels
[I 19:31:35.349 NotebookApp] The Jupyter Notebook is running at: http://[all ip addresses on your system]:8888/?token=cc7b5e596cc5aab52a097946da65a33c441e577fe2500966
[I 19:31:35.350 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[W 19:31:35.350 NotebookApp] No web browser found: could not locate runnable browser.
[C 19:31:35.350 NotebookApp]

    Copy/paste this URL into your browser when you connect for the first time,
    to login with a token:
        http://localhost:8888/?token=cc7b5e596cc5aab52a097946da65a33c441e577fe2500966

and when I do a wget http://localhost:32769
I get:

--2017-08-29 13:17:27--  http://localhost:32769/
Resolving localhost (localhost)... ::1, 127.0.0.1
Connecting to localhost (localhost)|::1|:32769... connected.
HTTP request sent, awaiting response... Read error (Connection reset by peer) in headers.
Retrying.

gets stuck above..
Any idea why?

$~ docker ps
CONTAINER ID        IMAGE                      COMMAND                  CREATED             STATUS              PORTS                     NAMES
36ce8e81fddd        jupyter/minimal-notebook   "tini -- start-notebo"   4 minutes ago       Up 4 minutes        0.0.0.0:32769->8888/tcp   tiny_hypatia

My /etc/hosts looks like this:

127.0.0.1	localhost
255.255.255.255	broadcasthost
#127.0.1.1	dgx-1
::1		localhost

# The following lines are desirable for IPv6 capable hosts
#::1     ip6-localhost ip6-loopback
#fe00::0 ip6-localnet
#ff00::0 ip6-mcastprefix
#ff02::1 ip6-allnodes
#ff02::2 ip6-allrouters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.