0

Here is my /etc/resolve.conf file from my host machine. I have commented both the public nameservers

# Generated by NetworkManager 
# nameserver 8.8.8.8 
# nameserver 4.2.2.2

When I try to ping google.com from my host machine, it didn't work since I have commented the public DNS server.

ping: google.com: Name or service not known

Here is my /etc/resolve.conf file from the docker container

nameserver 127.0.0.11
options ndots:0

When I try to ping google.com from my docker container, it works.

PING google.com (216.58.209.14): 56 data bytes 
64 bytes from 216.58.209.14: seq=0 ttl=117 time=131.562 ms
64 bytes from 216.58.209.14: seq=1 ttl=117 time=191.746 ms

Since docker container network by default resolves to /etc/resolve.conf file from host machine, then how this scenario works? And what does the /etc/resolve.conf file from docker container refers to? Please help me out to understand more on this.

Sithaara
  • 1
  • 1
  • What's the docker networking configuration you're using? – Arik Jun 18 '20 at 06:17
  • Assuming you just want to block internet, may be [this answer](https://stackoverflow.com/questions/39913757/restrict-internet-access-docker-container) will help. – ssnk Jun 18 '20 at 09:04

0 Answers0