After upgrade, docker cannot communicate with the outside world

One thing that I’ve noticed recently in Ubuntu 20 on DigitalOcean is that the host machine doesn’t make its domain name servers available to Docker. This is not an issue with the firewall because Ubuntu 20 doesn’t come with the firewall enabled.

To fix, first find the DO name servers with cat /run/systemd/resolve/resolv.conf. You’ll see something like this…

nameserver 1.2.3.4
nameserver 9.8.7.6

Next, edit the daemon.json file with nano /etc/docker/daemon.json to make those nameservers, and optionally, the Google DNS (8.8.8.8) are available to Docker.

{
    "dns": ["<ip1 from above>", "<ip2 from above>", "8.8.8.8"]
}

Then restart Docker and rebuild.

systemctl restart docker
/var/discourse/launcher rebuild app
2 Likes