Docker resolver should use host /etc/hosts file

The docker custom dns should be able to resolve entries to the docker-hosts /etc/hosts file.

Assume the following scenario: a docker host and an external service are in the same network.
The docker container needs to reach that service, but if it resolves its ip it gets an external address, which obviously is not reachable form inside the network.
So the host gets an entry to /etc/hosts to override the ip. The container however ignores it, since its /etc/hosts file is docker managed and does not get the entries and uses, which then relays to an external nameserver like google.

->You cannot use -v /etc/hosts:/etc/hosts since /etc/hosts in the container is managed by docker (works in some scenarios)
->You cannot use the host network, because oftentimes it is not an option to break that isolation


Try upgrading docker.
The issue you refer to is fixed on docker version 20.10.