Unable to use internet from a docker container

I am getting this error after running the ubuntu container:

[root@localhost lib]# docker run -it ubuntu apt-get update
Unable to find image ‘ubuntu:latest’ locally
latest: Pulling from library/ubuntu
5c939e3a4d10: Already exists
c63719cdbe7a: Already exists
19a861ea6baf: Already exists
651c9d2d6c4f: Already exists
Digest: sha256:8d31dad0c58f552e890d68bbfb735588b6b820a46e459672d96e585871acc110
Status: Downloaded newer image for ubuntu:latest
Err:1 http://security.ubuntu.com/ubuntu bionic-security InRelease
Temporary failure resolving ‘security.ubuntu.com’
Err:2 http://archive.ubuntu.com/ubuntu bionic InRelease
Temporary failure resolving ‘archive.ubuntu.com’
Err:3 http://archive.ubuntu.com/ubuntu bionic-updates InRelease
Temporary failure resolving ‘archive.ubuntu.com’
Err:4 http://archive.ubuntu.com/ubuntu bionic-backports InRelease
Temporary failure resolving ‘archive.ubuntu.com’
Reading package lists… Done
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic/InRelease Temporary failure resolving ‘archive.ubuntu.com’
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic-updates/InRelease Temporary failure resolving ‘archive.ubuntu.com’
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/bionic-backports/InRelease Temporary failure resolving ‘archive.ubuntu.com’
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/bionic-security/InRelease Temporary failure resolving ‘security.ubuntu.com’
W: Some index files failed to download. They have been ignored, or old ones used instead.

DNS settings:

[root@localhost lib]# cat /etc/docker/daemon.json
{
“dns”: [“192.168.6.2”, “8.8.8.8”]
}
[root@localhost lib]# cat /etc/resolv.conf
#Generated by NetworkManager
search localdomain
nameserver 192.168.6.2
[root@localhost lib]#