IP 127 is assigned the "loopback" function, that is, no datagram "sent" to a network 127 address should ever appear on any network anywhere. Hence the docker container created only could run the URL and it was not working on the host machine or localhost to the browser.
In the context of servers, 0.0.0.0 means "all IPv4 addresses on the local machine". If a host has two IP addresses, a server running on the host listens on 0.0.0.0, it will be reachable at both IPs.
Change file : cars_app.py host ="0.0.0.0" instead of "127.0.0.1"
Test : python cars_app.py
URL would be
IP 127 is assigned the "loopback" function, that is, no datagram "sent" to a network 127 address should ever appear on any network anywhere. Hence the docker container created only could run the URL and it was not working on the host machine or localhost to the browser. In the context of servers, 0.0.0.0 means "all IPv4 addresses on the local machine". If a host has two IP addresses, a server running on the host listens on 0.0.0.0, it will be reachable at both IPs.
Change file : cars_app.py host ="0.0.0.0" instead of "127.0.0.1" Test : python cars_app.py URL would be
Running on http://0.0.0.0:5000/ (Press CTRL+C to quit)