nslookup 报告 "can't resolve '(null)': Name does not resolve" 尽管它成功解析了 DNS 名称

nslookup reported "can't resolve '(null)': Name does not resolve" though it successfully resolved the DNS names

我在 ubuntu,我正在 运行 设置一个 docker 默认桥接网络。我有容器化版本的 zookeeper、kafka 和我编写的与 kafka 对话的应用程序。

我做了一个:

docker exec -it <my-app id> /bin/bash

然后在我的应用程序容器中 运行 nslookup kafka

/go # nslookup schmafka
nslookup: can't resolve '(null)': Name does not resolve

Name:      schmafka
Address 1: 172.20.0.8 docker_kafka_1.docker_default

我不明白为什么我得到输出"can't resolve '(null)'"然后我得到了稍后打印出的预期IP地址。我尝试 google nslookup 和此输出消息,但我不明白为什么会这样。

我的 /etc/resolv.conf 文件如下所示:

/go # cat /etc/resolv.conf 
search valhalla.local valhalla v
nameserver 127.0.0.11
options ndots:0

这是 nslookup 中的 bug/oddity。 "can't resolve" 消息实际上是关于正在使用的 DNS 服务器,而不是您要查找的站点。

例如,此查询(告诉 nslookup 使用 8.8.8.8 DNS 服务器查找 google.com)没有错误消息:

nslookup google.com 8.8.8.8
Server:    8.8.8.8
Address 1: 8.8.8.8 dns.google

Name:      google.com
Address 1: 172.217.164.110 sfo03s18-in-f14.1e100.net
Address 2: 2607:f8b0:4005:80b::200e sfo03s18-in-x0e.1e100.net

但是这个查询(其中的 DNS 服务器是 "null")确实显示 "error":

UAP-AC-LR1-BZ.v4.0.42# nslookup google.com
nslookup: can't resolve '(null)': Name does not resolve

Name:      google.com
Address 1: 172.217.164.110 sfo03s18-in-f14.1e100.net
Address 2: 2607:f8b0:4005:80b::200e sfo03s18-in-x0e.1e100.net

诚然,这是 misleading/confusing,确实应该在 nslookup 中修复。