On my host machine (arch linux) I have a somewhat long list of entries in the /etc/hosts file resolving to remote machines (that are not under my control). The Docker containers of a development project that I recently inherited use the domain names that should be resolved by the /etc/hosts file to communicate with different remote services.
But the running containers are not able to resolv the domain names provided by host's /etc/hosts.
That all does work under Mac OSX just fine.
I have tried adding extra_hosts to the docker-compose.yml for one entry and that worked just fine. The problem here is, that the other developers on the project have other IP resolutions in their host machine's /etc/hosts files, so using extra_hosts is not the right solution here, since I have to manually handle the docker-compose.yml outside the git repository, if I wanted to use that. Furthermore there are more than 100 domain names here, that need to be added to about a dozen docker container. Would be a very inconvenient solution.
What am I missing here?
PS: The domains are resolved within a VPN - the servers are not visible outside.
What I did try:
- Adding
IPForward=true
and thenIPForward=kernel
to/usr/lib/systemd/network/80-container-host0.network
; and then - disabling
dnsmasq
;
both described here.