Some systems can't connect to themselves via their public IP address, via a (sub)domain) for example.
I.e. local -> router -> internet > router > local
Adding an entry to the /etc/hosts file in the docker container mapping the external (sub)domain to the same IP address and host.docker.internal.