Dial TCP lookup registry-1.docker.io temporary failure in name resolution Error [SOLVED]
Docker service is running, I am trying to run a docker run hello-world, it is showing a strange error message – temporary name resolution error

Docker name resolution Error
After spending a few hours, found the problem is with name resolution from the OS itself.

Code:
# docker run hello-world
Trying to pull repository docker.io/library/hello-world ...
/usr/bin/docker-current: Get https://registry-1.docker.io/v2/: dial tcp: lookup registry-1.docker.io on 192.168.1.1: read udp 192.168.5.1:52213->192.168.1.1:53: i/o timeout.
See '/usr/bin/docker-current run --help'.
Solution: Add a working DNS IP address to resolv.conf

Solution


Docker daemon is telling us that, it cannot reach the docker registry, we can check whether the internet and DNS service is available. I found my default DNS entry was not able to provide DNS service (by simply doing a test ping google.com ). Problem solved by adding 8.8.8.8 and 8.8.4.4 are DNS service IP address from Google

Code:
# cat /etc/resolv.conf
nameserver 8.8.4.4
nameserver 8.8.8.8
Let us try running a Hello World again
Code:
# docker run hello-world
Unable to find image 'hello-world:latest' locally
Trying to pull repository docker.io/library/hello-world ...
latest: Pulling from docker.io/library/hello-world
1b392d010123: Pull complete
Digest: sha256:451ce111d12222c5df2a32c85e5a03d52cbcef6ac3586dd03075f3034f99dbca
Status: Downloaded newer image for docker.io/hello-world:latest

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
1. The Docker client contacted the Docker daemon.
2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (amd64)
3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
$ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
https://hub.docker.com/

For more examples and ideas, visit:
https://docs.docker.com/get-started/

My system is CentOS 7, this should work in RHEL also
Code:
# cat /etc/redhat-release
CentOS Linux release 7.6.1810 (Core)