Docker Community Forums

Share and learn in the Docker community.

Where are linked containers listed in container?

I have multiple containers peer0, peer1, peer2. When I login to peer0, I can ping to peer1, peer2.

But when I try to see the local DNS I do not see peer1 and peer2 in it:
root@6d54d21a7f7f:/etc# cat hosts
127.0.0.1 localhost
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
192.168.32.3 6d54d21a7f7f

The containers are in a common network.
Where does docker maintain the DNS entries that allow the containers to reference each other by name?

The Docker daemon provides the DNS service as a built-in feature. Usual tools like host, dig, or nslookup (if they’re installed in your image) can see the records there. It’s a totally normal DNS service, like what your ISP provides (or what Google provides at 8.8.8.8), except that it happens to also have other Docker containers in the same network.