applecider
applecider

Reputation: 2461

Serving Jupyter Notebook from within docker container on AWS not working?

I've set up an Ubuntu 14.04 AWS instance. My security group has port 8888 open (tcp), and port 22 open for ssh.

I can ssh into the instance just fine, then in the instance I start a docker container:

docker run -it --name="test" -p 8888:9999 b.gcr.io/tensorflow/tensorflow:latest-devel

This container has jupyter notebook in it, then in the container I run jupyter notebook and I see the correct output:

[I 14:49:43.788 NotebookApp] The Jupyter Notebook is running at: http://[all ip addresses on your system]:8888/
[I 14:49:43.788 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).

And if I run docker ps by opening another ssh, connection I see:

CONTAINER ID        IMAGE                                         COMMAND             CREATED             STATUS              PORTS                                        NAMES
8414f19fcd5f        b.gcr.io/tensorflow/tensorflow:latest-devel   "/bin/bash"         38 minutes ago      Up 23 minutes       6006/tcp, 8888/tcp, 0.0.0.0:8888->9999/tcp   test

So everything seems correct, but I do not see jupyter notebook at: http://PUBLICIP:8888

Upvotes: 3

Views: 1484

Answers (2)

giraycoskun
giraycoskun

Reputation: 161

In my case the solution was to add --network="host" to docker run command However it comes with some other effects be aware.

You can checkout from

https://docs.docker.com/network/host/#:~:text=If%20you%20use%20the%20host,its%20own%20IP%2Daddress%20allocated

https://docs.docker.com/network/bridge/#enable-forwarding-from-docker-containers-to-the-outside-world

Because I think , it is a docker network problem.

Upvotes: 0

applecider
applecider

Reputation: 2461

Instead of:

docker run -it --name="test" -p 8888:9999 b.gcr.io/tensorflow/tensorflow:latest-devel

The trick was to use:

docker run -it --name="test" -p 8888:8888 b.gcr.io/tensorflow/tensorflow:latest-devel

Edit, thanks to DDW for the explanation:

"-p 8888:9999 doesn't stand for a range, it means port 9999 of your docker container is mapped to port 8888. 8888 is probably your standard notebook port, so it is logical that 8888:8888 works."

If you want to have two ports open then the command would be:

docker run -it --name="test" -p 8888:8888 -p 9999:9999 b.gcr.io/tensorflow/tensorflow:latest-devel

Upvotes: 1

Related Questions