Docker version 1.6.2, build 7c8fca2 on Ubuntu 15.10
Today I suddenly noticed that when I built a docker image I was getting errors like the following with apt-get and dnf:
Err http://archive.ubuntu.com wily InRelease
Err http://archive.ubuntu.com wily-updates InRelease
Err http://archive.ubuntu.com wily-security InRelease
Err http://archive.ubuntu.com wily Release.gpg
Temporary failure resolving 'archive.ubuntu.com'
Err http://archive.ubuntu.com wily-updates Release.gpg
Temporary failure resolving 'archive.ubuntu.com'
Err http://archive.ubuntu.com wily-security Release.gpg
Temporary failure resolving 'archive.ubuntu.com'
Error: Failed to synchronize cache for repo 'fedora' from 'https://mirrors.fedoraproject.org/metalink?repo=fedora-22&arch=x86_64': Cannot prepare internal mirrorlist: Curl error (6): Couldn't resolve host name for https://mirrors.fedoraproject.org/metalink?repo=fedora-22&arch=x86_64 [Could not resolve host: mirrors.fedoraproject.org]
For troubleshooting I tried spinning up a Vagrant instance of Ubuntu 14.04 and it grabbed packages with apt-get just fine.
By simple scientific experimentation this meant I had a networking issue from within Docker itself. I tried
sudo systemctl restart networking
sudo systemctl restart network-manager
to of no avail. Then I tried
sudo systemctl restart docker
which DID fix the issue and now the images I build can grab packages from Fedora and Ubuntu just fine. I find it unsatisfactory that I fixed a problem with agnostic heuristics. Could someone please explain to me why what I did fixed the problem so I can set some kind of automated trigger for it for the future?