DNS not working inside container

I am upgrading my host linux system, but suddenly, my containers just can NOT connect to others or outside by name.

Here is the command results of my debug:

$ docker network inspect -f '{{range .Containers}}{{.Name}} {{end}}' t2_proxy
containerA containerB
$ docker exec containerA ping containerB -c2
ping: bad address 'containerB'
$ docker inspect -f '{{.NetworkSettings.Networks.t2_proxy.IPAddress}}' containerB
172.18.0.16
$ docker exec containerA ping 172.18.0.16 -c2
PING 172.18.0.16 (172.18.0.16): 56 data bytes
64 bytes from 172.18.0.16: seq=0 ttl=64 time=0.368 ms
64 bytes from 172.18.0.16: seq=1 ttl=64 time=0.140 ms
--- 172.18.0.16 ping statistics ---
2 packets transmitted, 2 packets received, 0% packet loss
round-trip min/avg/max = 0.140/0.254/0.368 ms
$ docker network inspect t2_proxy
[
    {
        "Name": "t2_proxy",
        "Id": "7f8cc64230a0837906c8fedf9b07fa8d8c67f710d1f33b52cf5376aa4696ae5b",
        "Created": "2021-09-21T16:35:41.820647853+08:00",
        "Scope": "local",
        "Driver": "bridge",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "default",
            "Options": {},
            "Config": [
                {
                    "Subnet": "172.18.0.0/16",
                    "Gateway": "172.18.0.1"
                }
            ]
        },
        "Internal": false,
        "Attachable": false,
        "Ingress": false,
        "ConfigFrom": {
            "Network": ""
        },
        "ConfigOnly": false,
...

any idea why it happens? how to fix?

thanks,
David

It might be helpful to see which values are under “DNSNames” with a “docker container inspect [container-id]”. And instead of a ping, you can also use “nslookup” or “dig” to check whether the DNS resolver is responding. Thanks.