Docker Community Forums

Share and learn in the Docker community.

Can't connect port to docker container on linux


I used to be able to do this on my mac, but since moving to PopOS (a version of Ubuntu) on my new super powerful laptop, it does not work:

docker run -p 8888:8888 jupyter/scipy-notebook:2c80cf3537ca

it then says:

Copy/paste this URL into your browser when you connect for the first time,
to login with a token:

So normally I just paste that into my browser and it should open up the jupyter notebook.

However, on my linux machine, it just stays forever loading and says “this site can’t be reached”.

I have tried mapping 1234:8888 and 10000:8888

Am I mapping the ports wrong?
I seem to remember reading somewhere that the ports are a bit different when using linux and docker.
However, its almost impossible to use google to find the solution since almost any page with the word “docker” in it, also has the words “linux” and “ubuntu”.

So here I am!

Please, please can anyone help me! I desperately want to run some data science on my new linux laptop, but cannot even open the damn notebook.

So the problem can be broken down to the following steps:

Check the docker inspect or docker ps results to ensure that you have your port exposed correctly
Try to connect to it using the public IP. If you got an error message for example

Connection Refused: The reason could be because the application inside the container is not running as expected. for example you need to ensure that the application bind to and not

Connection Timeout: The reason could be a firewall outside the server like SecurityGroups in AWS or similar or maybe docker is not managing the server firewall (which is not the default setup)