I found a network issue when trying to build my docker image: the command `apt update` fails with the following error:
W: Failed to fetch http://deb.debian.org/debian/dists/buster/InRelease
W: Failed to fetch http://deb.debian.org/debian/dists/buster-updates/InRelease
W: Failed to fetch http://security.debian.org/dists/buster/updates/InRelease
W: Failed to fetch http://deb.debian.org/debian/dists/buster/Release.gpg Temporary failure resolving ‘deb.debian.org’
W: Failed to fetch http://security.debian.org/dists/buster/updates/Release.gpg Temporary failure resolving ‘security.debian.org’
W: Failed to fetch http://deb.debian.org/debian/dists/buster-updates/Release.gpg Temporary failure resolving ‘deb.debian.org’
W: Some index files failed to download. They have been ignored, or old ones used instead.
This happens because your ISP DNS servers are not reachable from this network. The easiest workaround is to directly instruct Docker to rely on some public DNS servers proven to be stable and reliable (Google, Cloudflare).
Add them to a new configuration file called daemon.json
:
$ sudo pico /etc/docker/daemon.json
Insert the following:
{
"dns": ["1.1.1.1", "8.8.8.8", "8.8.4.4"]
}
Then restart the service:
$ sudo service docker restart