macOS port mapping connection refused

I’ve followed the steps provided in the lesson and when I run docker run -p 80:5000 some-name the Flask app runs but I get a “The connection was reset” in Firefox. I’m on macOS 10.15.4.

Why is that?

Hi ricardoaugusto,

Check the example below for 20. Demo to know what you have missed.

Also, the docker host IP is the IP of the machine itself and you can get it using the command ifconfig

There are two ways to access the application :

  1. Without port mapping, you can access your application using But for this, you need to be able to access the IP This IP is an IP assigned to the docker container by the docker host. So you must be inside your Docker host (which I believe is a Linux VM in your case). If your Linux VM doesn’t have a GUI, then you can try accessing your application using curl like this: curl

  2. With Port Mapping - To access your application outside the Docker host, you need to map the port on the docker container ( to a port on the Docker host ( Because, from outside of your docker host, like your laptop, you can only ping the Docker host and not the docker container directly.

This is explained in detail in Demo - Docker run here