I am getting error in resolv.conf

Your system is using the systemd-resolved stub resolver, which binds to an ip that is not accessible from the containers. Docker tries to use the upstream configuration the stub resolver uses and fails for whatever reason.

If you deactivate the stub resolver, your system should use the resolver it gets from the dhcp server.

You can configure it in the file /etc/systemd/resolved.conf.d/resolved.conf (if the file doesn’t exist, make a copy of the existing configuration cp /etc/systemd/resolved.conf/etc/systemd/resolved.conf.d/resolved.conf) by setting DNSStubListener=no, then restart the service: systemctl restart systemd-resolved.service.