How to reach localhost on host from docker container?

if you need to connect your containers to the host most cases you would use the host networking mode
this would be if you are running some form of monitoring service.

if for example you run services on your host which you want to expose to your containers like a database management system then you should rethink how you are hosting your services.

If you need to connect to the host for example you are developing an application using dev containers then you should be using windows.

This is from my observations and my understanding from the people who work on docker
Otherwise host.docker.internal would be an officially supported option to be used in the engine cross platform.