gpt4 book ai didi

docker - 我应该如何解释 Docker busybox 容器内的 nslookup 中的 "Can' t find...”?

转载 作者:行者123 更新时间:2023-12-03 02:27:46 25 4
gpt4 key购买 nike

我不明白我得到的输出。

如果我运行:docker run --rm busybox nslookup google.com,我会得到:

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

...有时 - 有时它会包含相同的结果,但有一个区别:

Address: 216.58.198.174

我不明白:

  • 为什么它会返回两个不同的报告,有时甚至在几秒钟之内返回
  • 为什么 nslookup 在成功返回地址后显示找不到 google.com

如果我直接在我的计算机上运行 nslookup google.com,输出始终为:

Server:     192.168.0.1
Address: 192.168.0.1#53

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

Can't find google.com: No answer 的意义是什么?为什么 nslookup 在 Docker 容器内运行时会随机给出不同的结果?

最佳答案

我今天也遇到这个错误了。据我所知,这可能是 1.29+ 版本的 busybox 附带的 nslookup 中的回归。它与 nslookup 处理从查询中获得的响应的方式有关。有时 AAAA 记录会在 A 记录之前返回,有时则相反。不幸的是,该版本的 nslookup 只抓取先出现的那个并显示它。因此,在您的情况下,查找“google.com”,如果 AAAA 记录首先出现,您会得到 2a00:1450:4009:806::200e,而当它是之前到达的 A 记录时,您会得到 216.58.198.174。

如果您指定 -type=a-type=aaaa,您将获得更一致的行为,并且不会出现错误消息。

$ 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

另一个建议是恢复到 busybox 1.28。

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

了解更多信息:https://github.com/docker-library/busybox/issues/48https://bugs.busybox.net/show_bug.cgi?id=11161#c4 .

关于docker - 我应该如何解释 Docker busybox 容器内的 nslookup 中的 "Can' t find...”?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52663711/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com