I encountered an issue where during the build of my Docker container it was not able to get a response back during an apt-get update command. It turns out it was unable to resolve the DNS entries because of the IPV6 entries in /etc/resolv.conf
Edit /etc/resolv.conf
and comment out the first 2 lines by adding a ‘#’ at the beginning line. For example in my case it was:
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND — YOUR CHANGES WILL BE OVERWRITTEN
nameserver 2001:4860:4860::8844
nameserver 2001:4860:4860::8888
nameserver 209.244.0.3
to
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND — YOUR CHANGES WILL BE OVERWRITTEN
#nameserver 2001:4860:4860::8844
#nameserver 2001:4860:4860::8888
nameserver 209.244.0.3
Another thing to note is to set the DNS which Docker should use. It can be done on docker run but to save time you can set it globally in /etc/default/docker
There is a line:
#DOCKER_OPTS="--dns 8.8.8.8 --dns 8.8.4.4"
Remove the ‘#’ at the beginning of the line and it will use Google’s DNS servers. The IP address can be changed to your preferred DNS provider.
A simple but hair tearing moment when you encounter these configuration issues. The IPv6 issue seems even more odd and begs the question why enable it at all on Digital Ocean.