The docker network is isolated from the outside by default, when we want to connect from outside to a docker container we use/create a port mapping and this get exposed through localhost, 127.0.0.1 or your IP address.
[!note] 127.0.0.1 is a loopback address that the system uses to communicate to itself, there is a DNS auto resolved name called localhost that points to 127.0.0.1.
In this example we are going to configure a Web Server and a MySQL database.