Thursday, February 6, 2020

how to resolve the docker building issue "dial tcp: lookup auth.docker.io on 192.168.65.1:53: no such host"?

i try to play with a very simple script to build a docker from my local machine

the error came up immediately with following message

//Command to be execute to build a docker
λ docker build . -t hostname
Sending build context to Docker daemon  4.608kB
Step 1/5 : FROM nginx:latest
Get https://registry-1.docker.io/v2/library/nginx/manifests/latest: Get https://auth.docker.io/token?scope=repository%3Alibrary%2Fnginx%3Apull&service=registry.docker.io: dial tcp: lookup auth.docker.io on 192.168.65.1:53: no such host



The root cause of this issue is that though the Docker Desktop is running in my local, however i did not log into the docker hub.


after i log into the docker and run the command again. the result is succeed.

Sending build context to Docker daemon  4.608kB
Step 1/5 : FROM nginx:latest
latest: Pulling from library/nginx
bc51dd8edc1b: Pull complete
66ba67045f57: Pull complete
bf317aa10aa5: Pull complete
Digest: sha256:ad5552c786f128e389a0263104ae39f3d3c7895579d45ae716f528185b36bc6f
Status: Downloaded newer image for nginx:latest
 ---> 2073e0bcb60e
Step 2/5 : ARG VERSION
 ---> Running in 75e8c63f7258
Removing intermediate container 75e8c63f7258
 ---> 74f3c847d731
Step 3/5 : ENV VERSION=$VERSION
 ---> Running in 6d1ef8500966
Removing intermediate container 6d1ef8500966
 ---> 3de0be6fa8a0
Step 4/5 : COPY hostname.sh .
 ---> 451b37ea6530
Step 5/5 : CMD ["/hostname.sh"]
 ---> Running in b71381f7ba23
Removing intermediate container b71381f7ba23
 ---> 47870a87b284
Successfully built 47870a87b284
Successfully tagged hostname:latest
















No comments:

Post a Comment