Question

Temporary name resolution failure across docker, ping, apt...

Problem: pinging google.com, pulling any docker image, doing apt update all crash with temporary name resolution, this is even AFTER I added 8.8.8.8 and 1.1.1.1 as nameservers in netplan config. See demo:

droplet:~# ping 1.1.1.1
PING 1.1.1.1 (1.1.1.1) 56(84) bytes of data.
64 bytes from 1.1.1.1: icmp_seq=1 ttl=59 time=1.66 ms
64 bytes from 1.1.1.1: icmp_seq=2 ttl=59 time=1.09 ms
64 bytes from 1.1.1.1: icmp_seq=3 ttl=59 time=0.947 ms
64 bytes from 1.1.1.1: icmp_seq=4 ttl=59 time=0.960 ms
^C
--- 1.1.1.1 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3004ms
rtt min/avg/max/mdev = 0.947/1.163/1.656/0.289 ms
root:~# ping digitalocean.com
ping: digitalocean.com: Temporary failure in name resolution
droplet:~# docker pull helloworld
Using default tag: latest
Error response from daemon: Get https://registry-1.docker.io/v2/: dial tcp: lookup registry-1.docker.io on [::1]:53: read udp [::1]:40123->[::1]:53: read: connection refused
droplet:~# apt update
Err:1 http://security.ubuntu.com/ubuntu focal-security InRelease
  Temporary failure resolving 'security.ubuntu.com'
Err:2 https://repos-droplet.digitalocean.com/apt/droplet-agent main InRelease
  Temporary failure resolving 'repos-droplet.digitalocean.com'
Err:3 https://download.docker.com/linux/ubuntu focal InRelease
  Temporary failure resolving 'download.docker.com'
Err:4 http://mirrors.digitalocean.com/ubuntu focal InRelease
  Temporary failure resolving 'mirrors.digitalocean.com'
Err:5 http://mirrors.digitalocean.com/ubuntu focal-updates InRelease
  Temporary failure resolving 'mirrors.digitalocean.com'
Err:6 http://mirrors.digitalocean.com/ubuntu focal-backports InRelease
  Temporary failure resolving 'mirrors.digitalocean.com'
Reading package lists... Done
Building dependency tree       
Reading state information... Done
All packages are up to date.
W: Failed to fetch http://mirrors.digitalocean.com/ubuntu/dists/focal/InRelease  Temporary failure resolving 'mirrors.digitalocean.com'
W: Failed to fetch http://mirrors.digitalocean.com/ubuntu/dists/focal-updates/InRelease  Temporary failure resolving 'mirrors.digitalocean.com'
W: Failed to fetch http://mirrors.digitalocean.com/ubuntu/dists/focal-backports/InRelease  Temporary failure resolving 'mirrors.digitalocean.com'
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/focal-security/InRelease  Temporary failure resolving 'security.ubuntu.com'
W: Failed to fetch https://download.docker.com/linux/ubuntu/dists/focal/InRelease  Temporary failure resolving 'download.docker.com'
W: Failed to fetch https://repos-droplet.digitalocean.com/apt/droplet-agent/dists/main/InRelease  Temporary failure resolving 'repos-droplet.digitalocean.com'
W: Some index files failed to download. They have been ignored, or old ones used instead.
droplet:~# vim /etc/hosts
droplet:~# docker pull helloworld
Using default tag: latest
Error response from daemon: Get https://registry-1.docker.io/v2/: x509: certificate is valid for *.setupdev.abaris.com.br, *.abaris.com.br, not registry-1.docker.io

Last part is me trying to put registry-1 IP directly into /etc/hosts - it yielded cert not valid message. Any ideas?


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

alexdo
Site Moderator
Site Moderator badge
July 10, 2023

Heya,

In addition to that, you might want to check if the resolv.conf file is configured correctly. You can try to temporarily set the nameserver directly in the /etc/resolv.conf file by adding the following lines:

nameserver 8.8.8.8 nameserver 1.1.1.1

This should override any DNS settings on the server. However, note that this is only a temporary solution. If this works, it means there’s likely an issue with how the DNS is configured in netplan.

If that doesn’t help, there might be a more complex issue happening and further troubleshooting might be necessary.

For your Docker related concerns, it’s possible that Docker is not using the correct DNS. Docker typically uses the same DNS as the host machine, but this can be manually set as well. Refer to Docker’s official documentation on working with network commands for more information.

For more instruction on networking and DNS configuration, you can explore our documentation in this link.

Hope that this helps!

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel