Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How should I interpret a "Can't find..." from nslookup inside a Docker busybox container?

I don't understand the output I'm getting.

If I run: docker run --rm busybox nslookup google.com, I'll get:

Server:     192.168.65.1
Address:    192.168.65.1:53

Non-authoritative answer:
Name:   google.com
Address: 2a00:1450:4009:806::200e

*** Can't find google.com: No answer

...sometimes - and sometimes it will contain instead the same result, with one difference:

Address: 216.58.198.174

I don't understand:

  • why it returns two different reports, sometimes within seconds of each other
  • why nslookup says Can't find google.com when it has successfully returned an address.

If I run nslookup google.com directly on my machine, the output is always:

Server:     192.168.0.1
Address:    192.168.0.1#53

Non-authoritative answer:
Name:   google.com
Address: 216.58.208.142

What is the significance of Can't find google.com: No answer, and why does nslookup appear to give different results randomly when run inside the Docker container?

like image 794
Daniele Procida Avatar asked Oct 05 '18 10:10

Daniele Procida


1 Answers

I had this error today as well. From what I could gather, it might be a regression in nslookup that ships with versions 1.29+ of busybox. It has to do with the way nslookup handles the response it gets from its query. Sometimes the AAAA record is returned before the A record, other times it's the other way around. Unfortunately that version of nslookup just grabs whichever comes first and displays it. So in your case, doing a lookup of "google.com" you get 2a00:1450:4009:806::200e if the AAAA record comes first, and you get 216.58.198.174 when its the A record that gets there before.

If you specify -type=a or -type=aaaa you get a more consistent behavior and no error messages.

$ docker run --rm busybox nslookup -type=aaaa example.com
Server:     208.67.222.222
Address:    208.67.222.222:53

Non-authoritative answer:
Name:   example.com
Address: 2606:2800:220:1:248:1893:25c8:1946

The other recommendation is to revert back to busybox 1.28.

docker run --rm busybox:1.28 nslookup example.com

To learn more: https://github.com/docker-library/busybox/issues/48 and https://bugs.busybox.net/show_bug.cgi?id=11161#c4.

like image 55
Michael Ekoka Avatar answered Nov 17 '22 02:11

Michael Ekoka