Unable to access docker container through browser e.g jupyter/datascience-notebook (MacOSX)

Hi!
I hope this the right spot for my question / need of help?

I want to run the docker container jupyter/datascience-notebook on a Mac.
I start it with this command: docker run -p 7777:7777 --name DataS jupyter/datascience-notebook
It starts and in the end tells me:
" Copy/paste this URL into your browser when you connect for the first time,
to login with a token:
http://(20a355397b52 or 127.0.0.1):8888/?token=fc413e16bededd3498bd8ef4aa4372ebd38e9129dfad95aa
"

First, it is port 8888 instead of 7777 and second won’t connect anyway, either port.
Docker -ps show me this:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
20a355397b52 jupyter/datascience-notebook “tini -g – start-no…” 8 minutes ago Up 8 minutes 0.0.0.0:7777->7777/tcp, 8888/tcp DataS
7d6a1f8b17c5 tylerfowler/superset “/superset-init.sh” 25 hours ago Up 25 hours 0.0.0.0:8088->8088/tcp superset
53fc131a89ed postgres:10 “docker-entrypoint.s…” 5 weeks ago Up 28 hours 0.0.0.0:5432->5432/tcp incubator-superset_postgres_1
bdffff137216 redis:3.2 “docker-entrypoint.s…” 5 weeks ago Up 28 hours 0.0.0.0:6379->6379/tcp incubator-superset_redis_1

The ONLY docker container I can access through the browser is the tylerfowler/superset container :frowning:

And this docker container run a whole bunch of init instruction before.

What can I do?
Why does it work with the one container but not with “normal” containers?

Thanks.

Hi :slight_smile:

instead of using “-p 7777:7777”, try using “-p 8888:8888”.
The first “8888” defines which port YOU connect to, and the second “8888” is what port its running IN the container.
According to the image docs it needs to be 8888.

Also what you can see here:

20a355397b52 jupyter/datascience-notebook “tini -g – start-no…” 8 minutes ago Up 8 minutes 0.0.0.0:7777->7777/tcp, 8888/tcp

Is that 8888/tcp is exposed in the container, but not mapped.

So try the:

docker run -tid -p 8888:8888 --name DataS jupyter/datascience-notebook

Hi!

Thanks for your help. :grinning:
“Unfortunately” you are right. I intentional set it to another port other than 8888 because that is the port my local webserver is usually running. Of course I could change that at will e.g. to 7777 :wink: But I thought doing so with docker is the more elegant way… :thinking:

I thought I could map to various local ports with docker?
And why are there other containers running on totally different ports? Any ideas?
Thank you very much. :ok_hand:
Cheers
Andreas

Hi again.

You can set your LOCAL port to anything you want, but the container port, needs to be the port the service is listning on, the ports dosnt have to be the same.

so you can have it like this: -p 7777:8888

This will map your LOCAL port 7777 to port 8888 in container