![一个 Docker 容器无法正确解析 DNS](https://linux22.com/image/761172/%E4%B8%80%E4%B8%AA%20Docker%20%E5%AE%B9%E5%99%A8%E6%97%A0%E6%B3%95%E6%AD%A3%E7%A1%AE%E8%A7%A3%E6%9E%90%20DNS.png)
我的 Mailcow 实例出现了奇怪的问题。一个容器(Postfix)已开始部分解析 DNS。问题只出在这个特定的容器上,我不明白。由于错误,它导致电子邮件无法从中发送domain name not found
。
root@6c751ea397ad:/# host wp.pl
Host wp.pl not found: 2(SERVFAIL)
root@6c751ea397ad:/# host mx.wp.pl
Host mx.wp.pl not found: 2(SERVFAIL)
root@6c751ea397ad:/# cat /etc/resolv.conf
search domain.com
nameserver 127.0.0.11
options ndots:0
但使用外部 DNS:
root@6c751ea397ad:/# host wp.pl 1.1.1.1
Using domain server:
Name: 1.1.1.1
Address: 1.1.1.1#53
Aliases:
wp.pl has address 212.77.98.9
wp.pl mail is handled by 0 mx.wp.pl.
wp.pl mail is handled by 5 mx5.wp.pl.
对于不同的域:
root@6c751ea397ad:/# host -t any o2.pl
o2.pl has address 212.77.98.29
o2.pl descriptive text "facebook-domain-verification=0omejgqroqocgh4efgrbu8bovlazni"
o2.pl descriptive text "v=spf1 include:wp.pl -all"
o2.pl mail is handled by 10 mx.tlen.pl.
o2.pl has SOA record ns1.go2.pl. root.go2.pl. 2020111002 3600 1080 1209600 7200
o2.pl name server ns1.go2.pl.
o2.pl name server ns2.go2.pl.
root@6c751ea397ad:/# host -t any mx.tlen.pl
mx.tlen.pl has address 193.222.135.150
这个真的很奇怪:
root@6c751ea397ad:/# host -t any company.mail.protection.outlook.com
Host company.mail.protection.outlook.com not found: 2(SERVFAIL)
root@6c751ea397ad:/# host -t any outlook.com
outlook.com has SOA record bn7mgt0101dc013.prdmgt01.prod.exchangelabs.com. msnhst.microsoft.com. 2014796278 300 900 2419200 60
outlook.com has address 40.97.148.226
outlook.com has address 40.97.153.146
outlook.com has address 40.97.161.50
...
每个其他容器都运行良好:
root@c228923398e8:/# host wp.pl
wp.pl has address 212.77.98.9
wp.pl mail is handled by 5 mx5.wp.pl.
wp.pl mail is handled by 0 mx.wp.pl.
root@c228923398e8:/# host mx.wp.pl
mx.wp.pl has address 212.77.101.4
root@c228923398e8:/# cat /etc/resolv.conf
search domain.com
nameserver 127.0.0.11
options ndots:0
我到目前为止已经尝试过:
resolvconf
从主机中删除并重新安装- 将 1.1.1.1/8.8.8.8 添加到
/etc/resolvconf/resolv.conf.d/base
和/etc/resolvconf/resolv.conf.d/head
- 将 DNS 添加到:
/etc/docker/daemon.json
- 向 mailcow docker-compose 添加静态 DNS
- 禁用防火墙
一切都毫无进展。