The embedded dns server not refresh the host machine dns in some cases

I’m not sure I completely understood the issue, but I wrote about my test results on how Docker uses external DNS servers and when those server addresses are updated

So even if I created a new container, it didn’t use the new DNS until I restarted the Docker daemon. Even if the Docker Daemon already knows about the new DNS servers, Docker creates a resolv.conf for each container and copies it under /var/lib/docker/containers among other files like the hosts file. to mount to the container. So I wouldn’t expect it to be recreated just because the container restarts either, but I would when the container is recreated since that would create a completely new container with a new resolv.conf.

If you are wondering why it works like that and why it doesn’t immediately updates the DNS servers for containers, I guess because this way containers are less likely to be affected by something on the host since the container is an isolated environment which has its own filesystem including the DNS. Docker just helps you to automatically create a resolv.conf so you don’t have to put it into the container. But Docker also supports resolving compose service names or container names to container IP addresses so that is why it uses 127.0.0.11 but it is not running in the containers directly, although I’m not entirely sure about the exact implementation. But you still have the dns config that was created for the container, it just also allows you to resolve internal domain names.