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
$ docker exec containerA ping -c2
PING ( 56 data bytes
64 bytes from seq=0 ttl=64 time=0.368 ms
64 bytes from seq=1 ttl=64 time=0.140 ms
--- 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": "",
                    "Gateway": ""
        "Internal": false,
        "Attachable": false,
        "Ingress": false,
        "ConfigFrom": {
            "Network": ""
        "ConfigOnly": false,

any idea why it happens? how to fix?


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.