Probably, you should set the DNS server in daemon.json, located in /etc/docker/daemon.json.
TOTALLY, you need 3 steps:
(1) check your dns server you’re using;
(2) then, set dns server in daemon.json;
(3) finnaly, restart docker service.
For more details about the steps you can look through my reply in the bottom fo this post https://forums.docker.com/t/communication-between-containers-and-wider-world/24295/8