My droplet is not connected to the internet

February 16, 2018 1.3k views
Networking Dokku DigitalOcean Docker Ubuntu 16.04

I am not sure what is going on but it seems my droplet is not connected to the internet.

I tried to run

sudo apt-get update

and here is the result:

Err http://mirrors.digitalocean.com xenial InRelease
Err http://mirrors.digitalocean.com xenial-updates InRelease
Err http://mirrors.digitalocean.com xenial-backports InRelease
Err http://security.ubuntu.com xenial-security InRelease
Err http://mirrors.digitalocean.com xenial Release.gpg
Temporary failure resolving 'mirrors.digitalocean.com'
Err http://mirrors.digitalocean.com xenial-updates Release.gpg
Temporary failure resolving 'mirrors.digitalocean.com'
Err http://security.ubuntu.com xenial-security Release.gpg
Temporary failure resolving 'security.ubuntu.com'
Ign https://apt.dockerproject.org ubuntu-trusty InRelease
Err http://mirrors.digitalocean.com xenial-backports Release.gpg
Temporary failure resolving 'mirrors.digitalocean.com'
Ign https://packagecloud.io xenial InRelease
Ign https://apt.dockerproject.org ubuntu-trusty Release.gpg
Ign https://packagecloud.io xenial Release.gpg
Ign https://apt.dockerproject.org ubuntu-trusty Release
Ign https://packagecloud.io xenial Release
Ign https://apt.dockerproject.org ubuntu-trusty/main amd64 Packages/DiffIndex
Ign https://packagecloud.io xenial/main amd64 Packages/DiffIndex
Ign https://apt.dockerproject.org ubuntu-trusty/main i386 Packages/DiffIndex
Ign https://packagecloud.io xenial/main i386 Packages/DiffIndex
Ign https://packagecloud.io xenial/main Translation-en
Ign https://apt.dockerproject.org ubuntu-trusty/main Translation-en
Err https://packagecloud.io xenial/main amd64 Packages
Could not resolve host: packagecloud.io
Err https://packagecloud.io xenial/main i386 Packages
Could not resolve host: packagecloud.io
Err https://apt.dockerproject.org ubuntu-trusty/main amd64 Packages
Could not resolve host: apt.dockerproject.org
Err https://apt.dockerproject.org ubuntu-trusty/main i386 Packages
Could not resolve host: apt.dockerproject.org

I also have dokku installed and when I tried to rebuild my app, here is the result:

# dokku ps:rebuild
# docker: Error response from daemon: open /etc/resolv.conf: no such file or directory.

I also tried pinging to google and here is the result:

# ping google.com
# ping: unknown host google.com

Any solutions?

1 Answer
moisey MOD February 16, 2018
Accepted Answer

You aren't having an issue connecting to the internet just yet.

If you want to test connectivity you need to ping an IP address that you know is available and you were on the right path with pinging google however, your issue is with DNS. This is why you can't resolve google.com to the underlying IP address and that's why your ping fails.

To test connectivity you can do:

$ ping 172.217.8.142
PING google.com (172.217.8.142): 56 data bytes
64 bytes from 172.217.8.142: icmp_seq=0 ttl=53 time=2.847 ms

The IP address, 172.217.8.142, is google's. If you ping it will most likely respond.

Now your issue is due to the fact that your /etc/resolv.conf is missing which you can see in your dokku error message:

# dokku ps:rebuild
# docker: Error response from daemon: open /etc/resolv.conf: no such file or directory.

So what you will need to do edit your resolv.conf file which determines what nameservers your droplet will use

nano /etc/resolv.conf file:

And add the following lines:

nameserver 8.8.8.8 
nameserver 8.8.4.4

Those are google's public facing nameservers that anyone can use.

After you edit the file and save that config retry your commands and you should be good to go.

Have another answer? Share your knowledge.