18.06.2018 · And they can ping each other without any extra DNS efforts. Since user-defined networks have inbuilt DNS which resolves IP addresses from container names. $ docker exec -it nginx1 ping nginx2. PING nginx2 (172.19.0.5) 56 (84) bytes of data. 64 bytes from nginx2.kerneltalks (172.19.0.5): icmp_seq=1 ttl=64 time=0.151 ms.
Problem solved. Docker containers take DNS IPs from the host machine, which is managed by systemd-resolve . Those IPs themselves are the cloud provider's DNS.
17.11.2021 · Interestingly, in some places, network administrators intentionally block public DNS servers to ensure that the network’s own DNS server is used instead. In such cases, Docker containers that rely on the default configuration are unable to resolve DNS.
5 . Restart networking, update resolv.conf, restart docker: sudo service network-manager restart sudo resolvconf -u sudo service dnsmasq restart sudo service docker restart. Your containers will now be able to resolve DNS from whatever DNS servers the host machine is using. Share.