Docker container should not resolve DNS in Ubuntu 18.04
I want to access server with name from inside container
Am running a container with --dns flag with host’s DNS server IP
docker run -itd --dns 127.0.0.53 --name test_img
But from inside container am not able access google server
[root@0b86fa7dde50 scripts]# curl google.com
curl: (6) Could not resolve host: google.com; Unknown error
[root@0b86fa7dde50 scripts]#
Host DNS details:
root@rebaca# nslookup google.com
Server: 127.0.0.53
Address: 127.0.0.53#53
Non-authoritative answer:
Name: google.com
Address: 216.58.194.206
Name: google.com
Address: 2607:f8b0:4005:805::200e
without that --dns flag in docker run command, am bale to access google.com as because by default container is running with 8.8.8.8 dns server
But am not able to access my consul server with Domain name.
How would i access consul server and google server with domain names without adding details in /etc/hosts file