为什么 Net::DNS::Resolver 不 return 本地主机的 IP?

Why Net::DNS::Resolver does not return IP for localhost?

我在 docker 集装箱内。当我运行:perl -Ilocal/lib/perl5 -MNet::DNS::Resolver -e 'print Net::DNS::Resolver->new()->query( "999781edb101" )'它returns什么都没有。
但是 nslookup 会:

# nslookup 999781edb101
Server:     127.0.0.11
Address:    127.0.0.11#53

Non-authoritative answer:
Name:   999781edb101
Address: 172.16.16.7

为什么 Net::DNS::Resolver 没有将主机名解析为 IP?
我应该配置什么才能使其正常工作?
谢谢

UPD
如果我使用 debug 项目,我可以看到它从 search xxx.com/etc/resolv.conf:

查询域
# perl -Ilocal/lib/perl5 -MNet::DNS::Resolver -e '$r = Net::DNS::Resolver->new(); $r->debug(1); print $r->query( "999781edb101" )'

;; query( 999781edb101.xxx.com )

;; udp send [127.0.0.11]:53

;; reply from [127.0.0.11] 121 bytes
;; HEADER SECTION
;;  id = 26399
;;  qr = 1  aa = 0  tc = 0  rd = 1  opcode = QUERY
;;  ra = 1  z  = 0  ad = 0  cd = 0  rcode  = NXDOMAIN
;;  qdcount = 1 ancount = 0 nscount = 1 arcount = 0
;;  do = 0

;; QUESTION SECTION (1 record)
;; 999781edb101.xxx.com.    IN  A

;; ANSWER SECTION (0 records)

;; AUTHORITY SECTION (1 record)
xxx.com.    1800    IN  SOA ( xxx.com. zzzzzzzzzzzzzz.
                2021070806  ;serial
                43200       ;refresh
                3600        ;retry
                604800      ;expire
                86400       ;minimum
    )

;; ADDITIONAL SECTION (0 records)


;; errorstring: NXDOMAIN
# cat /etc/resolv.conf 
nameserver 127.0.0.11
search xxx.com
options ndots:0

从文档和您的调试输出来看,您希望 Net::DNS::Resolver->new(defnames => 0) 将不合格的名称(不带点)直接传递给服务器,而不是始终附加默认域。