Ubuntu 20.04:DNS 在容器内不起作用

Ubuntu 20.04:DNS 在容器内不起作用

在容器内部我收到如下错误:

Can't connect to server (HTTPSConnectionPool(host='domain.com', port=443):

root@2067c7f848be:/app$ cat /etc/resolv.conf

nameserver 127.0.0.11
options ndots:0

DNS 在主机上运行正常:

--- google.com ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4007ms

主机设置:

cat /etc/resolv.conf

nameserver 8.8.8.8
nameserver 192.168.0.1
search .

cat /etc/docker/daemon.json

{
    "dns": ["8.8.8.8"]
}

cat /etc/systemd/resolved.conf

[Resolve]
DNS=8.8.8.8
FallbackDNS=9.9.9.9

相关内容